Trackback Spam
Thursday, 3 February 2005
It seems the spammers noticed I have enabled trackbacks on this weblog. As of last evening some spammer started advertising for some personal injury lawyers. If there is one thing I hate more than spam, it’s personal injury lawyers. The solution: a spam filter for trackbacks.
I already started using Pivot-Blacklist for Nucleus a while ago. So, instead of creating a whole new spam filter I modified both the Trackback plugin and the Blacklist plugin in such a way that they will work together.
The existing blacklist works based on notifications. Basically, each plugin can subscribe to many different notifications, but in this case one of them in particular: PreAddComment
. Every time a new comment is submitted by a user, the PreAddComment
notification is send out to the Blacklist plugin. The plugin takes the notification and checks the data submitted by the user for spam.
Notifications are not limited to Nucleus itself though. Other plugins can also issue notifications. And that is what I decided to do. The modified Trackback plugin now sends out an new notification called PreAddTrackback
.
The Blacklist plugin was modified to look not only for the original PreAddComment
notification, but also for the PreAddTrackback
.
In total, maybe 15 lines of code and all my trackback spam is gone. I hope to have some time later today to publicly release the code, so other can benefit. I am going to include my modifications in the next release of the Trackback plugin for sure. Ideally the Xiffy would also include support for the PreAddTrackback
notification in the next release of his Blacklist plugin.
Update: Apparently Xiffy already started working on providing blacklist checking for other plugins.
I must admit, your solution is cleaner
But this would mean that every plugin that starts inventing it’s own methods needs to be added to the blacklist ‘events’ as well. That means that every plugin that wishes to incorporate blacklist will should be added by me to the evenlist of blacklist.
That will be a nightmare for me.
With my implementation, I never have to listen to no more events then the ones currently supported. And still all plugins can make calls to the blacklist ….
btw, next release will listen to preAddTrackback …
How about creating a single notification called ‘checkForSpam’, which contains an array of fields which can be used to check for spam…
Then every spam filter can subscribe to that event. All it has to do is implode the array and do whatever it does.
Plugins then can simply create an array with fields to check and raise the checkForSpam notification.
A bit of a combination of both.
Good job! I’m all for wiping spam off the face of the Earth, and this is a good thing to do. Hopefully, I’ll have enough time to code something similar into the next version of my blog software (http://drbob.tomjepp.co.uk/).
- Does not have any hard-coded language (users should be able to translate from within the admin area)
- Provides sufficient information of its use, how to install, incorporate and alter its options (documentation)
- Does not have any hard-coded layout (once again, it should be possible to alter from within the admin area)
- Is tested…