Require membership to post comments
From b2evolution manual
This refers to b2evolution versions 0.9.x
The default configuration for b2evolution is to allow comments on posts, and to allow anyone to make a comment. When you make a post you have the option to either close or disable comments, but there is no option to say "only registered members can post a comment... unless you don't mind hacking a file ;)
NOTE: Hacks are not supported parts of b2evolution and may not work when you upgrade to newer versions. ALWAYS backup your files before you hack!
Each skin has a skinname, and each skins/skinname/ folder has a file called _feedback.php. If your skins/skinname/_feedback.php has this at the end of the file:
/** * We now call the default feedback handler... * However you can replace this file with the full handler (in /blogs) and customize it! */ require get_path('skins').'/_feedback.php'; ?>
then you will need to edit skins/_feedback.php instead.
Open the appropriate _feedback.php file and look for this section:
if( $disp_comment_form ) { // We want to display the comments form: if( $Item->can_comment() ) { // User can leave a comment ?> <h4><?php echo T_('Leave a comment') ?>:</h4>
Now change it to this:
if( $disp_comment_form && is_logged_in() ) { // We want to display the comments form to a registered member: if( $Item->can_comment() ) { // User can leave a comment ?> <h4><?php echo T_('Leave a comment') ?>:</h4>
1. In skins/skinname/_feedback.php and/or skins/_feedback.php mentioned above:
/* Original code: } ?> <?php } // if you delete this the sky will fall on your head ?> */ // Begin Fix } else { ?> <p><b>You are not authorized to make a comment.</b></p> <?php } ?> <?php } // if you delete this the sky will fall on your head ?> // End Fix
2. In htsrv/comment_post.php:
/* Original Code: if( ! $commented_Item->can_comment( '', '', '', '' ) ) { errors_add( T_('You cannot leave comments on this post!') ); } */ // Begin Fix if( ! $commented_Item->can_comment( '', '', '', '' ) ) { errors_add( T_('You cannot leave comments on this post!') ); } if( ! is_logged_in() ) { errors_add( T_('You are not authorized to leave comments on this post!') ); } // End Fix

