Tagged: CONTACT FORM, DSGVO, form, real cookie banner
-
AuthorPosts
-
August 31, 2022 at 4:51 pm #1363388
Hello,
I´m using the “devowl Real cookie Banner” Solution to block cookies and connections.
But it can´t block Google ReCaptcha v3 within Enfold form.The devowl-Support created a GIST:
https://gist.github.com/matzeeable/42b5f167bd5cc17c010bfde928a59111Hope you can solve this in future :)
thank you,
MarcSeptember 1, 2022 at 9:26 am #1363449Hey Maw87,
Thank you for the info.
Have you tried implementing the suggested changes in the avia_google_recaptcha_front.js file?
// https://gist.github.com/matzeeable/42b5f167bd5cc17c010bfde928a59111
You can replace this code around line 75..
var script = document.createElement('script'); script.id = 'avia-google-recaptcha-api-script'; script.type = 'text/javascript'; script.src = AviaReCAPTCHA_front.avia_api_script;
,.. with..
(window.consentApi?.unblock("https://www.gstatic.com/recaptcha/") || Promise.resolve()).then(() => { var i = document.createElement('script'); i.id = 'avia-google-recaptcha-api-script'; i.type = 'text/javascript'; i.src = AviaReCAPTCHA_front.avia_api_script; document.body.appendChild(i) });
Related thread: https://kriesi.at/support/topic/add-support-for-enfold-recaptcha-real-cookie-banner/
Best regards,
IsmaelSeptember 2, 2022 at 10:50 am #1363600Thanks for your answer. I don´t want to hardcode things in Enfold Theme. I´m using a child theme maybe its possible to change this in child or within functions.php?
I want to be safe for further enfold updates!best,
MarcSeptember 4, 2022 at 5:40 pm #1363806Hi,
Try copying the avia_google_recaptcha_front.js file to your child theme functions.php and remove the “use strict”; from the first line, for example:function custom_avia_google_recaptcha_front_script() { ?> <script> (function($){ // Remove not needed messages from forms $('form.avia_ajax_form.avia-mailchimp-form').find('.avia-disabled-form').remove(); if( $( '#avia-google-recaptcha-api-script' ).length > 0 ) { return; } if( 'undefined' == typeof AviaReCAPTCHA_front || 'undefined' == typeof AviaReCAPTCHA_front.avia_api_script ) { return; } if( ! $('body').hasClass('av-recaptcha-enabled') ) { return; } /* check if reCaptcha are disabled by user setting via cookie - or user must opt in. */ var cookie_check = $('html').hasClass('av-cookies-needs-opt-in') || $('html').hasClass('av-cookies-can-opt-out'); var allow_continue = true; var silent_accept_cookie = $('html').hasClass('av-cookies-user-silent-accept'); if( cookie_check && ! silent_accept_cookie ) { if( ! document.cookie.match(/aviaCookieConsent/) || $('html').hasClass('av-cookies-session-refused') ) { allow_continue = false; } else { if( ! document.cookie.match(/aviaPrivacyRefuseCookiesHideBar/) ) { allow_continue = false; } else if( ! document.cookie.match(/aviaPrivacyEssentialCookiesEnabled/) ) { allow_continue = false; } else if( document.cookie.match(/aviaPrivacyGoogleReCaptchaDisabled/) ) { allow_continue = false; } } } if( ! allow_continue ) { var forms = $( 'form.avia_ajax_form' ).not( '.avia-mailchimp-form' ); var recaptchas = forms.find( '.avia-disabled-form' ).closest( 'form.avia_ajax_form' ); recaptchas.addClass( 'av-form-user-disabled' ); recaptchas.find( 'input.button' ).remove(); return; } var version = AviaReCAPTCHA_front.version; var recaptcha_areas = $('div.av-recaptcha-area'); if( recaptcha_areas.length == 0 && version != 'avia_recaptcha_v3' ) { return; } var script = document.createElement('script'); script.id = 'avia-google-recaptcha-api-script'; script.type = 'text/javascript'; script.src = AviaReCAPTCHA_front.avia_api_script; document.body.appendChild( script ); })( jQuery ); </script> <?php } add_action('wp_footer', 'custom_avia_google_recaptcha_front_script');
and then make the changes that @Ismael suggested, this assumes that you have tested the devowl-Support GIST on the original the avia_google_recaptcha_front.js file and it works.
Best regards,
MikeJanuary 27, 2024 at 2:56 pm #1432216Falls hier ausser mir noch jemand „drüber stolpert”: In Version 4 des Real Cookie Banner sollte man im Zuge der Erstellung des Content Blockers für Google reCAPTCHA im zugehörigen Formular in einem Dropdown-Menü (eh zwingend nötig) den Google Avia reCAPTCHA Eintrag wählen. Dann ist kein weiterer Code nötig und es klappt mit der Sperrung.
Liebe Grüße aus Bayern
January 27, 2024 at 4:05 pm #1432221Hi,
Glad to hear that you have this sorted out, and thanks for sharing your solution. If you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Real Cookie Banner can´t block ReCaptcha in Enfold Form’ is closed to new replies.