Page 1 of 1

Hiding Comments

PostPosted: April 28th, 2011, 4:34 pm
by BobTabor
Hi, is there a way (using s2Member Pro) to hide comments in a WordPress Post or Page based on their membership level? Ex. only paying "Platinum" members can view / create comments?

Re: Hiding Comments

PostPosted: April 28th, 2011, 5:11 pm
by Cristián Lávaque
Hi Bob. :)

This is not something s2Member controls by default, but you could customize it using s2Member's advanced conditionals in the theme files. WP Admin -> s2Member -> API / Scripting -> Advanced Conditionals and Advanced Query Conditionals

Let me know if that helps.

Re: Hiding Comments

PostPosted: April 28th, 2011, 9:57 pm
by artEV
Yep, I incorporated this too.
Depending on your theme, upgrade message and membership options page link, code could look something like this on the single.php and page.php theme files:

Code: Select all
<?php if (current_user_can("access_s2member_level1"))
{  comments_template('', true); } else { ?>
<div class='promsg'><h2>Pro members get to participate in post discussions!</h2><br />
<p><b>This post currently has <?php comments_number('no responses','one response','% responses'); ?>.</b><br />Upgrade to Pro now to enjoy interaction with fellow members.<br />
<a href="http://mysite.com/membership_options_page">> Get Pro Membership</a></p></div>
<?php } ?>

Re: Hiding Comments

PostPosted: April 28th, 2011, 10:07 pm
by BobTabor
Outstanding! Thank you, both.