Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Blog Comment Protection using Recaptcha

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1354 Views
  • Bruce
    Community Member
    29 Posts

    Blog Comment Protection using Recaptcha Link to this post

    How can I get recaptcha to protect the blog module comments?

    I have installed the spamprotection & recaptcha modules, and I have successfully got them running on some customised forms (a contact us form).

    I cannot however, see how to get the recaptcha to appear on the blog module comments.
    I have had to add MathSpamProtection in the meantime, but I would prefer the recaptcha

    Here's the /mysite/_config I am using :

    RecaptchaField::$public_api_key = 'code';
    RecaptchaField::$private_api_key = 'code';

    // field creation (Should this even be here?)
    $recaptchaField = new RecaptchaField('MyCaptcha');
    $recaptchaField->jsOptions = array('theme' => 'clean'); // optional


    any suggestions?

  • Chris_Bryer
    Community Member
    35 Posts

    Re: Blog Comment Protection using Recaptcha Link to this post

    this is an old post but heres the solution for ss 3.1. it'd be easy to turn this into a module too.

    class CommentSpamProtectionExtension extends DataExtension {

       public function alterCommentForm(Form $form){
          SpamProtectorManager::update_form($form, 'Comment');
          return $form;

    ::yml _config.yml
    - CommentSpamProtectionExtension

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.