October 11, 2008

[silverstripe] Mollom Captcha For Silverstripe

12

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.

Under the hood I gracefully used the Mollom PHP class by Tijs Verkoyen, so most of the credit really goes to him.

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.

If all goes well it should add something like this to your custom form:

SS Mollom Captcha 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.

Cheerz.

PS: I might look into making a complete Mollom module some day, so not just the Captcha field. 

This post is about , , , filed under silverstripe.

Comments

  1. Joseph Ku

    Joseph Ku , 1 year ago:

    Hi, I have applied it, but it doesn't work, could u pls troubleshoot for me? First I obtained the pub and pri keys, then i uploaded folder, added in the , then run a db/build and could not seem to see anything has changed? please help!

  2. Dieter Orens

    Dieter Orens, 1 year ago:

    Hi Joseph,

    You have to add the field explicitly to your Form code where you create your fields.

    It's not working on userdefined forms that you've created through the cms, if that is what you're looking for.

  3. Joseph Ku

    Joseph Ku , 1 year ago:

    Thanks for your reply. I thought it will get built in to the Silverstripe out of the box forms. I will basically need to create a custom php form, and add the line of code into the php file right?

  4. Dieter Orens

    Dieter Orens, 1 year ago:

    Yes that is right, you'll need to create your own php form.

    It's currently not possible yet to go on out-of-the-box forms.

    Thanks

  5. Andrew Houle

    Andrew Houle , 1 year ago:

    Awesome work, thanks for the alternate captha for ss!

  6. Jordan

    Jordan , 11 months ago:

    Hey there,

    I just wanted to know if you could help me. Apparently Mollom is working alongside the userforms module in silverstripe, but i'm having some trouble.

    Can you confim this at all?

    Cheers!

  7. Dieter

    Dieter, 10 months ago:

    Hi Jordan,

    I'm sorry to say that I haven't used the new Mollom module together with the userforms module yet, so I cannot confirm this.

    The new Mollom module does work fine with custom forms.

    Will let you know as soon as I do :)

    Thanks

  8. jimmy

    jimmy , 9 months ago:

    Awesome!!!

  9. Führer Black Jack

    Führer Black Jack , 9 months ago:

    SilverStripe's Mollom code was originally contributed late last year by Dieter Orens, an experienced programmer within SilverStripe's open source developer community. Initially only supporting Mollom's CAPTCHA feature, Dieter's code was significantly extended by the core SilverStripe team to meet quality and feature requirements we requested. Underscoring the need for a spam filter, Sigurd mentions that their SilverStripe.com and SilverStripe.org websites received together over 400,000 website spam attempts in the last month. Only about one in 10,000 spam attempts get through, though, making the moderation process feasible and efficient to control. Needless to say, SilverStripe understands the value of Mollom. http://www.blackjack-regeln.com

  10. photographe liège

    photographe liège , 7 months ago:

    Awesome work, thanks for the alternate captha for ss! NO comment!

  11. ppo plans

    ppo plans , 1 month ago:

    thanks for the alternate captha for ss . i used it . it is very useful for me.

  12. Seo Company UK

    Seo Company UK , 1 month ago:

    A very good story you have put up. Thanks for sharing it.

Post your comment

You can also tweet a reply using the following hashtag: #dio5_646

Your details and comment

Some html allowed, see code-help

Pressing ENTER 2 times makes a new paragraph. Some HTML allowed:

  • Bold: <strong>text</strong>
  • Italic: <em>text</em>
  • Link: <a href="http://www.website.com" title="My title">My website</a>

URL's with http:// are automatically converted to links.

Get the RSSFeed for the comments on this article.

Search