Simple spam protection for comments

Running a blog or other type of comment form without spam protection is a bit risky theese days. But sometimes you want others to comment on your writings. Fortunately SilverStripe has the SpamProtection module out there which can be easily configured.

I've choosen to use a HoneyPotField, a invisible field which doesn't validate when it's filled out. Fortunately most spam bots are too stupid and fall into that trap. For the others we can enable moderation... And if the honey pot becomes unusable again we have other services like Akismet or Mollom we can easily connect to using SpamProtection module.

So let's install Honeypot field:

composer require studiobonito/silverstripe-spamprotection-honeypot:^1.1.0

which also installs spamprotection as dependency.

Now let's configure it:

#use honeypot as default spam protection
FormSpamProtectionExtension:
  default_spam_protector: '\StudioBonito\SilverStripe\SpamProtection\Honeypot\SpamProtector\HoneypotSpamProtector'

#add Comments to all pages and enable moderation
Page:
  extensions:
    - 'CommentsExtension'
  comments:
    require_moderation_nonmembers: true

#add spam protection to comments
CommentingController:
  extensions:
    - 'CommentSpamProtection'

Now your comments should have less spam.

Time to relax! I'll eat some fruit or corned beef...

 

 

Rate this post

Post your comment

Comments

  • Werner Krauss 02/12/2015 10:17am (2 years ago)

    After running this for some days it got much more silent, but some spammers still came through the honeypot trap. Now I added a blacklist validation which will hopefully become another blogpost and a module... Anyone interested?

RSS feed for comments on this page | RSS feed for all comments