Notifications
Clear all

Limited Support

Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed. We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.

 

Hide comments entirely except for a set of users in my membership site.

8 Posts
2 Users
0 Reactions
2,295 Views
(@drenglishadam)
New Member
Joined: 6 years ago
Posts: 4
Topic starter  

Hi, I'm using membermouse to have tiered content for users. I would like to use wpDiscuz only for VIP users. I can do this if I use shortcode on any page or php or JS to insert the plugin but I can't do it just by using the plugin itself. 

 

Is it possible to insert the comments specifically so certain users can't see it?


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6450
 

Hi @drenglishadam,

Thank you for your interest in wpDiscuz and for contacting us.

I'm really sorry, but wpDiscuz doesn't have such feature. 

If you're a developer you can do it using the following wpDiscuz shortcode:  

function my_wpdiscuz_shortcode() {
if (file_exists(ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php')) {
ob_start();
include_once ABSPATH . 'wp-content/plugins/wpdiscuz/templates/comment/comment-form.php';
return ob_get_clean();
}
}

add_shortcode('wpdiscuz_comments', 'my_wpdiscuz_shortcode');

   
ReplyQuote
(@drenglishadam)
New Member
Joined: 6 years ago
Posts: 4
Topic starter  

Thanks! so is it possible to install the plugin but disable it so it doesn't appear on every page and just use this code when appropriate?


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6450
 

Hi @drenglishadam,

Please let us know would you prefer to disable the whole commenting part for non-members or you'd like display comment WordPress commenting form for these members?  


   
ReplyQuote
(@drenglishadam)
New Member
Joined: 6 years ago
Posts: 4
Topic starter  

I prefer to disable the whole commenting part for non members


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6450
 

@drenglishadam,

You should use some additional code for this purpose. Something like the following one I'm providing below: 

$user = wp_get_current_user();
if ( in_array( 'subscriber', (array) $user->roles ) ) {
comments_template();
}

In this example, the comment section is disabled for the subscriber user role. 


   
ReplyQuote
(@drenglishadam)
New Member
Joined: 6 years ago
Posts: 4
Topic starter  

Thank you so much! 

 

Just to confirm, this extra code enables or disabled it for subscribers?


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6450
 

@drenglishadam,

The code I've provided is disabled the commenting for subscribers. 


   
ReplyQuote
Share:
Scroll to top