Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Blog Module /

Discuss the Blog Module.

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

Blog Comment Protection using Recaptcha


Go to End


2 Posts   2287 Views

Avatar
Bruce

Community Member, 29 Posts

18 July 2010 at 10:12pm

Edited: 18/07/2010 10:13pm

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).
http://www.silverstripe.org/all-other-modules/show/267893#post267893

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 :

SpamProtectorManager::set_spam_protector("RecaptchaProtector");
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

PageComment::enableModeration();
MathSpamProtection::setEnabled(); 

any suggestions?

Avatar
Chris_Bryer

Community Member, 35 Posts

5 February 2014 at 6:58pm

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

:::php
class CommentSpamProtectionExtension extends DataExtension {

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

::yml _config.yml
CommentingController:
  extensions:
    - CommentSpamProtectionExtension