[wp-hackers] Re: [spam-stopper] New plugin version

Sebastian Herp newsletter at scytheman.net
Tue Oct 17 18:15:58 GMT 2006


Good idea ... I think it could be handled only by plugins, too ...

Anti-spam plugins would hook into preprocess_comment and do whatever 
check they do (against Akismet, a RBL, etc). They would have to save 
their result into some global array (the same one for all plugins 
dealing with spam). Then, in the pre_comment_approved hook the 
uber-anti-spam-plugin collects the values in this global array and 
decides whether it's spam or ham.

Needs no modification of the core ... or am I wrong?

Roland Haeder wrote:
> On Tuesday, 17. October 2006 17:55, Computer Guru wrote:
>   
>> Ah... 'k.. get you know.
>>
>> I agree.. the whole thing is littered with hooks, so why not Akismet as
>> well
>>
>> :)
>>
>> What's the DL URI for your plugin?
>>
>>     
> My idea is to create another "hook" where all spam-plugins shall return their 
> weight value into it:
>
> - Zero: No comments / cannot complain about it / plugin doesn't know how to 
> deal with it
> - minus values: more spam than ham
> - plus values: more ham than spam :-)
>
> An example:
>
> plugin-one.php
> <?php
> function plugin_add_rating ($currRating) {
> 	$myRating = 0;
> 	// Some analysis bla bla
> 	return $currRating + $myRating;
> }
>
> add_filter('comment_spam_rating', 'plugin_add_rating');
>
> ?>
>
> Now somewhere in WP's core we need a "handler" to decide if spam/ham or 
> moderate:
>
> function wp_spam_rater ($comment_ID) {
> 	$totalSpamRating = apply_filter('comment_spam_rating', $comment_ID);
> 	if ($totalSpamRating == 0) {
> 		// Send it to the admin as "moderated"
> 		do_action('comment_rating_moderation', $comment_ID);
> 		return '0';
> 	} elseif ($totalSpamRating < 0) {
> 		// Send it to the admin as "spam"
> 		do_action('comment_rating_spam', $comment_ID);
> 		return 'spam';
> 	} elseif ($totalSpamRating > 0) {
> 		// Send it to the admin as "approved"
> 		do_action('comment_rating_approve', $comment_ID);
> 		return '1';
> 	}
>
> }
>
> Got it? :-)
>
> Roland
>
>   



More information about the wp-hackers mailing list