Notifications
Clear all

Can we password protect comments?

9 Posts
2 Users
1 Likes
2,242 Views
(@igkteam)
Member Customer
Joined: 5 years ago
Posts: 5
Topic starter  

I am using wp emember for my membership site and want to use this plugin and its addons for that and other member sites.

Unfortunately the comments arent hidden - this plugin ignores emember code that hides the native WP comment forms. I'm sure someone has asked about membership sites before. Any ideas?


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5912
 

Hi @igkteam,

Could you please navigate to Dashboard > Comments > Forums admin page, make sure you've disabled commenting for all other roles. More info here:

https://wpdiscuz.com/docs/wpdiscuz-documentation/getting-started/custom-comment-form/comment-form-settings/#disable_commenting_for_roles


   
ReplyQuote
(@igkteam)
Member Customer
Joined: 5 years ago
Posts: 5
Topic starter  

Thanks @astghik, the comment form is publicly visible on a protected page. Take a look at my screenshot and settings.

Screen Shot 2019 03 22 at 11.40.54 PM
Screen Shot 2019 03 22 at 11.37.57 PM

   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5912
 

ok @igkteam,

I'm sorry, but we don't familiar with this plugin. This depends on how the plugin disabled the comments.

We can debug and try to find some solution for you if you install and activate the Duplicator — WordPress Migration Plugin, backup your WordPress site and send it to info[at]gvectors.com email address to allow us to check it. 


   
ReplyQuote
(@igkteam)
Member Customer
Joined: 5 years ago
Posts: 5
Topic starter  

Thank you @Astghik. What membership plugins does this system work with well?

I'm sorry, I can't send you a copy of my site, but is there a place you can direct me in the plugin code to make those edits myself?


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5912
 

no problem @igkteam,

just make sure the function that shows/hides the comments use the comments_template() function. I mean that the manipulations should be done with this function. 

I've found some articles that should be helpful for you, please check them out: 

https://barn2.co.uk/password-protect-wordpress-plugins/
https://wordpress.org/support/article/using-password-protection/
https://themeisle.com/blog/password-protect-wordpress/


   
ReplyQuote
(@igkteam)
Member Customer
Joined: 5 years ago
Posts: 5
Topic starter  

@Astghik Thank you. I'll take a look.


   
ReplyQuote
(@igkteam)
Member Customer
Joined: 5 years ago
Posts: 5
Topic starter  

Hi @Astghik,

Just wanted to loop back with a solution on this in case someone else has a similar issue. (The links you provided weren't helpful. They were not about protecting content using membership sites.)

The way to solve this is to create unique loops for all the pages (single.php and archive.php) and to hide the comment form behind the code that checks if user is logged in.

In my case, I use Genesis, and this is the code for the single-mycustomposttype.php page (replace mycustomposttype with whatever CPT you've created):

remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_do_custom_loop' );

function child_do_custom_loop() { 
 if(wp_emember_is_member_logged_in()){ 	
if (have_posts()) : while (have_posts()) : the_post(); >> output title and content (the html tags here mess with my code, so i'm just posting pseudo code for this bit << comments_template(); //make sure you call it inside the loop, and inside the "if you're logged in" check. endwhile; endif; }else{ header("Location: /"); // I kick people to the login page if they aren't logged in, so there's no partial page view at all. exit();
}
}
genesis();

   
Astghik reacted
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5912
 

Thank you @igkteam for sharing the code. 

 I really appreciate you taking a time and share this information. 


   
ReplyQuote
Share:
Scroll to top