Plugin Directory

Changeset 3308520


Ignore:
Timestamp:
06/09/2025 01:04:28 PM (10 months ago)
Author:
mlmsoft
Message:

Version 3.9.4

Location:
mlm-soft-integration/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • mlm-soft-integration/trunk/CHANGELOG.md

    r3308199 r3308520  
    22
    33## Changelog ##
     4
     5## 2025-06-08 - version 3.9.4
     6* Updated `EWalletCouponFrontend` class. See an issue [MLM-3029] [EWalletCouponFrontend.php]
     7* Block login for user blocked in NRM [MLM-3033]. [MLMSoftRemoteUser.php]
     8* Updated translations.
    49
    510## 2025-06-04 - version 3.9.3
  • mlm-soft-integration/trunk/core/models/user/MLMSoftRemoteUser.php

    r3114866 r3308520  
    1111class MLMSoftRemoteUser
    1212{
     13    /**
     14     * @since 3.9.4
     15     */
     16    const ACTIVE_ACCOUNT   = 1;
     17    const DISABLED_ACCOUNT = 2;
     18    const DELETED_ACCOUNT  = 3;
     19   
    1320    /**
    1421     * @var array
     
    5663    }
    5764
     65    /**
     66     * @since 3.9.4
     67     */
     68    private static function getAccountStatusId($login, $mlmSoftPlugin = false): bool | int
     69    {
     70        global $wpdb;
     71
     72        if ( ! $mlmSoftPlugin ) {
     73            $mlmSoftPlugin = MLMSoftPlugin::getInstance();
     74        }
     75       
     76        $metaKey = MLMSoftLocalUser::ACCOUNT_ID_META_KEY;
     77       
     78        $prefix = $wpdb->prefix;
     79        $query  = $wpdb->prepare("SELECT {$prefix}usermeta.meta_value FROM {$prefix}users
     80                INNER JOIN {$prefix}usermeta ON ( {$prefix}users.ID = {$prefix}usermeta.user_id )
     81                WHERE 1=1 AND ( {$prefix}usermeta.meta_key = %s ) AND
     82                (user_login LIKE %s OR user_email LIKE %s)",
     83                $metaKey,
     84                $login,
     85                $login
     86            );
     87       
     88        $accountId = $wpdb->get_col($query);
     89
     90        $accountStatusId = false;   
     91        if ( ! empty($accountId) && isset($accountId[0]) && (int) $accountId[0] > 0 ) {
     92           
     93            $accountId = $accountId[0];
     94            $accountStatus = $mlmSoftPlugin->api3->get("account/$accountId/profile/account_status_id");
     95            if ( isset($accountStatus['value'], $accountStatus['value']['raw']) ) {
     96                $accountStatusId = (int) $accountStatus['value']['raw'];
     97            }
     98        }
     99       
     100        return $accountStatusId;
     101    }
     102   
    58103    public static function loadByLoginAndPass($login, $password)
    59104    {
     105        global $wpdb;
     106       
    60107        $mlmSoftPlugin = MLMSoftPlugin::getInstance();
    61108        try {
     
    66113            ]);
    67114        } catch (Exception $e) {
     115
     116            /**
     117             * @since 3.9.4
     118             */
     119            $accountStatusId = self::getAccountStatusId($login, $mlmSoftPlugin);
     120            if ($accountStatusId) {
     121                if ( in_array($accountStatusId, [self::DISABLED_ACCOUNT, self::DELETED_ACCOUNT]) ) {
     122                    $message =  MLMSoftPlugin::translate('Your account access is restricted. Please contact website administrator.');
     123                }
     124            }
     125
    68126            $errors = new WP_Error();
    69127           
     
    71129             * @since 3.6.5
    72130             */
    73             $message = $e->getMessage();
     131            $message = $message ?? $e->getMessage();
    74132            if ( $message === 'Login or password is incorrect' ) {
    75133                /**
  • mlm-soft-integration/trunk/integrations/woocommerce/paymentGateways/eWallet/coupons/EWalletCouponFrontend.php

    r3308199 r3308520  
    5151         */
    5252        add_action('post_row_actions', [$this, 'manageCouponActions'], 10, 2);
     53       
     54        /**
     55         * @since 3.9.4
     56         */
     57        add_action('admin_print_footer_scripts', [$this, 'printFooterScripts']);
    5358
    5459        $this->adminComponentLoader = new AdminComponentLoader();
     60    }
     61
     62    /**
     63     * @since 3.9.4
     64     */
     65    public function printFooterScripts()
     66    {
     67        global $post, $pagenow;
     68
     69        if ( ! in_array($pagenow, ['post.php']) ) {
     70            return;
     71        }
     72 
     73        if ($post->post_type !== $this->couponPostType) {
     74            return;
     75        }
     76 
     77        if ( ! EWalletCoupon::isEWalletCoupon($post->post_name) ) {
     78            /**
     79             * Coupon is not connected to the e-wallet.
     80             */
     81            return;
     82        }
     83
     84        $coupon = new WC_Coupon($post->post_name);
     85
     86        if ( $this->hasUserManageCouponRole() && $coupon->get_usage_count() < $coupon->get_usage_limit() ) {
     87            return;
     88        }
     89
     90        ?>
     91<script type='text/javascript'>
     92    /* <![CDATA[ */
     93    if ('function' === typeof jQuery) {
     94        let removeElems = ['#major-publishing-actions', '.edit-post-status', '.edit-visibility', '.edit-timestamp', '#free_shipping'];
     95        removeElems.map((elem)=>{jQuery(elem).remove()});
     96        let disableElems = ['#title','#discount_type','#coupon_amount','#expiry_date'];
     97        disableElems.map((elem)=>{jQuery(elem).attr('disabled',true).css({'color':'#000'})});
     98    }
     99    /* ]]> */
     100</script><?php   
     101   
    55102    }
    56103
  • mlm-soft-integration/trunk/languages/mlmsoft-integration-en_US.po

    r3257446 r3308520  
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2022-05-28 10:52+0000\n"
    6 "PO-Revision-Date: 2025-03-16 16:48+0700\n"
     6"PO-Revision-Date: 2025-06-05 19:49+0700\n"
    77"Last-Translator: \n"
    88"Language-Team: English (United States)\n"
     
    209209msgid "Discount"
    210210msgstr "E-Wallet"
     211
     212msgid ""
     213"Your account access is restricted. Please contact website administrator."
     214msgstr ""
     215"Your account access is restricted. Please contact website administrator."
  • mlm-soft-integration/trunk/languages/mlmsoft-integration-ru_RU.po

    r3257446 r3308520  
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2022-05-28 10:52+0000\n"
    6 "PO-Revision-Date: 2025-03-16 16:50+0700\n"
     6"PO-Revision-Date: 2025-06-05 19:50+0700\n"
    77"Last-Translator: \n"
    88"Language-Team: Русский\n"
     
    210210msgid "Discount"
    211211msgstr "E-Wallet"
     212
     213msgid ""
     214"Your account access is restricted. Please contact website administrator."
     215msgstr "Доступ к вашему аккаунту ограничен. Обратитесь к администратору сайта."
  • mlm-soft-integration/trunk/languages/mlmsoft-integration.pot

    r3257446 r3308520  
    207207msgid "Discount"
    208208msgstr ""
     209
     210msgid "Your account access is restricted. Please contact website administrator."
     211msgstr ""
  • mlm-soft-integration/trunk/mlm-soft-integration.php

    r3308199 r3308520  
    44Plugin Name: MLM Soft Integration
    55Description: WP integration with mlm-soft.com cloud platform
    6 Version: 3.9.3
     6Version: 3.9.4
    77Author: MLM Soft Ltd.
    88Author URI: https://mlm-soft.com
Note: See TracChangeset for help on using the changeset viewer.