latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Post/ page conditionals

Home Forums Community Forum Post/ page conditionals

This topic contains 2 replies, has 3 voices. Last updated by  Bruce 3 years, 7 months ago.

Topic Author Topic
Posted: Wednesday May 29th, 2013 at 11:08 am #50840
Doug Wilds
Username: dougwilds

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Wednesday May 29th, 2013 at 4:16 pm #50870
Skip Shean
Username: skipshean

Doug,

I’m just another user, not support staff. But if you look under API / Scripting in your wordpress admin under S2Member, there’s a bunch of PHP code examples in there for restricting pieces directly.

You could use these in templates in your theme. Presuming you want to do that in your news articles, you probably want to do it in single.php if your theme is structured normally.

for example, something like:

<?php if(is_user_logged_in()){ ?>
	<?php the_content(); ?>
<?php } else { ?>
	<?php the_content('Log in to read more...'); ?>
<?php } ?>

See this for more:

http://codex.wordpress.org/Function_Reference/the_content

Posted: Thursday May 30th, 2013 at 6:28 am #50928
Bruce
Username: Bruce
Staff Member

Thank you for your inquiry.

The first thing you’re going to want to do is make sure you’ve got Alternative View Protection OFF here:

Dashboard -› s2Member® -› Restriction Options -› Alternative View Protection

When you do this you’ll be relying on your theme to only show content above the MORE tags. After this is done, s2Member’s core functionality should be all you need to protect access to the Post, and tell a User to log in if they attempt to access the Post/Page without necessary access. If you want to get really fancy and give the User information about the specific needs for a particular Post/Page when they are redirected, you can make use of s2Member’s Membership Options Variables.

See: Dashboard -› s2Member® -› API / Scripting -› Membership Options Page Variables (MOP Vars)

Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.