Only shows content wrapped in shortcode if a member is logged in. Can be set to display alternate content if not logged in.
[memb_is_logged_in] Shown to users who are logged in. [else_memb_is_logged_in] Shown to users who are not logged in [/memb_is_logged_in]
This shortcode is used to restrict access of content to users who are logged in, while excluding those who are not. It can be used as a standalone shortcode, such as:
[memb_is_logged_in] This is shown to logged in users only [/memb_is_logged_in]
The image below shows what those who are logged in will see:
The image below is what those who are logged out will see:
One use of this code, is in conjunction with [memb_loginform] and [logout_link], the login form being shown to users who are not logged in, and the logout link being available to those who are logged in.
[memb_is_logged_in] [memb_logout_link] [else_memb_is_logged_in] [memb_loginform] [/memb_is_logged_in]
The below image shows the login form:
The image below shows the logout link
If you’d like to take it a step further, you can add a [memb_lost_password] tag, in with the already existing code.
[memb_is_logged_in] [memb_logout_link] [else_memb_is_logged_in] [memb_loginform] [memb_lost_password] [/memb_is_logged_in]
However, that can be rather crowded. A less bulky way to do this would be to make a “Forgot Password” page, and simply have the [memb_lost_password] code on it.
[memb_is_logged_in] [memb_logout_link] [else_memb_is_logged_in] [memb_loginform] <a href=”YOUR FORGOT PASSWORD PAGE”>Forgot your password?</a> [/memb_is_logged_in]
For a more advanced application of [memb_is_logged_in], you can nest them within each other.
[memb_is_logged_in] [memb_is_logged_in1] [else_memb_is_logged_in1] [/memb_is_logged_in1] [/memb_is_logged_in]
1. [memb_loginform] – A simple two field login form. Requests Email and Password.
2. [memb_logout_link] – Displays a link that logs a user out.
3. [memb_lost_password] – Displays an email field and sends a user their password.