Update: I just got my first “Hey, Akismet blocked SPAM” email message, and it appears there’s a bug — it didn’t contain any actual data. I’ll check into it tomorrow when I get a chance. In the meantime, please let me know if you’ve experienced any similar behavior.
Ho ho ho!
It’s about time I got in the Christmas spirit, and in order to help spread a little more holiday cheer (especially now that Wordpress 2.0 has been delayed), I thought I’d release a special holiday cheer version of my enhanced Akismet plugin!
Ok, so it really doesn’t have anything holiday-cheery in it, but you’ll be able to enjoy some spiced up eggnog to help get you through those Christmas-day family gatherings and only have to worry about driving home, since SPAM is taken care of!
Changes
This plugin features a completely re-written codebase. Sure it’s not all that different from the last version, but I’ve cleaned up a bunch of stuff, renamed some functions and variables to make more sense, and in general just done a lot of house cleaning that won’t make a damn bit of difference to anyone out there except me. Still, that’s how I’ve spent the majority of my time working towards this release. In the end, I think it’s worth the wait, simply because I now know what the hell I’m doing and can more easily make future changes.
The other most noteworthy change in this version is the email notification feature. Since this has been a big pain in the ass for a lot of people (including me, since I use it), I’m almost embarassed to tell you all what the problem was, but I will…
<nerd_speak>
You see, when a message is detected to be spam by any part of the akismet_check_spam function, it simply triggers the akismet_notify_moderator function. Now, when I originally wrote the akismet_notify_moderator function, it was simplest to just accept the comment’s ID# and re-retrieve all the data we needed to send the email. Sure it’s not the most database-friendly method, but it sure makes everything a lot easier on my end, particularly since I wasn’t terribly familiar with the rest of the plugin at that time, and didn’t really know exactly what data I had available to me already.
So this function worked beautifully… except that it was sending out emails for old comments. I’d get an email with a comment from back in July marked as quarantined by Akismet, then login to the management panel and see the new *real* comment that had been quarantined. It was annoying, but it still served its purpose by alerting me to a new comment that I needed to check out, so I let it go.
When I sat down to track down this bug, I wasn’t terribly enthusiastic. I expected it to take me hours of work re-coding the entire plugin to get around some minute problem I never considered would have cropped up.
In reality, it took me all of 45 seconds or so. Since the notification plugin was obviously working just fine, there had to be a problem with what I was passing it as the comment ID#. A quick glance at the function call pretty much summed it up:
akismet_notify_moderator($comment["comment_post_ID"], 'akismet');
Meh… For some reason I’d gotten distracted and passed the comment’s POST ID#, not the actual ID# of the comment itself. D’oh!
</nerd_speak>
Aside from that, there’s just a few minor things.
I added some additional information to the Akismet Configuration panel, which will prove useful in the future when you’re trying to figure out what version of stuff you’re running.
A debug feature was also added, mainly just so I could more easily test stuff without using nasty fixed-width error printouts in the actual page. It’ll also be helpful to debug problems with live sites and those problems involving the actual comment-submission process. You can switch on debugging in the Akismet Configuration panel, right along side all the other features. Be warned! There is a lot of debugging data. If you leave this on too long, you could drag your database to a crawl, since a lot of Akismet triggers on various seemingly unrelated events (such as API key validation on every admin page load). When switched on, debug data will be displayed at the very bottom of the Akismet Configuration panel, for easy viewing. See the FAQ entry related to debug data before enabling it.
Also added is the ability to change the purge timing for old SPAM. Just substitute your desired value in the “Purge Time” field of the Akismet Configuration panel, and the plugin will keep your SPAM around for that period of time. I plan to add some new features to auto-purge or never-purge in the future. For now, this date range should be able to accomodate just about any length of time you desire.
Bugs / Problems / Comments
As always, I’ve done preliminary testing, but this in no way guarantees that the Akismet plugin won’t eat your dog if it feels so inclined. In fact, with all the code rewrites I’ve done for this version, it’s very likely I’ve made a typo or 12 somewhere, which will no doubt cause problems.
If you run into a problem, just deactivate the plugin and revert to an older version. Then let me know either in an email, or in the comments and I’ll do the best I can to help you out.
Merry Christmas
I hope everyone has a very merry Christmas, and enjoys the time spent with their family. We’ve already done all our family gatherings for the season, so I’m left to open presents! :)
Download and Install
The plugin should be attached to this post. Snag it here, or jump over to the Akismet+ Plugin page, where you’ll always be able to find the latest version!
To install, just extract and upload akismet-plus.php to your wp-content/plugins/ directory. Deactivate any old versions and activate the new one. Once you add your API key to the Akismet Configuration panel, you’re ready to go!
Hey Chris - is your RSS feed buggered?
Oh yes - hope you had a fun Christmas! :)
Howdy! Yes, I did have a good Christmas, you?
And yes, it appears that it is buggered. Odd… that has to be related to the WP 2.0 upgrade, but I don’t have a clue why that’d have broken anything.
Great, and I thought I was going to get some sleep tonight……
[…] Thanks a lot to Cal for letting me know! error, rss, upgrade, wordpress, wordpress 2.0 […]