This is caused by the way WordPress works. Whatever page you select for the posts page, that page gets replaced by the main loop in the themes index.php file.
For example, let's say you have a page called "Blog" and that's what you select for the "Posts page" in WP Admin -> General -> Reading. Now, when you visit the Blog page, WordPress will take the theme's index.php file (where the main loop displays the latest blog posts) and use that when the Blog page is requested.
When the Blog page is selected as the Posts page, it ceases being the Blog page "page" and becomes a special WordPress generated page (using the theme's index.php file) to display the latest posts.
So, to solve your problem here's what you could do: You could modify your theme's index.php file and add some PHP code above the main loop that checks if the person visiting the page is logged in. Something like this:
- Code:
if(!is_user_logged_in()) {
echo 'Sorry, you must be logged in to access this page';
} else {
}
If you want to automatically redirect non-logged in users to the Membership Options page, you could modify the above code by adding some JavaScript that redirects non-logged in users:
- Code:
if(!is_user_logged_in()) {
echo '<script type="text/javascript">
<!--
window.location = "http://example.com/membership-options/"
//-->
</script>';
} else {
}
The downsides to this way of redirecting would be that it wouldn't work for anyone with JavaScript disabled.
The other downside is that the redirect wouldn't pass any of the Membership Options Variables that normally get passed during an s2Member redirect (although I suppose with a little work you could build the redirect URL manually to include those variables).Statistics: Posted by Raam Dev — December 15th, 2011, 12:23 am
]]>