Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #979355

    Ismael,

    I tried this on the latest version of Enfold and it did not hide the send button (it was inactive) but no captcha is available to solve: https://kriesi.at/support/topic/starting-to-receive-spam-enquiries-from-contact-form-on-website/#post-817676

    is this code still compatible with avia contact form?

    function ava_custom_recaptcha(){
    ?>
    <script type="text/javascript">
    	var createCaptcha = function() {
    		var button = jQuery(".avia_ajax_form .button");
    		var parent = button.parent(".form_element");
    		var captcha = jQuery("<p id='reCAPTCHAV2'></p>");
    
    		button.attr("disabled", "disabled");
    		captcha.insertBefore(parent);
    	};
    
    	createCaptcha();
    
    	var onLoadCallback = function() {
    		var publickey = 'YOUR PUBLIC API KEY';
    		grecaptcha.render('reCAPTCHAV2', {
    			'sitekey' : publickey,
    			'callback' : 'onSuccessfullCallback'
    		});
    	};
    
    	var onSuccessfullCallback = function() {
    		jQuery("input[type=submit]").removeAttr('disabled');
    	};
    </script>
    <?php
    }
    add_action('wp_footer', 'ava_custom_recaptcha');
    
    if(!function_exists('avia_register_reCAPTCHAV2_scripts'))
    {
    	if(!is_admin()){
    		add_action('wp_enqueue_scripts', 'avia_register_reCAPTCHAV2_scripts');
    	}
    
    	function avia_register_reCAPTCHAV2_scripts()
    	{
    		$prefix  = is_ssl() ? "https" : "http";
    		$api_url = $prefix.'://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit';
    
    		wp_register_script( 'avia-google-reCAPTCHAV2-api', $api_url, array('jquery'), NULL, true);
    		wp_enqueue_script(  'avia-google-reCAPTCHAV2-api' );
    	}
    }
    
    function avf_recaCAPTCHAV2_defer_async($tag, $handle) {
        if ( 'avia-google-reCAPTCHAV2-api' !== $handle )
            return $tag;
        return str_replace( ' src', ' defer="defer" async="async" src', $tag );
    }
    add_filter('script_loader_tag', 'avf_recaCAPTCHAV2_defer_async', 10, 2);

    Regards

    #979445

    i do not test it yet – but do you think in days of GDPR (DSGVO) it is a good advice to use google recaptcha?
    Test it if some infos will go out without any action just on loading the page!

    #979470

    I have no choice. The Avia contact form is sending us spam mails (even with unchecked privacy consent) the bot somehow manages to bypass Avia contact form.

    Regards

    #979935

    Hi,

    We no longer recommend that script anymore. Please try Sucuri or Wordfence to protect your site from spams and malicious scripts.

    // https://www.wpbeginner.com/opinion/sucuri-review-how-sucuri-helped-us-block-450000-wordpress-attacks-in-3-months/

    Best regards,
    Ismael

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