PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Restrict lower level shortcodes

s2Member Plugin. A Membership plugin for WordPress®.

Restrict lower level shortcodes

Postby moymoy_101890 » January 31st, 2012, 4:32 pm

I would like to seek help. I am a beginner here in the s2member plugin. I dont know if this is possible but i would like to know if i can set a page that can be seen by public and cant be seen by members of any level. your help would be really appreciated.
User avatar
moymoy_101890
Registered User
Registered User
 
Posts: 3
Joined: January 31, 2012

Re: Restrict lower level shortcodes

Postby Raam Dev » January 31st, 2012, 6:43 pm

You could do this by inserting some PHP code into the page to check if the user is logged in (see WP Admin -> s2Member -> API/Scripting -> Advanced/PHP Conditionals for more info).

If they are logged in, don't show the content. If they are not logged in, show the content. You will need to install and activate the Exec-PHP Plugin before you can use this code on a post/page:

Code: Select all
<?php if(is_user_logged_in()){ ?>
    Content for anyone that is logged in, regardless of their Membership Level.
<?php } else { ?>
    Some public content.
<?php } ?>
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: Restrict lower level shortcodes

Postby moymoy_101890 » February 1st, 2012, 6:42 am

can this actually hide the the page? coz i use the login page for public use only so i need to hide it when im logged in. thanks for the tip sir.
User avatar
moymoy_101890
Registered User
Registered User
 
Posts: 3
Joined: January 31, 2012

Re: Restrict lower level shortcodes

Postby moymoy_101890 » February 1st, 2012, 2:25 pm

and by the way the login page is located in the nav bar.
User avatar
moymoy_101890
Registered User
Registered User
 
Posts: 3
Joined: January 31, 2012

Re: Restrict lower level shortcodes

Postby Raam Dev » February 2nd, 2012, 2:05 pm

In that case you can edit your theme template where the nav menu is generated (probably in header.php) and do something like this:

Code: Select all
<?php if(is_user_logged_in()) { ?>
Welcome!
<?php } else { ?>
<a href="/login/">Login</a>
<?php } ?>
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests