Simple Membership Plugin › Forums › Simple Membership Plugin › Redirect not logged in users to login page with both the login and registration
Tagged: redirect
- This topic has 16 replies, 2 voices, and was last updated 9 years, 10 months ago by
Stefan.
-
AuthorPosts
-
January 26, 2017 at 9:37 pm #9873
Stefan
ParticipantI want to redirect all users before the login to a page with both the login and registration forms side-by-side. I don’t want them to go to the page that says “You need to login to view this content. Please Login. Not a Member? Join Us.” I want them to automatically go to a page that has the 2 forms side-by-side. How do I do the auto redirect? I found code on this page, but it crashed the website. https://simple-membership-plugin.com/auto-redirect-non-logged-in-users-protect-whole-site/
January 26, 2017 at 9:44 pm #9875mbrsolution
ModeratorHi, are you wanting to protect the whole site? The link you shared above is meant for a site that is totally protected.
January 26, 2017 at 11:12 pm #9878Stefan
ParticipantYes. I want to protect the whole site. I want the page to look like this when someone tries to get to any page when they’re NOT logged in. https://printing4liberty.com/customer/account/login/ Once they’re logged in, I want them to be able to go to any page.
Thanks
January 26, 2017 at 11:18 pm #9880mbrsolution
ModeratorOkay, no problem. When you say it crashed your whole site, did you see any error messages? Can you carry out the following troubleshooting steps.
Thank you
January 26, 2017 at 11:23 pm #9882Stefan
ParticipantThe membership plugin is working. It only crashed when I put in the PHP code I found on https://simple-membership-plugin.com/auto-redirect-non-logged-in-users-protect-whole-site/. Now, I just need to know how to redirect all users, BEFORE they login, to a page that has both the login and registration forms side-by-side. I want to skip the page with the notice, “You need to login to view this content. Please Login. Not a Member? Join Us.” I want it to automatically go to the page with the side-by-side registration and login.
Thanks
January 26, 2017 at 11:34 pm #9883mbrsolution
ModeratorOkay no problem. I think the following documentation should do the trick.
Regards
January 26, 2017 at 11:39 pm #9884Stefan
ParticipantThis link is about adding members manually. That’s not what I need. For a non-logged in person, I want the page to look like this. https://printing4liberty.com/customer/account/login/
Thanks
January 26, 2017 at 11:48 pm #9885mbrsolution
ModeratorThe link I shared above is for adding a member manually but it also shares information about hiding or removing all links and URLs from your site, which is what you are also trying to achieve. In regards to pointing a non member to a specific page did you change the URL in the code above?
January 26, 2017 at 11:50 pm #9886Stefan
ParticipantWhich code above?
January 26, 2017 at 11:54 pm #9887mbrsolution
ModeratorYou need to change the URL in the following code https://simple-membership-plugin.com/auto-redirect-non-logged-in-users-protect-whole-site/.
wp_redirect( ‘http://www.your-domain.com/membership-login’ ); <== this URL needs to point to the page or post you want to redirect the non members too.
January 27, 2017 at 12:06 am #9893Stefan
ParticipantI did that, and that’s when I got the error. I added it to the bottom of the function.php. I had to restore using my backup. Where in the plugin does it direct non-logged in users to the page showing the message “You need to login to view this content. Please Login. Not a Member? Join Us.”?
Thanks
January 27, 2017 at 12:21 am #9895mbrsolution
ModeratorThat is the page you need to change using the instructions I provide above in the documentation. That is why I shared that link. It helps you to change, hide and remove links. Especially the following.
“You need to login to view this content. Please Login. Not a Member? Join Us.”?
Did you read the last part of the redirect code. This is what it says.
You will need to change the redirection URL to the actual login page URL of your site.
The non logged-in users are only allowed to access the membership login and join us pages in the above example.
January 27, 2017 at 12:40 am #9898Stefan
ParticipantYou are referring to the actual WordPress url login for my site?
January 27, 2017 at 12:43 am #9900mbrsolution
ModeratorYes that is correct.
January 27, 2017 at 12:51 am #9901Stefan
ParticipantNever done that. The link gives me all the instructions?
-
AuthorPosts
- You must be logged in to reply to this topic.