Otto has an even better suggestion: use is_user_logged_in(). I have updated the recommended fix accordingly. Thanks, Otto!
As many people have noticed, the Math Comment Spam Protection plugin no longer works in WordPress 3.0. Unfortunately, the plugin appears to be no longer supported by its author, so some people are searching for an alternative plugin.
However, I have some good news: after a bit of trial-and-error, I found the problem with Math Comment Spam Protection. Even better news: the fix is incredibly simple.
Find Line 211 of math-comment-spam-protection.php:
if ( ( !isset($user_ID) ) && ( $comment_data['comment_type'] == '' ) ) { // Do not check if the user is registered & do not check trackbacks/pingbacks
The offending code is this:
( !isset($user_ID ))
Simply change the above to this (note: see update, above):
( ! $user_ID )
( ! is_user_logged_in() )
So that Line 211 looks like the following:
if ( ( ! $user_ID ) && ( $comment_data['comment_type'] == '' ) ) { // Do not check if the user is registered & do not check trackbacks/pingbacks
Voila! The Math Comment Spam Protection plugin will now work again!
This fix is so simple, I don't see any need to fork the code. I'll try to contact the developer, and see if he will patch the original.
Fixing Math Comment Spam Protection Plugin in WordPress 3.0 – http://www.chipbennett.net/2010/06/fixin… #wordpress
thx for ur share 🙂
Thank you — very helpful!
Hi together,
thank you very much for the $user_ID fix. I found another issue for fresh wp3.0 installs and have a fix for it to share.
The new version doesn’t use Kubrick as standard template anymore, the new one is TwentyTen. And there is a new function comment_form() that renders the comment form, found in ~/wp-includes/comment-template.php – line 1484.
Search for the end of the $fields array definition and add the following lines, which formerly were added to the theme’s file comment.php.
/**
* uwalter: v3.0 fix for the Math Comment Spam Protection plugin.
*/
if (function_exists('math_comment_spam_protection'))
{
$mcsp_info = math_comment_spam_protection();
$fields['mcspvalue'] =
'Spam Schutz: Berechne die Summe aus '.$mcsp_info['operand1'].' + '.$mcsp_info['operand2'].'.'.
''.
'';
} # END v3.0 fix
Have a Lot of Fun
Best Regards
Uwe Walter
@uwalter:
I recommend strongly against modifying core files. Instead, hook in the Math Comment Spam Protection content. I recommend using the
comment_form_after_fields
filter. Something like this:Hi Chip,
I am no friend of modifying core files too. Thank you very much for the new tip! Will directly check that.
My first wordpress blog btw. 🙂
Best Regards
Uwe Walter
Thanks for that, I was confused by the sudden flood of spam!
Thanks for that, saved me from a flood of spam!