Block anonymous comment spam by restricting link tags
Posted by eli on September 10, 2007 at 9:54pm
I came up with a simple snippet to block a huge amount of anonymous comment spam that I'd like to share. I made a rule that anonymous users cannot include links in their comments. I don't believe that this is much of an inconvenience to legitimate visitors. They can still paste a URL into their comment, it just won't be hyperlinked.
Here's the code (from a module called fiercecommon that contains a common functions used across our sites -- you can put it wherever):
<?php
/**
* Implementation of hook_comments() -- Blocks anon comment spam by preventing posts with link tags!
*/
