Changeset 2719240
- Timestamp:
- 05/06/2022 09:55:41 AM (4 years ago)
- Location:
- block-specific-spam-woo-orders/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
woo-block-spam-orders.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
block-specific-spam-woo-orders/trunk/readme.txt
r2670381 r2719240 3 3 Tags: woocommerce,woo,block,spam,orders 4 4 Requires at least: 5.1 5 Tested up to: 5.95 Tested up to: 6.0 6 6 Requires PHP: 5.4 7 7 Stable tag: 4.3 … … 25 25 == Changelog == 26 26 27 = 0.55 = 28 * Tested support with WP 6.0 and latest WC - works fine. 27 29 28 30 = 0.54 = -
block-specific-spam-woo-orders/trunk/woo-block-spam-orders.php
r2670381 r2719240 6 6 * Description: A quick plugin to block on-going issues with spam WooCommerce orders November 2020 7 7 * Author: guwii 8 * Version: 0.5 48 * Version: 0.55 9 9 * Author URI: https://guwii.com 10 10 * License: GPL3+ 11 11 * Text Domain: guwii-woo-block-spam-orders 12 12 * WC requires at least: 4.3 13 * WC tested up to: 6. 1.113 * WC tested up to: 6.4.1 14 14 */ 15 15 16 16 // Only use this plugin if WooCommerce is active 17 if ( in_array('woocommerce/woocommerce.php', get_option('active_plugins'))) {17 if (in_array('woocommerce/woocommerce.php', get_option('active_plugins'))) { 18 18 // Add our custom checks to the built in WooCommerce checkout validation: 19 add_action( 'woocommerce_after_checkout_validation', 'action_woocommerce_validate_spam_checkout', 10, 2);19 add_action('woocommerce_after_checkout_validation', 'action_woocommerce_validate_spam_checkout', 10, 2); 20 20 21 21 // Check if billing name or email domain is a specific string, if it is we'll decline the order: 22 function action_woocommerce_validate_spam_checkout( $fields , $errors) { 22 function action_woocommerce_validate_spam_checkout($fields, $errors) 23 { 23 24 $customer_name_to_block = 'bbbbb'; 24 25 $email_domain_to_block = 'abbuzz.com'; 25 26 if ( 26 $fields[ 'billing_first_name'] == $customer_name_to_block27 $fields['billing_first_name'] == $customer_name_to_block 27 28 || 28 strpos( strtolower($fields[ 'billing_email' ]), $email_domain_to_block)29 strpos(strtolower($fields['billing_email']), $email_domain_to_block) 29 30 ) { 30 $errors->add( 'validation', 'Spam.');31 $errors->add('validation', 'Spam.'); 31 32 } 32 33 }
Note: See TracChangeset
for help on using the changeset viewer.