-
AuthorPosts
-
April 23, 2019 at 11:38 am #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.April 23, 2019 at 12:25 pm #1093632Hi 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,
IsmaelApril 23, 2019 at 4:21 pm #1093689thanks – 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? ( | )April 24, 2019 at 9:14 am #1093891And 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.
April 25, 2019 at 2:41 am #1094249Hi,
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,
IsmaelMay 28, 2019 at 2:45 pm #1104849Sorry – can be closed now – i forgot to tell you that i changed the regex code to:
$regex = "!\[contact-form-7|\[av_contact!";
May 30, 2019 at 3:02 pm #1105436Hi,
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,
IsmaelJanuary 14, 2021 at 4:21 pm #1272437Hi @ismael,
Any option to implement the changes over class-grecaptcha.php using the child theme?
Thanks
January 14, 2021 at 4:33 pm #1272446Nevermind, I found this repo: https://github.com/KriesiMedia/enfold-library Very useful repo.
To achieve that, you can use this snippet: https://github.com/KriesiMedia/enfold-library/blob/a2a93f0004d530dedaa1576ae63a3f2915ac407d/actions%20and%20filters/External%20Services/avf_load_google_recaptcha_api_prohibited.php
January 15, 2021 at 8:26 am #1272609 -
AuthorPosts
- The topic ‘is it possible to load reCAPTCHA v3 only on needed Pages’ is closed to new replies.