• Resolved goraptors

    (@goraptors)


    Hi I’m using hCaptcha with HTML Forms Plugin. hCaptcha works fine when visiting the site incognito or if you are not logged in. However when logged in I get this console error (recaptchacompat disabled) and can not submit the form and then subsequently it doesn’t log as a submission. I have tried toggling the options but none of them fix the issue. I also have the following code in my functions;

    <?php

    // hCaptcha - see https://htmlformsplugin.com/kb/hcaptcha/

    // If a form is submitted without a hcaptcha validation, show the oops something went wrong error
    add_filter('hf_validate_form', function( $error_code, $form, $data ) {
    $result = hcaptcha_verify_post();
    if ( null !== $result ) {
    $error_code = 'catcha_failed';
    }
    return $error_code;
    },10,3);

    // Execute the hcaptcha shortcode when a {{hcaptcha}} template tag is found in the fields code
    add_filter(
    'hf_template_tags',
    function( $tags ) {
    $tags['hcaptcha'] = do_shortcode( '[hcaptcha]' );
    return $tags;
    }
    );

    // Turn off the validation on how many fields are expected, as hcaptcha is adding some fields to the form
    add_filter( 'hf_validate_form_request_size', '__return_false');

    // Filter hcaptcha fields
    function ignored_hf_fields() {
    return array(
    'hcaptcha-widget-id',
    'g-recaptcha-response',
    'h-captcha-response',
    'hcaptcha_nonce'
    );
    }
    add_filter('hf_ignored_field_names','ignored_hf_fields');

    Can you help?

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