October 11, 2008
[silverstripe] Mollom Captcha For Silverstripe14
UPDATE: consider this obsolete. Silverstripe now has an official mollom module.
Long time since I've done a real post, but here we go.
As we all know, spam has been a huge problem for years now, and for a contact form of one of the silverstripe projects I was involved in we needed some kind of spam protection.
Now there was already the recaptcha module, which added a captcha field provided by Recaptcha, but as I'm actually more of a fan of Mollom, I thought it would be nice to have the Mollom Captcha field added as well.
So here you go, a 'Mollom CaptchaField Module' for Silverstripe.
Note that I manually hardcoded the serverlist in _config.php, I'm not sure this is really the way to go.
For it to work you'll have to get a public and a private key for your domain on the Mollom - website and set this in the _config.php file of the mollomcaptchafield directory. As long as it doesn't work, you won't see the field showing up.
To initiate it on your custom forms, it works like any other form field:
new MollomCaptchaField("MyCaptcha", "Label Text");
You can also add this field to your RequiredFields like you would with any other field.
You'll see the field also has a 'listen' link. This will download an .mp3 which lets disabled users hear what they have to type when they're having difficulties reading it. The link has an id 'mollom_audio', so you can style it as you please.
For SS legacy reasons, it also still has the 'span class="middleColumn" element in, in case you're wondering why I didn't leave that out.
Download at Mollom for Silverstripe.
PS: I might look into making a complete Mollom module some day, so not just the Captcha field.