- This topic has 4 replies, 2 voices, and was last updated 8 years, 4 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Initial request to login to view protected content page
I have a protected page that when a user lands here there is an automatic prompt page that lets a user know that it is a protected page and you need to log in.
Can you bypass this prompt and go directly to the login page??
Is this what you are looking for?
https://simple-membership-plugin.com/auto-redirect-non-logged-in-users-protect-whole-site/
I think so. I tweaked the code like so:
/*** Auto redirect a user who isn’t logged into the site ***/
add_filter( ‘pre_get_posts’, ‘swpm_auto_redirect_non_members’ );
function swpm_auto_redirect_non_members() {
if( !SwpmMemberUtils::is_member_logged_in() && !is_page( array( ‘membership-login’, ‘membership-join’ )) ) {
wp_redirect( ‘http://test.trustvesta.com/investor-login’ );
exit;
}
}
BUT the results are that my WordPress login gets broken.
Do I need to tweak the arry on line 3??
thank you in advance
I am looking to auto redirect non logged in users on a specific page, not the whole site and bypass the default prompt “You need to login to view this content. Please Login. Not a Member? Join Us” and go straight to the login area.
Make sense??
Because you only want this to happen for a particular page; the best available option is to use Partial or Section Protection, to create 2 different views of the same page.
https://simple-membership-plugin.com/apply-partial-section-protection/