Plugin Directory

Changeset 2719240


Ignore:
Timestamp:
05/06/2022 09:55:41 AM (4 years ago)
Author:
Wigster
Message:

Confirming support for WP 6

Location:
block-specific-spam-woo-orders/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • block-specific-spam-woo-orders/trunk/readme.txt

    r2670381 r2719240  
    33Tags: woocommerce,woo,block,spam,orders
    44Requires at least: 5.1
    5 Tested up to: 5.9
     5Tested up to: 6.0
    66Requires PHP: 5.4
    77Stable tag: 4.3
     
    2525== Changelog ==
    2626
     27= 0.55 =
     28* Tested support with WP 6.0 and latest WC - works fine.
    2729
    2830= 0.54 =
  • block-specific-spam-woo-orders/trunk/woo-block-spam-orders.php

    r2670381 r2719240  
    66* Description: A quick plugin to block on-going issues with spam WooCommerce orders November 2020
    77* Author: guwii
    8 * Version: 0.54
     8* Version: 0.55
    99* Author URI: https://guwii.com
    1010* License: GPL3+
    1111* Text Domain: guwii-woo-block-spam-orders
    1212* WC requires at least: 4.3
    13 * WC tested up to: 6.1.1
     13* WC tested up to: 6.4.1
    1414*/
    1515
    1616// Only use this plugin if WooCommerce is active
    17 if ( in_array( 'woocommerce/woocommerce.php', get_option('active_plugins'))) {
     17if (in_array('woocommerce/woocommerce.php', get_option('active_plugins'))) {
    1818    // 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);
    2020
    2121    // 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    {
    2324        $customer_name_to_block = 'bbbbb';
    2425        $email_domain_to_block = 'abbuzz.com';
    2526        if (
    26             $fields[ 'billing_first_name' ] == $customer_name_to_block
     27            $fields['billing_first_name'] == $customer_name_to_block
    2728            ||
    28             strpos( strtolower($fields[ 'billing_email' ]), $email_domain_to_block )
     29            strpos(strtolower($fields['billing_email']), $email_domain_to_block)
    2930        ) {
    30             $errors->add( 'validation', 'Spam.' );
     31            $errors->add('validation', 'Spam.');
    3132        }
    3233    }
Note: See TracChangeset for help on using the changeset viewer.