Plugin Directory

Changeset 3181696


Ignore:
Timestamp:
11/04/2024 05:37:15 PM (17 months ago)
Author:
dillerapp
Message:

Resolve incorrect WP_User/Diller Member association on order completion via REST API, when called by an external automation process.
Fixes Javascript errors when applying coupons on checkout forms with multiple promo code fields.
Added VAT and stock unit type to all product lines in each transaction sent to Diller.
Fixes "Division by Zero" error when calculating dashboard points progress bar width.
Addressed deprecation warnings for parent in callables and dynamic properties.

Location:
diller-loyalty
Files:
1885 added
21 edited

Legend:

Unmodified
Added
Removed
  • diller-loyalty/trunk/README.txt

    r3122103 r3181696  
    44Requires at least: 4.7
    55Tested up to: 6.6.0
    6 Version: 2.4.2
    7 Stable tag: 2.4.2
     6Version: 2.4.5
     7Stable tag: 2.4.5
    88Requires PHP: 7.3
    99WC requires at least: 3.8.0
     
    6363
    6464== Changelog ==
     65= 2.4.5 =
     66* Resolve incorrect WP_User/Diller Member association on order completion via REST API, when called by an external automation process.
     67* Fixed Javascript errors when applying coupons on checkout forms with multiple promo code fields.
     68* Added VAT and stock unit type to all product lines in each transaction sent to Diller.
     69* Fixed "Division by Zero" error when calculating dashboard points progress bar width.
     70* Addressed deprecation warnings for `parent` in callables and dynamic properties.
     71
    6572= 2.4.2 =
    6673* Fixes bug when reserving coupons or creating refunds for orders with products without categories.
  • diller-loyalty/trunk/admin/class-diller-loyalty-admin.php

    r3043067 r3181696  
    176176
    177177                        // On activation, set this temporary flag to true, so that we flush rewrite rules for our custom endpoints just once
    178                         set_transient( 'diller_flush_rewrite_rules', 'Yes', 60 );
     178                        set_transient( 'diller_flush_rewrite_rules', 'Yes', 120 );
    179179
    180180                        DillerLoyalty()->maybe_create_or_update_enrollment_page();
  • diller-loyalty/trunk/assets/js/diller-loyalty-public-bundle.js

    r3121966 r3181696  
    642642        $couponElem.prop("disabled", true);
    643643
    644         const coupon = $couponElem.data("diller-coupon").toLowerCase();
     644        // Note 2 self: ensure .toString() is called before .toLowerCase() for numeric values
     645        const coupon = $couponElem.data("diller-coupon").toString().toLowerCase();
    645646        const action = $couponElem.data("diller-action");
    646647
  • diller-loyalty/trunk/diller-loyalty.php

    r3122103 r3181696  
    66 * Plugin URI:           https://diller.no/
    77 * Description:          Diller is a loyalty platform for businesses that is easy, affordable and profitable and integrates seamlessly with your WooCommerce shop.
    8  * Version:              2.4.2
     8 * Version:              2.4.5
    99 * Author:               Diller AS
    1010 * Author URI:           https://diller.no/kontakt/
     
    1313 * Text Domain:          diller-loyalty
    1414 * Domain Path:          /languages
    15  * Stable tag:           2.4.2
     15 * Stable tag:           2.4.5
    1616 * Requires at least:    4.7
    17  * Tested up to:         6.1.0
     17 * Tested up to:         6.6.2
    1818 * Requires PHP:         7.3
    1919 * WC requires at least: 3.8.0
    20  * WC tested up to:      7.0.1
     20 * WC tested up to:      7.9.0
    2121 *
    2222 */
     
    3131// Start at version 2.0.0 and use SemVer - https://semver.org
    3232if ( ! defined( 'DILLER_LOYALTY_VERSION' ) ) {
    33     define('DILLER_LOYALTY_VERSION', '2.4.2');
     33    define('DILLER_LOYALTY_VERSION', '2.4.5');
    3434}
    3535
  • diller-loyalty/trunk/includes/class-diller-loyalty-api.php

    r3121966 r3181696  
    10071007
    10081008    public function save_follower_transactions(Diller_Loyalty_Follower $follower, WC_Order $order){
     1009        // Hint: Refer to "get_order()" in src/wp-content/plugins/woocommerce/includes/legacy/api/v3/class-wc-api-orders.php for the order object structure
    10091010        $coupon_codes = $order->get_coupon_codes();
    1010         $transaction_total_amount = (float) $order->get_total() - (float) $order->get_total_refunded();
     1011        $transaction_total_amount = $order->get_total() - (float) $order->get_total_refunded();
    10111012        $transaction_net_amount = $transaction_total_amount - $order->get_total_tax() - $order->get_total_tax_refunded();
    10121013        $created_date = get_gmt_from_date($order->get_date_created(),'Y-m-d');
     
    10141015        $product_details = array();
    10151016
     1017        if ( false === $order->get_prices_include_tax() ) {
     1018            $transaction_net_amount = $transaction_total_amount -= $order->get_total_tax();
     1019        }
     1020
     1021        $temp = [];
     1022
    10161023        foreach( $order->get_items(array("line_item", "shipping", "fee")) as $item_id => $item_data ) {
    1017             // Get item subtotal - this is the cost before discount.
    1018             $item_price = (float) $order->get_item_subtotal( $item_data );
     1024            // Get item subtotal - this is the cost before discount, with VAT.
     1025            $item_price_with_tax = $order->get_item_subtotal($item_data, true);
    10191026            $line_total_tax = $item_data->get_total_tax();
    10201027            $line_total = $item_data->get_total();
     1028            $line_total_with_taxes = $order->get_line_total( $item_data, true );
    10211029            $original_qty = $item_data->get_quantity();
    10221030            $refunded_qty = $order->get_qty_refunded_for_item( $item_id );
     
    10251033            $vat_percentage = (float) round($line_total_tax > 0 ? (( $line_total_tax / $line_total ) * 100) : 0);
    10261034            $product_discount_amount = 0;
     1035            $refunded_tax_amount = 0;
     1036
     1037            foreach ($order->get_taxes() as $tax_item ) {
     1038                $refunded_tax_amount += $order->get_tax_refunded_for_item($item_id, $tax_item->get_rate_id());
     1039            }
    10271040
    10281041            if( ($refunded_qty * -1) === $original_qty ){
     
    10461059                    'product_name'            => $product->get_name(),
    10471060                    'product_category_id'     => $product_category,
    1048                     'product_qty'             => $original_qty + $refunded_qty,
    1049                     'product_price'           => $item_price,
    1050                     'product_total_price'     => $line_total - $refunded_amount,
     1061                    'product_qty'             => $original_qty + $refunded_qty, // Refunded qty is negative
     1062                    'product_price'           => $item_price_with_tax,
     1063                    'product_total_price'     => $line_total_with_taxes - $refunded_amount - $refunded_tax_amount,
    10511064                    'product_discount_amount' => $product_discount_amount,
    10521065                    'vat_percentage'          => $vat_percentage,
     1066                    'unit_type'               => get_post_meta( $product->get_id(), '_unit', true )
    10531067                );
    10541068
     
    10771091            "VAT_total_amount"                  => $order->get_total_tax(),
    10781092            "NET_total_amount"                  => $transaction_net_amount,
    1079             "employee_name"                     => is_user_logged_in() && is_admin() ? sprintf( "%s (%s)", wp_get_current_user()->display_name, wp_get_current_user()->user_email ) : "",
     1093            "employee_name"                     => $this->get_current_employee_name(),
    10801094            "transaction_total_discount_amount" => (float) $order->get_discount_total(),
    10811095            "payment_method"                    => $order->get_payment_method_title(),
     
    11211135    public function refund_order_transaction(Diller_Loyalty_Follower $follower, WC_Order_Refund $refund){
    11221136        $order = new WC_Order($refund->get_parent_id());
    1123         $store_user_name = is_user_logged_in() && is_admin()
    1124             ? sprintf( "%s (%s)", wp_get_current_user()->display_name, wp_get_current_user()->user_email )
    1125             : "";
    1126 
    11271137        $refund_total_amount = (float) $refund->get_amount() * - 1;
    11281138        $vat_total_amount = $refund->get_total_tax();
     
    11321142        // Loop through the order refund line items
    11331143        foreach( $refund->get_items(array("line_item", "shipping", "fee")) as $item ){
    1134             $refunded_quantity = (float) $item->get_quantity(); // Quantity: zero or negative integer
    1135             $item_price        = -1 * (float) $order->get_item_subtotal( $item );
    1136             $line_total        = (float) $item->get_total();
    1137             $line_total_tax    = (float) $item->get_total_tax();
    1138             $vat_percentage    = (float) ( $line_total_tax / $line_total ) * 100;
     1144            $refunded_quantity   = (float) $item->get_quantity(); // Quantity: zero or negative integer
     1145            $item_price          = - 1 * $order->get_item_subtotal( $item, true );
     1146            $line_total          = $order->get_line_total($item);
     1147            $line_total_tax      = (float) $item->get_total_tax();
     1148            $vat_percentage      = round(abs($line_total_tax) > 0 ? (abs($line_total_tax) * 100) / abs($line_total) : 0);
    11391149
    11401150            if($item->get_type() === "line_item"){
     
    11531163                    'product_total_price' => $line_total,
    11541164                    'vat_percentage'      => $vat_percentage,
    1155                     'unit_type'           => get_post_meta( $product->get_id(), '_unit', true ), 
     1165                    'unit_type'           => get_post_meta( $product->get_id(), '_unit', true ),
    11561166                );
    11571167
     
    11861196                "VAT_total_amount"         => $vat_total_amount,
    11871197                "NET_total_amount"         => $refund_total_amount - $vat_total_amount,
    1188                 "employee_name"            => $store_user_name,
     1198                "employee_name"            => $this->get_current_employee_name(),
    11891199                "payment_method"           => $this->try_get_order_refund_method( $order ),
    11901200                "currency"                 => $refund->get_currency(),
     
    13931403        return 'Refund: Manual';
    13941404    }
     1405
     1406    /**
     1407     * The function returns a formatted string containing the user's display name
     1408     * and email address, or an empty string if no valid user is found.
     1409     *
     1410     * @return string Formatted string "Display Name (email@example.com)" or empty string if no user found.
     1411     *
     1412     * @since 2.4.5
     1413     * @access private
     1414     *
     1415     * @uses DillerLoyalty::get_current_admin_user() To get the current admin WP_User object.
     1416     */
     1417    private function get_current_employee_name() {
     1418        if(!($admin_user = DillerLoyalty()->is_admin_context() ? wp_get_current_user() : null)){
     1419            return "";
     1420        }
     1421        return sprintf( "%s (%s)", $admin_user->display_name, $admin_user->user_email );
     1422    }
    13951423}
  • diller-loyalty/trunk/includes/class-diller-loyalty-hooks.php

    r3121966 r3181696  
    178178     * @return void True if the operation was successful, false otherwise
    179179     *
    180      * @since 2.4.1
     180     * @since 2.4.2
    181181     */
    182182    private function extract_phone_from_billing_or_login_details( WP_User $current_user ): void {
  • diller-loyalty/trunk/includes/class-diller-loyalty-logger.php

    r3043067 r3181696  
    6363        global $wp_version;
    6464
     65        $admin_user = DillerLoyalty()->is_admin_context() ? wp_get_current_user() : null;
     66
    6567        $log_message  = $message . PHP_EOL;
    6668        $log_message .= sprintf("WP Version: %s | WC Version: %s | PHP Version: %s | Diller Version: %s ", $wp_version, Diller_Loyalty_Helpers::get_wc_version(), phpversion(), DILLER_LOYALTY_VERSION);
     
    6971        // Check if a specific Follower instance was provided, otherwise default to current follower logged in
    7072        $follower = current(array_filter($args, function($arg) { return is_a($arg, "Diller_Loyalty_Follower"); }));
    71         if($follower === false && !is_admin()){
     73
     74        if($follower === false && $admin_user === null){
    7275            $follower = DillerLoyalty()->get_current_follower();
    7376        }
     
    8184        }
    8285
    83         // If backoffice, log which admin user as performed the action we're logging
    84         if(is_admin() && ($admin_user = wp_get_current_user()) && $admin_user->exists()) {
    85             $log_message .= PHP_EOL . 'Action performed by admin user: ' . $admin_user->display_name . ' (' . $admin_user->user_email . ') | Roles: ' . join(", ", array_values((array)$admin_user->roles));
     86        // If backoffice or API, log which admin user as performed the action we're logging
     87        if($admin_user) {
     88            $log_message .= PHP_EOL . 'Action performed';
     89
     90            // Check if the current request was made via API.
     91            $log_message .= (defined('REST_REQUEST') && REST_REQUEST)
     92                ? ' via REST API '
     93                : ' via Admin Dashboard ';
     94
     95            $log_message .= 'by admin user: ' . $admin_user->display_name . ' (' . $admin_user->user_email . ') | Roles: ' . join(", ", array_values((array)$admin_user->roles));
    8696        }
    8797
     
    157167     * Logs an info message to the log.
    158168     *
    159      * @param $message  string The message to log
     169     * @param string $message The message to log
    160170     * @param mixed $args   Optional multiple argument list relevant for logging purposes
    161171     *
     
    169179     * Logs an error to the error log.
    170180     *
    171      * @param $message  The message to log
     181     * @param string $message  The message to log
    172182     * @param mixed $args   Optional multiple argument list relevant for logging purposes
    173183     *
  • diller-loyalty/trunk/includes/class-diller-loyalty-store.php

    r3043067 r3181696  
    66    protected $store_pin;
    77    protected $store_id;
    8     protected $store_dimensions;
     8    protected $new_membership_progressbar_enabled = false;
    99    protected $store_data = array();
    1010    protected $store_styles = array();
  • diller-loyalty/trunk/includes/class-diller-loyalty-woocommerce.php

    r3121966 r3181696  
    2929
    3030        // We create a transient to control how we call flush_rewrite_rules(), as this is a costly operation.
    31         // flush_rewrite_rules() will run only once per each time the store is authenticated.
     31        // flush_rewrite_rules() will run only once per each time the store is (re)connected.
    3232        if(get_transient( 'diller_flush_rewrite_rules' )) {
     33            flush_rewrite_rules();
     34            DillerLoyalty()->get_logger()->info(sprintf("Transient diller_flush_rewrite_rules = Yes. Called flush_rewrite_rules(). Function: %s().", __FUNCTION__));
    3335            delete_transient( 'diller_flush_rewrite_rules' );
    34             flush_rewrite_rules();
    3536        }
    3637    }
     
    857858    function my_account_orders_display_earned_points_column($order) {
    858859        if(DillerLoyalty()->get_store()->get_point_system_enabled() && DillerLoyalty()->user_has_joined()):
    859             if($order && is_a($order, 'WC_Order')):
    860                 $follower = DillerLoyalty()->get_current_follower();
    861                 $result_points = DillerLoyalty()->get_api()->get_earned_points_for_order($follower, $order->get_id());
    862                 if(is_wp_error($result_points)){
    863                     DillerLoyalty()->get_logger()->error(sprintf("Could not get points for order# %s. Function: %s()", $order->get_id(), __FUNCTION__), $follower, $result_points);
    864                 }
    865                 echo (!is_wp_error($result_points) && !in_array($order->get_status(), array("cancelled", "refunded")) ? $result_points : '0') . ' ' . esc_html__('points','diller-loyalty');
    866             endif;
     860            echo !in_array($order->get_status(), array("cancelled", "refunded")) ? $this->get_order_points($order) : '0';
    867861        endif;
    868862    }
     
    870864    function update_order_received_text($thank_you_text, $order) {
    871865        // We only display points for customers that joined LP and gave consent to save transactions
    872         if(! ($follower = DillerLoyalty()->get_follower_by_order($order)) || !DillerLoyalty()->get_store()->get_point_system_enabled()){
    873             return;
    874         }
    875 
    876         if($follower->get_membership_consent_accepted() !== 'Yes' || $follower->get_purchase_history_consent_accepted() !== 'Yes') return $thank_you_text;
    877 
     866        if(!($follower = DillerLoyalty()->get_follower_by_order($order)) || !DillerLoyalty()->get_store()->get_point_system_enabled()){
     867            return $thank_you_text;
     868        }
     869
     870        if($follower->get_membership_consent_accepted() !== 'Yes' || $follower->get_purchase_history_consent_accepted() !== 'Yes') {
     871            return $thank_you_text;
     872        }
    878873
    879874        $total_points = $this->get_order_points($order);
     
    12261221        if( !($order = ( $order instanceof WC_Order ) ? $order : new WC_Order($order)) ) return null;
    12271222
     1223        // Check if the current request was made via API or is_admin() dashboard
     1224        $is_admin_context = DillerLoyalty()->is_admin_context();
     1225
    12281226        // Handle normal scenario, for registered and logged-in Customer that has already enrolled LP before
    1229         if(!is_admin() && DillerLoyalty()->user_has_joined()) return DillerLoyalty()->get_current_follower();
     1227        if(!$is_admin_context && DillerLoyalty()->user_has_joined()) return DillerLoyalty()->get_current_follower();
    12301228
    12311229        $user_email        = $order->get_billing_email();
     
    17301728            $order_total = get_post_meta($order->get_id(), '_order_total', true);
    17311729            $currency_to_points_ratio = DillerLoyalty()->get_store()->get_currency_to_points_ratio();
    1732             $total_points = ($order_total * $currency_to_points_ratio);
     1730            $total_points = max((float)$order_total * $currency_to_points_ratio, 0);
    17331731        }
    17341732        return $total_points;
     
    18231821     * @return void
    18241822     */
    1825     private function render_classic_membership_level_bar($membership_levels, $follower) {
    1826         ?>
     1823    private function render_classic_membership_level_bar($membership_levels, $follower) {
     1824        ?>
    18271825        <div class="diller-membership-progress" style="margin: 25px 0;">
    1828             <?php
    1829                 $progress_bar_points_html = $progress_bar_labels_html = '';
     1826            <?php
     1827                $progress_bar_points_html = $progress_bar_labels_html = '';
    18301828                $max_membership_level =  end($membership_levels);
    1831                 $follower_current_percent =  min($follower->get_total_earned_points() * 100 / $max_membership_level->get_points(), 100);
     1829                $max_membership_level_points =  max($max_membership_level->get_points(), 1);
     1830                $follower_current_percent =  min($follower->get_total_earned_points() * 100 / $max_membership_level_points, 100);
    18321831                reset($membership_levels);
    18331832
    1834                 foreach ($membership_levels as $key => $membership_level):
    1835                     $level_percent = min($membership_level->get_points() * 100 / $max_membership_level->get_points(), 100);
     1833                foreach ($membership_levels as $membership_level):
     1834                    $level_percent = min($membership_level->get_points() * 100 / $max_membership_level_points, 100);
    18361835                    $style = (sizeof($membership_levels) > 1) ? "left:{$level_percent}%; " : "transform: translate(10px, 10px); left:{$level_percent}%; ";
    18371836
     
    18401839                endforeach;
    18411840
    1842                 ?>
     1841            ?>
    18431842            <div class="diller-membership-progress-points"><?php echo $progress_bar_points_html; ?></div>
    18441843            <div class="diller-membership-progress-bar">
     
    18471846            <div class="diller-membership-progress-points"><?php echo $progress_bar_labels_html; ?></div>
    18481847        </div>
    1849         <?php
    1850     }
     1848        <?php
     1849    }
    18511850
    18521851    /**
  • diller-loyalty/trunk/includes/class-diller-loyalty.php

    r3121966 r3181696  
    445445
    446446        // My Account Page
    447         $actions[] = array( 'hook' => 'init', 'callback' => 'my_account_page_custom_endpoints', 'priority' => 10, 'accepted_args' => 1 );
     447       
     448        $actions[] = array( 'hook' => 'init', 'callback' => 'my_account_page_custom_endpoints', 'priority' => 99, 'accepted_args' => 1 );
    448449        $actions[] = array( 'hook' => 'woocommerce_account_dashboard', 'callback' => 'my_account_customize_dashboard', 'priority' => 10, 'accepted_args' => 0 );
    449450        $filters[] = array( 'hook' => 'woocommerce_account_menu_items', 'callback' => 'my_account_add_menu_items', 'priority' => 10, 'accepted_args' => 1 );
     
    880881    }
    881882
     883    /**
     884     * Determines if the current request is in an admin context,
     885     * by checking beyond the <code>is_admin()</code> helper.
     886     *
     887     * This function checks for three scenarios:
     888     * 1. The request is for an admin page <code>is_admin()</code> .
     889     * 2. The request is an API call made with admin or shop manager capabilities.
     890     * 3. The request is neither an admin page nor a valid API call with sufficient permissions.
     891     *
     892     * @since 2.4.5
     893     * @access public
     894     *
     895     * @return bool True if in an admin context, false otherwise.
     896     */
     897    public function is_admin_context() {
     898        // Check if we're on dashboard admin page
     899        if (is_admin()) {
     900            return true;
     901        }
     902
     903        // Check if the current request was made via API.
     904        // REST_REQUEST constant is defined in wp-includes/rest-api.php
     905        // For API requests, wp_get_current_user() returns the WP_User associated with the API key.
     906        $is_api_request = defined('REST_REQUEST') && REST_REQUEST;
     907
     908        if ($is_api_request) {
     909            $admin_user = wp_get_current_user();
     910            if ($admin_user && $admin_user->exists()) {
     911                // Check if the user has WooCommerce management or general admin capabilities.
     912                // Using has_cap() is preferred over checking role names as it's more flexible
     913                // and works with custom roles that might have similar capabilities.
     914                return ($admin_user->has_cap('manage_woocommerce') || $admin_user->has_cap('manage_options'));
     915            }
     916        }
     917
     918        // If none of the above conditions are met, we're not in an admin context
     919        return false;
     920    }
     921
    882922    public function is_network_admin() {
    883923        return is_multisite() && is_network_admin();
     
    885925
    886926    /**
    887      * Returns if the a given WP_User has joined the Loyalty Program or not, by reading the respective meta key value.
     927     * Returns if a given WP_User has joined the Loyalty Program or not, by reading the respective meta key value.
    888928     * If a $wp_user_id is provided it will check for the WP User with the given id other it will check for the current logged-in user.
    889929     * If $force_verification is set to true, it will check it through the API remotely
     
    899939
    900940        if(!$user->exists() || !metadata_exists( 'user', $user->ID, DillerLoyalty()->get_follower_meta_key())) return false;
     941
     942       
     943        // If the user has Woocommerce management or general admin capabilities, we assume is an admin and return
     944        if($user->has_cap('manage_woocommerce') || $user->has_cap('manage_options')){
     945            return false;
     946        }
    901947
    902948        $force_refresh |= $user->ID !== get_current_user_id();
  • diller-loyalty/trunk/includes/forms/fields/class-diller-base-field.php

    r3043067 r3181696  
    1616     */
    1717    public $value;
     18
     19    /**
     20     * Current field values (if multiple).
     21     *
     22     * @var mixed
     23     */
     24    public $values;
    1825
    1926    /**
  • diller-loyalty/trunk/includes/forms/fields/class-diller-checkbox-field.php

    r3043067 r3181696  
    1414    public function __construct() {
    1515        $args = func_get_args();
    16         call_user_func_array( array( 'parent', '__construct' ), $args );
     16        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1717    }
    1818
  • diller-loyalty/trunk/includes/forms/fields/class-diller-checkbox-multi.php

    r3043067 r3181696  
    1414    public function __construct() {
    1515        $args = func_get_args();
    16         call_user_func_array( array( 'parent', '__construct' ), $args );
     16        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1717    }
    1818
  • diller-loyalty/trunk/includes/forms/fields/class-diller-email-field.php

    r3043067 r3181696  
    1313    public function __construct() {
    1414        $args = func_get_args();
    15         call_user_func_array( array( 'parent', '__construct' ), $args );
     15        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1616    }
    1717
  • diller-loyalty/trunk/includes/forms/fields/class-diller-hidden-field.php

    r3043067 r3181696  
    1414    public function __construct() {
    1515        $args = func_get_args();
    16         call_user_func_array( array( 'parent', '__construct' ), $args );
     16        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1717    }
    1818
  • diller-loyalty/trunk/includes/forms/fields/class-diller-number-field.php

    r3043067 r3181696  
    1414    public function __construct() {
    1515        $args = func_get_args();
    16         call_user_func_array( array( 'parent', '__construct' ), $args );
     16        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1717    }
    1818
  • diller-loyalty/trunk/includes/forms/fields/class-diller-phone-field.php

    r3043067 r3181696  
    1313    public function __construct() {
    1414        $args = func_get_args();
    15         call_user_func_array( array( 'parent', '__construct' ), $args );
     15        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1616    }
    1717
  • diller-loyalty/trunk/includes/forms/fields/class-diller-radio-field.php

    r3043067 r3181696  
    1313    public function __construct() {
    1414        $args = func_get_args();
    15         call_user_func_array( array( 'parent', '__construct' ), $args );
     15        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    1616    }
    1717
  • diller-loyalty/trunk/includes/forms/fields/class-diller-recaptcha-field.php

    r3043067 r3181696  
    2121    public function __construct() {
    2222        $args = func_get_args();
    23         call_user_func_array( array( 'parent', '__construct' ), $args );
     23        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    2424
    2525       $this->recaptcha_site_key = DillerLoyalty()->get_store()->get_google_recaptcha_site_key();
  • diller-loyalty/trunk/includes/forms/fields/class-diller-select-field.php

    r3043067 r3181696  
    1919    public function __construct() {
    2020        $args = func_get_args();
    21         call_user_func_array( array( 'parent', '__construct' ), $args );
     21        call_user_func_array( array( Diller_Base_Field::class, '__construct' ), $args );
    2222    }
    2323
  • diller-loyalty/trunk/includes/webhooks/class-diller-rest-endpoints.php

    r3121966 r3181696  
    5050    }
    5151
     52    /**
     53     * Registers the Diller Loyalty plugin Public REST endpoints
     54     *
     55     * Important: By default, the REST API is active on your WordPress site, but if any of these endpoints return 401 Unauthorized,
     56     * it means the REST API might be disabled on your site by either some plugin like Wordfence, Sucuri, Cloudflare, Disable REST API, etc..
     57     * or in functions.php file.
     58     *
     59     * To check if the REST API is reachable, visit this URL https://your-website.com/wp-json.
     60     * If you get a message similar to this one:
     61     * <code>{"code":"rest_cannot_access","message":"DRA: Only authenticated users can access the REST API.","data":{"status":401}}</code>
     62     * that means the REST API is disabled.
     63     *
     64     * @since 2.0.0
     65     *
     66     * @return void
     67     */
    5268    public function register_diller_wordpress_rest_endpoints() {
    5369
     
    173189        $phone_number = $request->get_param("phone_number");
    174190        $data = array( "consentAccepted" => false, "validEmail" => false, "token" => "", "next" => "otp" );
    175         $message = esc_html__( "Phone number is available.", 'diller-loyalty' );
    176191        $wp_user = false;
    177192
Note: See TracChangeset for help on using the changeset viewer.