Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Getting Mollom to work on custom form class

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1380 Views
  • Samba Sam
    Avatar
    Community Member
    85 Posts

    Getting Mollom to work on custom form class Link to this post

    Hi,
    Right now, I am not getting any captcha on my custom form. I would greatly appreciate it if someone could check my SpamProtectorManager method in my ContactForm.php code below to see if it is correct. I've asked for help in the Forms forum with this but haven't gotten any responses as of yet.
    Thanks for the help,
    Sam

    PS: The is an abridged edited version of my previous post "Testing Mollom".

    <?php

    class ContactForm extends Form {

    function __construct($controller, $name) {
    $Params = Director::urlParams();
    $fields = new FieldSet(
           new TextField('Name', 'Name*'),
             new EmailField('Email', 'Email*'),
             new TextareaField('Comments','Comments*'));

    $actions = new FieldSet(
    new FormAction("SendContactForm", "Submit"));

    $requiredFields = new RequiredFields('Name', 'Email', 'Comments');

       $form = new Form($this, '__construct', $fields, $actions,$requiredFields);
       $protector = SpamProtectorManager::update_form($form, 'Captcha');
       if($protector) $protector->setFieldMapping('Name', 'Email','Comments');
    // protector method based on example at http://svn.silverstripe.com/open/modules/mollom/trunk/INSTALL
       
    parent::__construct($controller, $name, $fields, $actions,$requiredFields);
    } // END __construct

    function forTemplate() {
    return $this->renderWith(array(
    $this->class,
    'Form'
    ));
    }
    }
    ?>

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: Getting Mollom to work on custom form class Link to this post

    Hi!

    Don’t forget that the captcha does not appear if you’re logged-in as admin.

    Hope it helps,
    Juan

  • Samba Sam
    Avatar
    Community Member
    85 Posts

    Re: Getting Mollom to work on custom form class Link to this post

    Hi,
    Thanks for your response. Yes, I had tested my form while being logged out of admin - still no captcha.

    Sam

  • Samba Sam
    Avatar
    Community Member
    85 Posts

    Re: Getting Mollom to work on custom form class Link to this post

    Does any one have any other suggestions (e.g., code edits)

    Thanks,
    Sam

    1380 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.