Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #750552

    Hi, I am using the Enfold contact form , to keep away from the spam email attacks though contact form
    so to ask the email sender to answer one question to make the submit successful might be helping

    Can you check if this code is working? to the functions.php

    add_action( ‘contact_form’, ‘add_security_question’ );
    function add_security_question() { ?>
    <p>
    <label><?php _e(‘Washington D.C is the capital of USA’) ?><br />
    <input type=”text” name=”user_proof” id=”user_proof” class=”input” size=”20″ tabindex=”20″ /></label>
    </p>
    <?php }

    add_action( ‘contact_post’, ‘add_security_question_validate’, 10, 3 );
    function add_security_question_validate( $sanitized_user_login, $user_email, $errors) {
    // if do not answer
    if (!isset($_POST[ ‘user_proof’ ]) || empty($_POST[ ‘user_proof’ ])) {
    return $errors->add( ‘proofempty’, ‘wrong: you forgot to answer my question’ );
    // If answer was wrong
    } elseif ( strtolower( $_POST[ ‘user_proof’ ] ) != ‘Yes’ ) {
    return $errors->add( ‘prooffail’, ‘Yes: Wrong answer’ );
    }
    }

    Can you check my contact page and help me to correct this codes?

    This is the codes to prevent robot registry, I think IT should help in robot spam emails..

    #750562

    Hey YongyanLi,

    There is actually an option on the form itself to display a security captcha. The exact option name is Contact Form Captcha. Please see this image for reference:

    https://snag.gy/hl08W4.jpg

    Best regards,
    Jordan Shannon

    #750841

    Hi, Jordan, Thanks very much

    I am useing the Enfold contact form, which is not plugin( for plugins, the less is the better)
    so there is no funtional options to customize like the screenshot you offered.

    so that’s why try to add the Captcha in functions.php.

    however, the above codes should need some amendments to make it work correctly?

    #751016

    Hi,

    That screenshot I provided is a native feature of the Enfold contact form, not a plugin. All you have to do is activate it. Please let me know if I am misunderstanding.

    Best regards,
    Jordan Shannon

    #751242

    LoL… I forgot this at all.
    such an idiot

    Jordan, Thanks

    #751280

    Hi,

    No problem at all. Glad that I could help. If you need additional help let me know.

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.