Category Archives:

Blogging

Links and Video of the Week (2011/7)

Akismet vs. Antispam Bee

How to fight off comment spammers? With a anti-spam plugin, of course. Akismet is quite popular (it’s included with WordPress, after all), but it’s got its drawbacks: It sends all data to its servers – after all, that’s how it works –, which may be a problem if you’re concerned about privacy; despite quite a goot job of detecting manual comment spam, it may cause false positives, i.e. good comments that falsely get treated as spam; newer versions fill(ed) the database with statistics even for deleted comments (latest version probably fixes this); and there are discussions about Akismet no longer being free (especially if you’re new and need an API key).

So I instead chose Antispam Bee now, which does its job very good without sending all data around, etc. (though it’s got options for IP filtering by country and more), and I’m quite satisfied with it, so it will stay.

I elaborated more on all this in the German version of this post (see link above the headline); major reason for writing an English version at all is one more thing about a plugin conflict that might be interesting to non-German-speakers:

Antispam Bee and Ajax Comment Preview

One of the Bee’s most important methods for combating spam bots is changing the name of the comment entry field – it’s no longer called comment but got a number added. (The ID is the same, so no change in accessing it with CSS.) However, this causes Ajax Comment Preview to malfunction – unless you change a bit in its JavaScript code. My solution may not be the most elegant – especially since it has to be adapted for each blog – but it works:

Replace in ajax-comment-preview.js in function send these three lines:

if ( !t.data.comment || t.oldData == $.param( t.data ) ) {
    return false; // Blank || Last AJAX request was the same, so bail on this one.
}

– they are at line 28 directly before the heavily-indented block that starts with jQuery.post – by these:

if (t.oldData == $.param( t.data )) { return false; } // Last AJAX request was the same, so bail on this one.
if (t.data['comment-12345']) t.data.comment = t.data['comment-12345']; //--ag for Antispam Bee
if ( !t.data.comment ) { return false; } // Blank

In this code, you must replace the highlighted number 12345 in both places with the number used on your blog – you find this by simply looking in the source code (or with FireBug or similar) of a page with a comment field, just search for a textarea with name="comment-, that should do it. (And if it won’t work right away, remember to explicitly reload the page in the browser so it loads the modified JavaScript file.)

Alright, any questions, suggestions, or opinions about my code or the plugins?