Changeset 3145886
- Timestamp:
- 09/03/2024 11:10:06 AM (19 months ago)
- Location:
- block-specific-spam-woo-orders
- Files:
-
- 3 added
- 2 edited
-
tags/0.77 (added)
-
tags/0.77/readme.txt (added)
-
tags/0.77/woo-block-spam-orders.php (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/woo-block-spam-orders.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
block-specific-spam-woo-orders/trunk/readme.txt
r3128164 r3145886 1 === Plugin Name===1 === Block Specific Spam Woo Orders === 2 2 Contributors: wigster 3 3 Tags: woocommerce, woo, block, spam, orders 4 4 Requires at least: 5.1 5 Tested up to: 6.6.15 Tested up to: 9.2.3 6 6 Requires PHP: 5.4 7 Stable tag: 0.7 67 Stable tag: 0.77 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 15 15 This plugin prevents a specific set of WooCommerce fake/spam orders. 16 Simply install and activate the plugin; there are no settings or tweaks to be made .16 Simply install and activate the plugin; there are no settings or tweaks to be made unless you want to add your own filters. 17 17 The plugin extends WooCommerce's built-in checkout validations to check for a specific set of known spam email accounts and names. If triggered, the spam bot simply cannot checkout and importantly does not get to the account creation stage. 18 18 The names/emails it checks for would only be used by spam bots, so there is no need to worry about false positives. 19 20 If you've found this plugin useful, you can support my work by buying me a coffee at: 21 [Buy Me a Coffee](https://buymeacoffee.com/alexwigmore). 22 23 == How to Use Custom Filters == 24 25 Starting from plugin version 0.77, you can extend the list of blocked email domains and blocked customer names using custom filters. 26 27 ### Available Filters: 28 29 1. **BSSO_extra_domains:** Add custom email domains to block during the checkout process. 30 2. **BSSO_extra_names:** Add custom first names to block during the checkout process. 31 32 ### Example Usage 33 34 To use these filters, add code to your theme's `functions.php` file or a custom plugin. 35 36 #### 1. Blocking Additional Email Domains 37 38 If you want to block additional email domains like `exampledomain.com` and `spamdomain.net`, use the `BSSO_extra_domains` filter. 39 40 **Code Example:** 41 42 ```php 43 add_filter('BSSO_extra_domains', function () { 44 return ['exampledomain.com', 'spamdomain.net']; 45 }); 46 ``` 47 48 #### 2. Blocking Additional First Names 49 50 If you want to block additional first names like `spambot` and `faker`, use the `BSSO_extra_names` filter. 51 52 **Code Example:** 53 54 ```php 55 add_filter('BSSO_extra_names', function () { 56 return ['spambot', 'faker']; 57 }); 58 ``` 59 60 ### Complete Example 61 62 Here’s how you might use both filters together: 63 64 **Code Example:** 65 66 ```php 67 add_filter('BSSO_extra_domains', function () { 68 return ['exampledomain.com', 'spamdomain.net']; 69 }); 70 71 add_filter('BSSO_extra_names', function () { 72 return ['spambot', 'faker']; 73 }); 74 ``` 75 76 ### Version Compatibility 77 78 Please note that these filters are only available starting from version 0.77 of the plugin. Ensure your plugin is updated to at least this version to use the custom filters. 19 79 20 80 == Frequently Asked Questions == 21 81 22 82 = Will you keep this plugin updated? = 83 23 84 Yes, where possible, I will try my best to add additional checks if the attack vectors change. 24 85 25 86 == Changelog == 26 87 88 = 0.77 = 89 * Added filters for extending blocked email domains and names. 90 * Tested compatibility with WooCommerce 9.2.3. 91 27 92 = 0.76 = 28 * Tested compatibility with WP 6.6.1 and WC 9+ 93 * Tested compatibility with WP 6.6.1 and WC 9+. 29 94 * Added confirmation that this plugin is compliant with the new WooCommerce HPOS (High-Performance Order Storage) / Custom Order Tables (COT) systems. 30 95 31 96 = 0.75 = 32 * Tested compatibility with WP 6.5.2 and WC 97 * Tested compatibility with WP 6.5.2 and WC. 33 98 34 99 = 0.7 = 35 100 * Updated logic slightly to simplify checks. Names are now also array-based if people want to manually extend. 36 101 * Added ability to translate/localize the Spam Validation message with typical language translators (WPML, etc.). 37 * Confirmed support with WP 6.4 and the latest WooCommerce 102 * Confirmed support with WP 6.4 and the latest WooCommerce. 38 103 39 104 = 0.6 = 40 * Added a new function to handle checking against multiple blocked domains, now including ["@fakemail"] 41 * Confirmed support with WP 6.1 and the latest WooCommerce 105 * Added a new function to handle checking against multiple blocked domains, now including ["@fakemail"]. 106 * Confirmed support with WP 6.1 and the latest WooCommerce. 42 107 43 108 = 0.55 = … … 45 110 46 111 = 0.54 = 47 * Updated supported versions for WP and WooCommerce 112 * Updated supported versions for WP and WooCommerce. 48 113 49 114 = 0.53 = -
block-specific-spam-woo-orders/trunk/woo-block-spam-orders.php
r3128164 r3145886 6 6 * Description: A quick plugin to block on-going issues with spam WooCommerce orders November 2020 7 7 * Author: guwii 8 * Version: 0.7 68 * Version: 0.77 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: 9. 1.413 * WC tested up to: 9.2.3 14 14 */ 15 15 … … 32 32 $blocked_names = ['aaaaa', 'bbbbb']; 33 33 34 // Apply the filters to allow adding extra emails/domains and names 35 $extra_domains = apply_filters('BSSO_extra_domains', []); 36 $extra_names = apply_filters('BSSO_extra_names', []); 37 38 // Sanitize and validate the extra domains and names 39 $extra_domains = array_filter($extra_domains, function ($domain) { 40 return preg_match('/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $domain); 41 }); 42 $extra_names = array_map('sanitize_text_field', $extra_names); 43 44 // Merge the default and extra arrays 45 $blocked_email_domains = array_merge($blocked_email_domains, $extra_domains); 46 $blocked_names = array_merge($blocked_names, $extra_names); 47 34 48 // Set the default return of false: 35 49 $is_a_spam_order = false; … … 37 51 // Compare user's email domain with our list of blocked email domains: 38 52 foreach ($blocked_email_domains as $blocked_email_domain) { 39 // If a blocked email domain exists in the user's billing email, return spam=true;40 53 if (strpos($billing_email, $blocked_email_domain) !== false) { 41 54 $is_a_spam_order = true; 42 break; // No need to check further if one match is found55 break; 43 56 } 44 57 } 45 58 46 // If not spam by email , checknames59 // If not spam by email domain, check the names 47 60 if (!$is_a_spam_order) { 48 61 foreach ($blocked_names as $blocked_name) { 49 // If a blocked Name exists in the user's billing first name, return spam=true;50 62 if (strpos($billing_first_name, $blocked_name) !== false) { 51 63 $is_a_spam_order = true; 52 break; // No need to check further if one match is found64 break; 53 65 } 54 66 }
Note: See TracChangeset
for help on using the changeset viewer.