• Resolved UserDG

    (@tenkepadu)


    I use this http://cfdbplugin.com/?s=Preventing+Duplicate+Submissions+from+CF7 and its working. I want to use it in different form. How to do this? Should I create new function of mu_validate_email? Like this

    function my_validate_email($result, $tag) {
    $formName = ’email_form’; // Name of the form containing this field
    $fieldName = ’email_123′; // Set to your form’s unique field name
    $name = $tag[‘name’];
    if($name == $fieldName){
    $valueToValidate = $_POST[$name];
    if (is_already_submitted($formName, $fieldName, $valueToValidate)) {
    $result->invalidate($name, ‘Email has already been submitted’); // error message
    }
    }
    return $result;
    }

    function my_validate_email1($result, $tag) {
    $formName = ’email_form’; // Name of the form containing this field
    $fieldName = ’email_123′; // Set to your form’s unique field name
    $name = $tag[‘name’];
    if($name == $fieldName){
    $valueToValidate = $_POST[$name];
    if (is_already_submitted($formName, $fieldName, $valueToValidate)) {
    $result->invalidate($name, ‘Email has already been submitted’); // error message
    }
    }
    return $result;
    }

    // use this if your field is a required fields on your form
    add_filter(‘wpcf7_validate_email*’, ‘my_validate_email’, 10, 2);
    // use this if your field is not a required field on your form
    add_filter(‘wpcf7_validate_email’, ‘my_validate_email’, 10, 2);
    // use this if your field is a required fields on your form
    add_filter(‘wpcf7_validate_email1*’, ‘my_validate_email’, 10, 2);
    // use this if your field is not a required field on your form
    add_filter(‘wpcf7_validate_email1’, ‘my_validate_email’, 10, 2);

    https://wordpress.org/plugins/contact-form-7-to-database-extension/

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

The topic ‘Preventing Duplicate Submissions from CF7’ is closed to new replies.