i am trying to make a Honeypot to prevent spam-emails.
i tried to use the following filter, which i found on your support Blog.
//##
function loadtime_func() {
return time();
}
add_shortcode('loadtime', 'loadtime_func');
add_filter('cred_form_validate','honeypot_func',10,2);
function honeypot_func($field_data, $form_data)
{
list($fields,$errors)=$field_data;
if ($form_data['id']==2079)
{
//print_r($fields);
//$loadtime = $_POST["loadtime"];
$loadtime = $fields['loadtime']['value'];
$totaltime = time() - $loadtime;
if($totaltime< 5) {
$errors['loadtime'] = 'Please fill in the form before submitting!';
}
}
//return result
return array($fields,$errors);
}
//##
i used this code but it still sending the mails when i change the honeypot.
thank u in advanced
Hi Mohammed,
Thank you for getting in touch.
Can you point me to the thread where you originally got this code so I can get some context on the use case?
Thanks,
Shane
Hi Mohammed,
I would not recommend the use of this code for the spam protection given that this was done perhaps at a time when we didn't have the spam protection integrated into our form.
I would recommend following the instructions below in order to protect your form from spam.
Thanks,
Shane
Hi Shane,
which instructions you mean?
i do not see any instructions below.
Thanks