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.

Forum Module /

Discuss the Forum Module.

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

SilverStripe forums + Recaptcha module

Go to End

2 Posts   2827 Views


Community Member, 18 Posts

15 May 2013 at 7:12am

I had SilverStripe 2.4.x + the Forum module + Recaptcha (+Spam Protection module) working on a fresh install of SilverStripe. However, repeating the same steps on the production server I seem to be getting the response:

"Your answer didn't match the captcha words, please try again"

after submitting the Forum user registration form, even when the Recaptcha is obviously correct.

I'm wondering if there's some domain/keys issue. I've tried using public/private global keys for both the domain of the URL ( and the hostname of the actual web servers (let's say:

The steps I have done are basically:

- installed Forum module
- installed Recaptcha into /html/recaptcha
- registered w/ and generated a public/private keypair for the domain I am using
- installed Spam Protection module into /html/spamprotector
- /dev/build on the site
- ?flush=1 on the site

- in /mysite/_config.php added 3 lines:
RecaptchaField::$public_api_key = '<public key copied from>';
RecaptchaField::$private_api_key = '<private key copied from>'';

- in /forums/code, edited 2 files: ForumMemberProfile.php, ForumRole.php

ForumMemberProfile.php, added this line under line 165 the check "if(class_exists('SpamProtectionManager')":
$protector = SpamProtectorManager::update_form($form, 'MyCaptcha'); // to make the recaptcha work with your form

ForumRole.php, added a recaptca field under line 171 to the $personalDetailsField form code:
new RecaptchaField('MyCaptcha')

A Recpatcha image box appears but 100% of the time after the form is submitted the response is:
"Your answer didn't match the captcha words, please try again"

and the user is not registered but rather brought back to the form back to try again. Is there something obvious I am forgetting?



Community Member, 18 Posts

17 May 2013 at 6:50am


The issue was neither the keys nor any sort of firewall issue.

The issue was there were 2 captcha fields being created, and they must have been one on top of the other on the page because it appeared only 1 was on the page when the registration form appeared. However after submitting and looking at the network traffic it was obvious 2 challenges were being sent to Google/recaptcha. The first returned as correct, the second always returning incorrect. Additionally, looking at the page source there were 2 different regions that called recaptcha Javascript code which looked suspicious.

I had added the line:
$protector = SpamProtectorManager::update_form($form, 'MyCaptcha');

to ForumMemberProfile.php and also added a Recaptcha field to the forum. From what I gather, the Spam Protection module must generate that on it's own when it's configured to use Recaptcha so in essence I had added a 2nd field. I removed the added 2 lines and things were working. Checking the network traffic there was then only a single challenge to Google/recaptcha.