Wednesday 11 January 2006 by
Last December showed a number of reports from different users that some spam-bots and/or (so-called) “SEO-Tools” had been adapted for Textpattern and some users were receiving automated spam to their sites.
With the 4.0.3 release we made several improvements that enhances 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. We’ve also started writing a page on the Textbook Manual that deals with the topic of combatting comment spam.
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.
(the Textbook article contains a list that will be updated as we go along)
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 and on his site.
If you are interested in writing new plugins or porting over plugins from other systems, here’s a couple places to start:
- Join the txp-plugins developer mailing-list (and skim the archives for December and January).
- Read Brians and my exchange on the mailing-list archive
- Read the following articles on the Textbook wiki: writing an anti-spam plugin and Plugin Development Topics
- Look at the source of Brians Plugin (above) or the example plugin I posted to the developer list