Beating Comment Spammers
I may have found the secret to beating comment spammers in WordPress. The main problem with WordPress comments is that even if a comment is triggered as spam and placed in moderation, it's still a pain to go through and delete them all, even in "mass moderate" mode. When I got 30 spams in one night, I knew I had to do something.
In wp-comments-post.php, I added a couple of if statements at the top, under the ifs that look at whether the comment was filled in properly. Under those, I added:
if (ereg("^[0-9]+", $comment))
die(__("Having digits at the beginning of the post is a sign of spamming. Please don't do it."));
if(ereg("gambl", $author))
die(__("Having 'gambl' in your name is a sign of spamming. Please don't do it."));
if(ereg("debt", $author))
die(__("Having 'debt' in your name is a sign of spamming. Please don't do it."));
if(ereg("poker", $author))
die(__("Having 'poker' in your name is a sign of spamming. Please don't do it."));
After adding this, I have gotten ZERO comment spams. If someone does post with one of these problems, the dies comment will alert them to slightly rephrase their comment and then everything will be solved. It keeps the filter targeted, so if someone posts about their debt, it won't throw it out unless their name has something to do with debt, and who does that. It ends up being a nice way to keep out the unwanted riff-raff and I can always add to it later. Now why isn't this programmed in? If I spend the time to implement this properly with an admin section and all, I'll release it. But I've been working with some WordPress internals lately and I'm starting to have nightmares. WordPress's code is really bad.