Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Getting Recaptcha to work in UserForms Module

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 4711 Views
  • Happysadhu
    Avatar
    Community Member
    33 Posts

    Getting Recaptcha to work in UserForms Module Link to this post

    Hi,
    I've installed the latest versions of these modules, including the spam protection module, in the root folder of my silverstripe installation. The UserForms works fine, but it is not clear to me how to use Recaptcha with it. The"add field" option in the Form tab of Userforms does have a spam protection option, but not a Recaptcha option. When I add the spam protection, no such field appears on the web page. The spam protection field wants me to enter in a question. What type of question does it mean? Is the spam protection field related to Recaptcha?

    In short, how do I get Recaptcha to work with UserForms?

    Do I have to change the document type of my web pages from XHTML Strict to XHTML Transitional? I've seen that mention in the Forum. But that wouldn't effect the CMS end of how I add and use Recaptcha in my userforms.

    Any help is appreciated,

    Thanks,
    Sam

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    Yes you will need to change your validation or edit the file to have a /.

    The (Enter Question) text is just the default label text for the cms

    Is the spam protection field related to Recaptcha?

    Spam Protection is the base class for recaptcha, once you have spam protection installed it provides the code which like recaptcha can insert their validation into.

  • Happysadhu
    Avatar
    Community Member
    33 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    Thanks for the quick reply.

    So this would be the right DOCTYPE to enter, correct?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    What do you mean by "or edit the file to have a /." Please give me an example/more detail of this alternative,

    Much appreciated,
    Sam Miller

  • Happysadhu
    Avatar
    Community Member
    33 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    Hi again,
    I changed the DOCTYPE as suggested in my default Page.ss. Still no sign of Recaptcha?

    What I'm I doing wrong?
    Sam

  • Happysadhu
    Avatar
    Community Member
    33 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    Hi again,

    I've also tried installing Mollom, first uninstalling recaptcha, to see if I could get that to work with Userforms -- no luck? Nothing shows when I add the spam protection field. I have followed the installation instructions precisely at http://doc.silverstripe.com/doku.php?id=modules:mollom.

    The Mollom Key Status report in my CMS says that my "key exists and is working". Yet no go on the front-end.

    I am working on a localhost, could that be the problem?

    Help...
    Sam

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    Yet no go on the front-end.

    Are you still logged in though? Mollom will not display if you are logged into the site.

  • Happysadhu
    Avatar
    Community Member
    33 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    Hi,
    Thanks! Once, I manually logged out of the CMS (lower right), it worked.

    Also Mollom works fine with the following doctype:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" >

    (As recommended in http://doc.silverstripe.com/doku.php?id=html#doctypes for most themes)

    Much appreciated,
    Sam

    PS: I haven't tried again to get Recaptcha to work. For now, I'm satisfied with Mollom.

  • hp777
    Avatar
    Community Member
    10 Posts

    Re: Getting Recaptcha to work in UserForms Module Link to this post

    First sign-up at reCaptcha site get the public and private keys. Next open your "mysite > config.php" file and add
    (replace <publickey> & <privatekey> with the keys from reCaptcha )
    RecaptchaField::$public_api_key = '<publickey>';
    RecaptchaField::$private_api_key = '<privatekey>';

    IF you are using this with spam protection module than you need to add the following to your "mysite > config.php" as well
    SpamProtectorManager::set_spam_protector("RecaptchaProtector");

    place all of this right before the "?>" at the end of your "mysite > config.php" and you should be in business you shouldn't have to change doc type on most new templates

    4711 Views
Page: 1 2
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.