Archived : Techno Babble

This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums

You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}

« Control your children1.9beta skin changes »

Comments from registered members only

Posted on 26th Nov 2006 in : Hacks

This hack has now been replaced with a plugin

Backup any files that you play with first huh?

_feedback.php

Find this bit of code :-

Code:

// Comment form:
  if( $disp_comment_form && $Item->can_comment() )
  { // We want to display the comments form and the item can be commented on:

and replace it with this bit of code :-

Code:

if( is_logged_in() )
{
  $Item->comment_status = 'open';
}
else
{
  $Item->comment_status = 'closed';
  echo '<h4>Sorry, you need to be a registered member to leave a comment</h4>';
}
 
 
 
  // Comment form:
  if( $disp_comment_form && $Item->can_comment( NULL) )
  { // We want to display the comments form and the item can be commented on:
htsrv/comment_post.php

Find this bit of code :-

Code:

// Getting GET or POST parameters:
param( 'comment_post_ID', 'integer', true ); // required
 
$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID );
 
if( ! $commented_Item->can_comment( NULL ) )
{
  $Messages->add( T_('You cannot leave comments on this post!'), 'error' );
}

and replace it with this :-

Code:

// Getting GET or POST parameters:
param( 'comment_post_ID', 'integer', true ); // required
 
$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID );
 
if( is_logged_in() )
{
  $commented_Item->comment_status = 'open';
}
else
{
  $commented_Item->comment_status = 'closed';
}
 
if( ! $commented_Item->can_comment( NULL ) )
{
  $Messages->add( T_('Sorry, you need to be a registered member to leave a comment'), 'error' );
}
inc/model/items/_item.class.php (optional)

Find this line (approx 456 in 1.9beta and line 402 in 1.8.5 and probably somewhere in the 400's for other versions) and change the open to closed

Code:

if( $Request->param( 'post_comment_status', 'string', 'closed' ) !== NULL )

¥

2 comments

Comment by topanga on 26/11/06
Is this for 1.9 or 1.8.5 ?
Comment by ¥åßßå on 26/11/06
it should work in all 1.8 -> 1.9 versions

¥
Page archived : 11th Nov 2009
 

X