[wp-hackers] Will this generate bug?

Alan J Castonguay alan at verselogic.net
Tue Oct 31 03:47:58 GMT 2006


louie alfred gomez wrote:
> (I added these lines: if ($comment_post_ID == '32' or $comment_post_ID ==
> '84')
> $comment_approved = 0;)
> 
> Now, I just want to ask if this will generate bugs. You see, I want all
> comments that would be posted with the post number 32 or 84 undergo comment
> moderation. Thanks!

Better to use a plugin than to modify core. Maybe the pre_comment_approved filter, here's an 
(untested) suggestion.

function always_moderate_comments( $approved ) {
   global $commentdata;
   $forposts = array( 32, 84 );
   if( in_array( $commentdata['comment_post_ID'], $forposts ) ) return 0;
   return $approved;
}
add_filter( 'pre_comment_approved', 'always_moderate_comments' );

-- 
Alan J Castonguay
519-567-2633


More information about the wp-hackers mailing list