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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Spam Protection Module & Math Spam Protection Crash


Go to End


5 Posts   1608 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, 5523 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.

Avatar
Haddog

Community Member, 10 Posts

5 December 2014 at 11:19am

Hi i have just had 2 sites that are using spam protector fail. and now the spam protector isn't working properly. on one site it is letting some spam through and on the other is is not letting the form be submitted

Avatar
Haddog

Community Member, 10 Posts

5 December 2014 at 11:20am

Hi i have just had 2 sites that are using spam protector fail. and now the spam protector isn't working properly. on one site it is letting some spam through and on the other is is not letting the form be submitted