Page 1 of 1

Allow posting Comments only for level 2 or higher

PostPosted: June 30th, 2011, 7:50 am
by openmtbmap
The most work that I have with users is them asking questions via comments.

I'ld like to sell access to special pages/downloads on my site WITHOUT them being able to write comments. Is this doable?
(without writing a copy of all pages and securing them to S2 level - while disabling comments on all other pages).

Re: Allow posting Comments only for level 2 or higher

PostPosted: June 30th, 2011, 11:04 am
by BobTabor
Yes, I only allow comments to be views / posted by Level 4 subscribers. Everyone else will see a "marketing message" encouraging them to upgrade to Level 4 ... here's my page template that I modified from my selected theme (called page-right-sidebar.php):

Code: Select all
         <?php if (current_user_can("access_s2member_level4"))
         {  comments_template('', true); } else { ?>
         
         <hr />
         
         <div class='promsg'><h2>Lifetime 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 Lifetime now to enjoy interaction with fellow members.<br />
         <a href="http://mysite.com/membership_options_page">> Get Lifetime Membership</a></p></div>
         <?php } ?>   



Just for reference sake, here's the entire template so you can see where that fits in:

Code: Select all
<?php
/**
* Template name: Single page with right sidebar
*
*/

get_header(); ?>
   
   <div id="main_wrapper">
      <?php if($e404_options['breadcrumbs']) : ?><div id="breadcrumb"><?php e404_breadcrumbs(); ?></div><?php endif; ?>

      <div id="page-content" class="two_third">

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
      <?php if($e404_options['page_titles']) : ?><h2 class="fancy-header"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2><?php endif; ?>
         <div id="post-<?php the_ID(); ?>">
         <?php the_content(); ?>
            
         <?php if (current_user_can("access_s2member_level4"))
         {  comments_template('', true); } else { ?>
         
         <hr />
         
         <div class='promsg'><h2>Lifetime 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 Lifetime now to enjoy interaction with fellow members.<br />
         <a href="http://mysite.com/membership_options_page">> Get Lifetime Membership</a></p></div>
         <?php } ?>   
            
            
         </div>
<?php endwhile; ?>
         
         <?php get_template_part('navigation'); ?>

      </div>
      <div id="sidebar" class="one_third last">
         <?php get_sidebar('page'); ?>
      </div>
      <br class="clear" />
   </div>

<?php get_footer(); ?>


Hope that helps!

Re: Allow posting Comments only for level 2 or higher

PostPosted: June 30th, 2011, 5:50 pm
by openmtbmap
thanks for this. I'll try it out tomorrow. (Twould be awesome if it worked. Then I could have a cheaper offer for people to subscribe without support, and more expensive options with support).

That function should really be integrated into s2member!