Jump to:

22979 Posts in 11808 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » Need help with recaptcha Instalation

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 2254 Views
  • Hello_electro
    Avatar
    Community Member
    80 Posts

    Need help with recaptcha Instalation Link to this post

    Maybe I am an idiot, i will admit it. But i am completely lost as to how to install recaptcha. Some kind of walkthrough tutorial in the module section would be nice.

    I know I have to update certain files, but even those instructions are confusing at best. If anyone who got recaptcha to work can please take a few moments to add a small tutorial, i know I would not be the only grateful one.

    Also, I know people are having issue with mollum, i as well, but which spam filter do you all prefer most and why? Just curious to your thoughts!

  • DigoART
    Avatar
    Community Member
    13 Posts

    Re: Need help with recaptcha Instalation Link to this post

    Actual. Please help !

  • bdgraphics
    Avatar
    Community Member
    5 Posts

    Re: Need help with recaptcha Instalation Link to this post

    Hi guys,

    I installed recaptcha on my local Dev using these steps, so this may help you.

    NOTE: there are some intermediate steps that may or may not effect other parts of your site, so it is best to test this first. Also, make sure you have the appropriate CMS version. I believe the minimum is 2.3.2.

    1. Download and install from Modules: SpamProtector

    1b. extract or copy the folder "spamprotector" into your CMS root. You may need to rename the folder slightly by taking off the version number.

    1c. rebuild the database

    2. Download and install from Modules: ReCaptcha

    2b. extract or copy the folder "recaptcha" into your CMS root. You may need to rename the folder slightly by taking off the version number.

    2c. rebuild the database

    3. For the firefox fix, add a closing tag for the input HTML (around line 171) in file: recaptcha/code/RecaptchaField.php

    3b. For the FF fix, remove the xml declaration at the top of the templates, page.ss and make sure it is declaring xhtml: <?xml version="1.0" encoding="UTF-8"?>

    4. Go to http://recaptcha.net/ and log in OR sign up for a new account.
    4b. Create keys for your site's domain.

    4c. Insert the code for the keys into the ReCaptcha _config file. i.e.
    RecaptchaField::$public_api_key = '<your public key>';
    RecaptchaField::$private_api_key = '<your private key>';

    5a. In your mysite _config file, add the following line:
    SpamProtectorManager::set_spam_protector('RecaptchaProtector');

    5b. Visit the page where your form is and ?flush=1. You should see the working recaptcha field amongst the default form.

    Hope this has helped.

  • g4m3c4ck
    Avatar
    Community Member
    11 Posts

    Re: Need help with recaptcha Instalation Link to this post

    Thanks that helped me a lot too! However, I can not get FF or chrome to see the captcha unless I use ?flush=1.

    It shows up t in IE but the formatting is all messed up. I have already added the / to close the html tag.

    I guess that is a css issue but maybe not..... I attached an screen shot. It appears this way in all browsers.

    Attached Files
  • bdgraphics
    Avatar
    Community Member
    5 Posts

    Re: Need help with recaptcha Instalation Link to this post

    I'd say this is more likely a CSS issue.

    The recaptcha form adds its own embedded styles which format the majority of the table. You are receiving this styling, so I'd say there is an overiding factor.

    I'd start debugging/disabling CSS style sheets as a test and see what is effecting your table.

    Also, check your doc-types being declared. When I was having issues with FF, it is because the wrong doc-type throws an error for the page, even though the source HTML is available. IE basically ignores this error and continues to render.

  • yurigoul
    Avatar
    Community Member
    202 Posts

    Re: Need help with recaptcha Instalation Link to this post

    Can anyone confirm that recaptcha and spamprotector are 2.4 ready?

    And if not did anyone manage to implement recaptcha without these modules?

    RE-EDIT: got it to work, there is something missing from the above explanation:

    You also need to insert a certain code into your form.

    In my original ContactPage it was like this:

    return new Form($this, 'ContactForm', $fields, $actions, $validator);

    I changed it to this:

    $form = new Form($this, 'ContactForm', $fields, $actions, $validator);

    $protector = SpamProtectorManager::update_form($form, 'Comments'); // to make the recaptcha work with your form

    return $form;

    It does not only appear, it also works on my site

    2254 Views
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.