AntiSpam not blocking ‘default’ entries
-
CleanTalk is not blocking spam that consists of ‘default’ being entered for every value. I’ve tried adding a PHP snippet to block this and it is not working. Please advise. Here’s my PHP I am trying to add:
<php?add_filter(‘gform_field_validation’, ‘block_default_names_all_forms_debug’, 10, 4);
function block_default_names_all_forms_debug($result, $value, $form, $field) {
// Convert both value and block list to lowercase for comparison
$input = trim(strtolower((string)$value));
$blocked_names = array(‘first’, ‘last’, ‘test’, ‘your name’, ‘default’);// Log what's happening error_log("Gravity Forms Validation: Form {$form['id']} | Field {$field->id} | Value: '{$input}'"); // Target only field IDs 1 and 2 on forms 1 through 17 if ($form['id'] >= 1 && $form['id'] <= 17 && in_array($field->id, array(1, 2))) { if (in_array($input, $blocked_names)) { error_log("Blocked value: '{$input}' on Form {$form['id']} Field {$field->id}"); $result['is_valid'] = false; $result['message'] = 'Please enter a valid name.'; } } return $result;}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘AntiSpam not blocking ‘default’ entries’ is closed to new replies.