Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1093626

    we all only need the Tool on Page with some Form Elements / contact infos or comments.
    So activating the scripts on all pages is not neccessary – not only on Performance or GDPR reasons.

    #1093632

    Hi Guenter!

    Thank you for using Enfold.

    This should be possible. Please try to edit the framework > php > class-grecaptcha.php file. Replace the “is_recaptcha_active” function with the following code.

      public function is_recaptcha_active() {
                global $post;
      
                $regex = "!\[av_contact!";
                preg_match( $regex, $post->post_content, $matches );
                
                $api_vn = $this->api_vn;
    
                if( $api_vn == '' || ! isset( $matches[0] ) ) {
                    return false;
                }
    
                $secret_key = $this->get_secret_key();
                $public_key = $this->get_public_key();
    
                return $public_key && $secret_key;
            }
    

    Best regards,
    Ismael

    #1093689

    thanks – i test this – but what if i like to use CF7 with it?
    is there a way to only enqueue those things only for those pages.?
    A Friend of mine put me on the right way:

    only change the regex to (and it works great !) :
    $regex = "!\[contact-form-7!"; …

    how to combine both (or maybe the comments pages too) to one hack? ( how is the syntax here on an or relation)
    using just a pipe character in between? ( | )

    #1093891

    And one thing apart: Shouldn’t this be the default behavior?
    On GDPR Reasons we had to avoid Sending of IPs etc. and other infos till the Privacy has been read.

    Then the performance reasons have to be mentioned, because loading a code that is not needed is useless.

    #1094249

    Hi,

    Yes, adding the pipe in between the pattern should work. We’ll forward this to the dev team. Please note that this feature is not intended to work for any other contact forms aside from the default one from the theme.

    Best regards,
    Ismael

    #1104849

    Sorry – can be closed now – i forgot to tell you that i changed the regex code to:

    $regex = "!\[contact-form-7|\[av_contact!";

    #1105436

    Hi,

    No problem. We’ll close this now. @guenter is currently improving the reCAPTCHA script, and it will probably be included in the next patch.

    Best regards,
    Ismael

    #1272437

    Hi @ismael,

    Any option to implement the changes over class-grecaptcha.php using the child theme?

    Thanks

    #1272446
    #1272609

    Hi,

    Great! Glad to know that you have found the solution. Please do not hesitate to open a new thread should you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘is it possible to load reCAPTCHA v3 only on needed Pages’ is closed to new replies.