• Resolved lilly

    (@lillyjluke)


    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)
  • Plugin Support katereji

    (@katereji)

    Hello @lillyjluke

    Could you please contact us via our ticket system: https://cleantalk.org/my/support/open? We need to take a closer look at your website, the affected web form, and the Anti-Spam plugin settings. It would be easier for us if we knew your CleanTalk account details. We appreciate your assistance.

    We haven’t received your reply in a few days, so I’m going to mark this topic as “resolved”.
    If you have any further questions, you can start a new topic anytime.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘AntiSpam not blocking ‘default’ entries’ is closed to new replies.