Viewing 1 replies (of 1 total)
  • Plugin Author Richard Webster

    (@rwebster85)

    Hi mate, there’s a custom snippet you can add to your site which adds a basic honeypot spam protection method. You could give that a try.

    add_action('somdn_before_form_inputs_simple', 'custom_somdn_output_honey_pot_antispam');
    add_action('somdn_before_form_inputs_variation', 'custom_somdn_output_honey_pot_antispam');
    function custom_somdn_output_honey_pot_antispam($product_id)
    {
    	echo '<div class="custom-somdn-download-form-website">';
    	echo '<input type="text" name="website" id="website" autocomplete="off" tabindex="-1">';
    	echo '</div>';
    }
    
    add_action('wp_footer', 'custom_somdn_hide_honey_pot_antispam');
    function custom_somdn_hide_honey_pot_antispam()
    {
    	echo '<style>.custom-somdn-download-form-website {display: none!important;}</style>';
    }
    
    add_filter('somdn_is_download_valid', 'custom_somdn_is_download_valid_honey_pot', 20, 2);
    function custom_somdn_is_download_valid_honey_pot($valid, $product_id)
    {
    	$honey_pot = sanitize_text_field($_REQUEST['website']);
    
    	if (!empty($honey_pot)) {
    		return false;
    	}
    
    	return $valid;
    }
    
    
Viewing 1 replies (of 1 total)
  • The topic ‘Spam’ is closed to new replies.