Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

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

Spam Protection Module & Math Spam Protection Crash


Reply


3 Posts   310 Views

Avatar
Rossel

Community Member, 18 Posts

12 February 2014 at 8:43pm

Edited: 12/02/2014 8:50pm

currently getting this error while trying to setup Math Spam Protection really don't know where to go from here.

Fatal error: Declaration of MathSpamProtector::getFormField() must be compatible with that of SpamProtector::getFormField() in /home/ifif1773/public_html/silverstripe/mathspamprotection/code/MathSpamProtector.php on line 7

Running SS 3.1
Have both required modules installed

contact.php

public function ContactForm() {
$fields = new FieldList(
new TextField('Name', 'Your Full Name'),
new EmailField('Email', 'Your Email'),
new TextField('Phone', 'Your Phone No.'),
new TextField('Subject', 'The Subject'),
new TextareaField('Message','Message')
);
         
$validator = new RequiredFields(array('Name','Email','Message'));
$actions = new FieldList(FormAction::create("sendEmail")->setTitle("Send Email"));
$form = new Form($this, 'ContactForm', $fields, $actions, $validator);
      
// enable MathSpamProtection
$protector = SpamProtectorManager::update_form($form);
         
return $form;
}

contact.ss

$ContactForm

mysite/config

//Set Spam Protection
SpamProtectorManager::set_spam_protector('MathSpamProtector');

I should note that the form works fine without the:

// enable MathSpamProtection
$protector = SpamProtectorManager::update_form($form);

Avatar
Willr

Forum Moderator, 5513 Posts

15 February 2014 at 11:01pm

Make sure you have the latest versions of both the modules.

Avatar
Rossel

Community Member, 18 Posts

17 February 2014 at 7:28pm

I had updated to the masters of both modules with no luck, but the new changes have resolved my issue. Thanks Will.