Add Login/Logout Link in Menu
If you're looking to have a simple login/logout link in your WordPress Menu, then there is an easy solution! We at MemberPress recommend that you use the BAW Login/Logout plugin because it is easy to use and it is reliable.
Check out this short video to learn how to implement this:
Or follow these simple steps to implement it:
- Follow the link here to download the BAW Login/Logout plugin.
- Save the .zip file to your desktop or other file location.
- In your WordPress admin go to Plugins > Add New.
- Click on the Upload Plugin button at the top of the page > find the file you saved and upload and activate the plugin.
- In your WordPress Admin go to Appearance > Menus and you'll see the new menu option that says Login/Logout links
- Clicking on that will reveal a drop down menu where you can select to have the link be Login, Logout, Login|Logout (this one will toggle between login and logout based on the login status of the user), or register (this is so new users can register on your site, but don't use this option with MemberPress).
- We recommend that you use the Login|Logout option so that it will show as login or logout based on the login status of your users.
- IMPORTANT NOTE: because the BAW Login/Logout menu plugin uses WordPress' /wp-login.php url by default, you will need to enable the Force WordPress to use the MemberPress login page found in the Options > Account Tab.
Here is what it will look like
Controlling What Menu Items Your Users See
If you want to customize the way that your menu interacts with your users, based on if they are logged in or not, or if they are actively subscribed to one of your memberships or not, then look no further than the Menu Item Visibility Control plugin.
Here's a quick video on how you can get it working on your site:
And here are some of those conditional php statements that you can use as explained in the video:
- is_user_logged_in() - hides the menu item from logged out users
- ! is_user_logged_in() - hides the menu item from logged in users
- current_user_can('mepr-active','membership: 123') - hides the menu item from all logged in users except those with active memberships to the membership with the ID "123". Where to find my Membership's ID?
- current_user_can('mepr-active','memberships: 123, 124') - hides the menu item from all logged in users except those with active memberships to the memberships with the ID "123" or "124".
NOTE: You can add an "!" (exclamation point) to beginning of the statement to make it work in the opposite way as explained above. So if you added an exclamation point to the beginning of our third example above, instead of allowing those members to see the menu item when logged in, it will hide that menu item from those logged in users. If you do this, be sure to format it like this: ! current_user_can('mepr-active','membership: 123') or this for multiple memberships at a time: ! current_user_can('mepr-active','memberships: 123, 124').