Only fill this in if you're a spammer huh? Your name :
Your email :
Your message :
Nov
26th
2006

Comments from registered members only

Posted 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 )

¥

Trackback URL (right click and copy shortcut/link location)

Trackback url for this post
Note : This trackback url is time limited so use it within 30 minutes or the SpamHound will snarl at you.

http://waffleson.co.uk/z/?k=31722602633103238c2f04e57ab22033560efe23ca731e4be

topanga

Posts : 2

Joined : 11/26/06

Replied on : 11/26/06 @ 11:22 am #1

Is this for 1.9 or 1.8.5 ?
 
 
¥åßßå users avatar

Posts : 845

Joined : 10/05/05

Location : 127.0.0.1

Replied on : 11/26/06 @ 11:29 am #2

it should work in all 1.8 -> 1.9 versions

¥

I may have opened the door, but you entered of your own free will

 
 

Comments are closed for this post.