Anti-comment-spam technique restored

When I switched to drupal, I lost the "type in my first name" code to stop comment spam that I had written for Movable Type. I used drupal's systems for spam spotting and comment moderation, but in fact those are not very good yet, so I re-coded the system so that anonymous commenters can comment directly if they answer a simple question on the comment form. The question, in this case the trivial one of entering my first name, is easy to answer and can be handled by the blind (which is not true of captchas.) If spammers should write programs to fill in that field, I can quickly change the question or make it more complex as needed. If spammers start to automate answering trivial questions faster than we can think them up, then perhaps we can consider captchas and other more advanced turing tests.

Note that you won't see the question if you are a registered user of this site (you can also log in with your idea from most other drupal sites too) so registration is encouraged but not required.

Comment spam is a nasty scourage. I think Movable Type as the most popular software gets the most but all systems that get popular will get hit. In addition I modified drupal to use the rel=nofollow tag on homepage links -- it already does it on other links in comments -- so spammers gain no search engine credit for their spam. Sorry, that also applies to honest commenters.

Comments

Hi Brad,

Great site. Could you share how you modified the code to include rel="nofollow" on homepage links (as opposed to only within comments)?

Thanks,
Alex

That's in includes/common.inc of drupal. You will see the code that outputs the "homepage" object with a link, around line 940, and just change the text of the link to add rel=nofollow.

Amazes me though that even though I tell spammers I am doing this, some have not yet clued in. I guess it will take time for them to learn not to bother.

Hi,
I've been looking for a simple module that would rel=nofollow comments. I read where you said:

"In addition I modified drupal to use the rel=nofollow tag on homepage links — it already does it on other links in comments"

So, I wanted to ask how you did it!? I wish that Drupal just allowed a simple check box in the comments settings to add the rel=nofollow but unfortunatley it does not.

So, any quick ideas on how to do it?

Thanks

Lines 1052 and 1064 (in 5.3)

diff -r1.337.2.2 theme.inc
1052c1052
< $output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
---
> $output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.'), 'rel' => t('nofollow')));
1064c1064
< $output = l($object->name, $object->homepage);
---
> $output = l($object->name, $object->homepage, array('rel' => t('nofollow')) );

I agree it should go into Drupal. Even though I warn spammers that their links will be useless to them for SEO, some still do it. If drupal made it standard, the spammers would eventually clue in, I hope.

Thanks for the quick reply Brad. Patching the theme.inc doesn't seem like a very hard workaround. I will send that method over to my programmer to see if he can implement it.

Thanks again!!
Brian

Looks like some is still getting through; see the previous comment.

Everything else works, but every time I post, I get:

user warning: Unknown column 'style' in 'field list' query: SELECT scid, filter, style, effect, action FROM spam_custom WHERE effect != 4 in /home/brad/www/drupal/includes/database.mysql.inc on line 172.

Yes, at some point I will have some free time and update this to drupal 7 or even 8 when that comes.

Add new comment