For the last few months, I've been suffering under the weight of spam awaiting 'approval' from me in the comment moderation queue.
On Saturday, I finally hacked the comment.module file to make Drupal reject spam which matched the following :
Spam will still have to pass through moderation from Kat or I, but so far it does seem to have stopped any crap from being posted.
I edited comment.module and within the comment_validate function, I added the following :
if(preg_match_all('/(http|\[url)/', $edit['comment'], $matches)) {
if(sizeof($matches[0])>4) {
form_set_error('comment', t("Comment contains too many URLs. (Spam protection)"));
}
}
if($edit['subject'] == $edit['name']) {
form_set_error('subject', t('Subject and author need to be different (Spam protection)'));
}
I quite like the form_set_error function; and have been using something similar at work.
Comments
drupal 5.1
After upgrading to Drupal 5.1 I came across the Drupal Captcha Riddler plugin, which does exactly what I had, but without any patching.
See http://drupal.org/project/riddler
Post new comment