With the 4.0.3 release we made several improvements that enhance Textpattern’s ability to keep your site free of ‘spammy’ comments. The most notable addition in that respect was an API for writing anti-spam plugins.

The anti-spam plugin API is easy to use and allows for a nice integration into the existing comment-system. Plugins can mark the comments in a variety of ways, they can easily add form-elements to the comment-form, they can force reloads of the comments including feedback to the users (an arbritrary number of times), and finally when comments are made visible or invisible (i.e. spam or moderation queue), Textpattern will automatically give adequate feedback to the user who submitted the comment.

(Currently) available anti-spam plugins

  • asy_captcha.txt – image verification for comments
  • mrw_spamkeywords_urlcount – acts on number of links in comment field, and certain, definable keywords
  • asy_stopdude – totally transparent to users, specifically targetted against the current spam-bots/tools

Writing an anti-spam plugin

Now writing such plugins is fairly straight forward task. A few days ago Brian was asking about a kind of plugin that would moderate comments which contained a number of links. I invited him to the txp plugins developer mailing list and the next day he had written and distributed his own plugin and wrote, I quote, “Thanks for the help! This was kinda fun!”.

You can find Brian’s plugin ‘mrw_spamkeywords_urlcount’ in the forum.