Plugin Directory

Changeset 2886810


Ignore:
Timestamp:
03/25/2023 11:19:52 AM (3 years ago)
Author:
redmonkey73
Message:

added new fields for customizing the widget, more details here https://github.com/evgrezanov/bonus-plus-wp/issues/22

Location:
bonus-plus-wp
Files:
39 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • bonus-plus-wp/trunk/bonus-plus-wp.php

    r2627045 r2886810  
    55 * Description: Интеграция WooCommerce и БонусПлюс. Для отображения данных пользователя используйте шорткод [bpwp_api_customer_bonus_card]
    66 * Author: redmonkey73
    7  * Author URI: http://evgeniyrezanov.site
     7 * Author URI: https://github.com/evgrezanov/
    88 * Developer: redmonkey73
    9  * Developer URI: http://evgeniyrezanov.site
     9 * Developer URI: https://github.com/evgrezanov/
    1010 * Text Domain: wp-bonus-plus
    1111 * Domain Path: /languages
     
    1414 * PHP requires at least: 7.0
    1515 * WP requires at least: 5.0
    16  * Tested up to: 5.8
    17  * Version: 2.2
     16 * Tested up to: 6.1.1
     17 * Version: 2.4
    1818 */
    1919namespace BPWP;
     
    2828    public static function init()
    2929    {
    30         define('BPWP_PLUGIN_VERSION', '2.1');
     30        define('BPWP_PLUGIN_VERSION', '2.4');
    3131
    3232        require_once __DIR__ . '/functions.php';
  • bonus-plus-wp/trunk/inc/ClientProfile.php

    r2627045 r2886810  
    6767     *  Prepare customer data for display bonus card
    6868     *
    69      *  @return array
     69     *  @return array of properties of bonus cart
    7070     */
    7171    public static function bpwp_api_prepare_customer_bonuses_data($customer_id = '')
     
    9191
    9292        } else {
     93
    9394            // Если пользователь авторизован
    9495            $data = bpwp_api_get_customer_data();
     
    129130            $url = apply_filters('bpwp_filter_goto_shop_url', $url);
    130131
    131             // Возвращаем массив для бонусной карты
    132             $data['title']  =   sprintf('%s %s', $allBonuses, __('бонусных рублей', 'bonus-plus-wp'));
     132            // Возвращаем массив для данных для виджета бонусной карты
     133            $data['title']  =   sprintf('%s %s', $allBonuses, __('бонусных ', 'bonus-plus-wp'));
    133134            $data['url']    =   $url;
    134135            $data['desc']   =   $desc;
    135136            $data['class']  =   'card3';
     137
     138            // Проверим заполнены ли у порльзователя дата рождения и телефон
     139            $user_id = get_current_user_id();
     140            $billing_birth_date = get_user_meta( $user_id, 'billing_birth_date', true );
     141            $billing_phone = get_user_meta(get_current_user_id(), 'billing_phone', true);
     142            $bonus_plus = get_user_meta(get_current_user_id(), 'bonus-plus', true);
     143           
     144            if ( empty( $billing_birth_date ) || empty($billing_phone) ) {
     145                $data['title']  =   __('ОШИБКА!', 'bonus-plus-wp');
     146                $data['url']    =   get_option('bpwp_uri_customers_lk_billing_address');
     147                $data['desc']   =   'Добавьте дату рождения и/или номер телефона в личном кабинете';
     148                $data['class']  =   'card3';
     149                // или данные из Бонус+ пустые
     150            } elseif (empty($bonus_plus)){
     151                $data['title']  =   __('ОШИБКА!', 'bonus-plus-wp');
     152                $data['url']    =   get_option('bpwp_msg_customers_not_verify_phone_number');
     153                $data['desc']   =   'Подтвердите номер телефона чтобы получать бонусы -->';
     154                $data['class']  =   'card3';
     155                // во всех остальных случаях
     156            } else {
     157                $data['title']  =   sprintf('%s %s', $allBonuses, __('бонусных ₽', 'bonus-plus-wp'));
     158                $data['url']    =   $url;
     159                $data['desc']   =   $desc;
     160                $data['class']  =   'card3';
     161            }
    136162
    137163        }
  • bonus-plus-wp/trunk/inc/MenuSettings.php

    r2576578 r2886810  
    161161        add_settings_field(
    162162            $id = 'bpwp_msg_know_customers',
    163             $title = __('Идентифицированные пользователи', 'bonus-plus-wp'),
     163            $title = __('Текст для Идентифицированных пользователей', 'bonus-plus-wp'),
    164164            $callback = array(__CLASS__, 'display_msg_know_customers'),
    165165            $page = 'bpwp-settings',
     
    170170        add_settings_field(
    171171            $id = 'bpwp_msg_unknow_customers',
    172             $title = __('Неопознанные пользователи', 'bonus-plus-wp'),
     172            $title = __('Текст для неопознанных пользователей', 'bonus-plus-wp'),
    173173            $callback = array(__CLASS__, 'display_msg_unknow_customers'),
    174174            $page = 'bpwp-settings',
    175175            $section = 'bpwp_section_front_msgs'
    176176        );
     177
     178        register_setting('bpwp-settings', 'bpwp_msg_customers_not_verify_phone_number');
     179        add_settings_field(
     180            $id = 'bpwp_msg_customers_not_verify_phone_number',
     181            $title = __('Ссылка для пользователей не верифицировавших номер телефона', 'bonus-plus-wp'),
     182            $callback = array(__CLASS__, 'display_msg_customers_not_verify_phone_number'),
     183            $page = 'bpwp-settings',
     184            $section = 'bpwp_section_front_msgs'
     185        );
     186
     187        register_setting('bpwp-settings', 'bpwp_uri_customers_lk_billing_address');
     188        add_settings_field(
     189            $id = 'bpwp_uri_customers_lk_billing_address',
     190            $title = __('Ссылка для добавления телефона и даты рождения в ЛК', 'bonus-plus-wp'),
     191            $callback = array(__CLASS__, 'display_uri_customers_lk_billing_address'),
     192            $page = 'bpwp-settings',
     193            $section = 'bpwp_section_front_msgs'
     194        );       
    177195
    178196        register_setting('bpwp-settings', 'bpwp_uri_know_customers');
     
    233251    }
    234252
     253    /**
     254     * display_msg_customers_not_verify_phone_number
     255     *
     256     *  @return mixed
     257     */
     258    public static function display_msg_customers_not_verify_phone_number()
     259    {
     260        printf(
     261            '<input class="regular-text" type="text" name="bpwp_msg_customers_not_verify_phone_number" value="%s"/>',
     262            esc_attr(get_option('bpwp_msg_customers_not_verify_phone_number'))
     263        );
     264
     265        printf(
     266            '<p><small>%s</small></p>',
     267            esc_html(__('Отобразится для пользователя который не верифицировал номер телефона в профиле', 'bonus-plus-wp')),
     268        );
     269    }
     270
     271    /**
     272     * display_uri_customers_lk_billing_address
     273     *
     274     * @return mixed
     275     */
     276    public static function display_uri_customers_lk_billing_address()
     277    {
     278        printf(
     279            '<input class="regular-text" type="text" name="bpwp_uri_customers_lk_billing_address" value="%s"/>',
     280            esc_attr(get_option('bpwp_uri_customers_lk_billing_address'))
     281        );
     282
     283        printf(
     284            '<p><small>%s</small></p>',
     285            esc_html(__('Ссылка для заполнения биллинг адреса в ЛК пользователя', 'bonus-plus-wp')),
     286        );
     287    }
     288   
    235289    /**
    236290     * display_uri_know_customers
  • bonus-plus-wp/trunk/readme.txt

    r2627045 r2886810  
    44Tags: bonus, woocommerce, sync, integration
    55Requires at least: 4.0
    6 Tested up to: 5.8
    7 Stable tag: 2.2
     6Tested up to: 6.1.1
     7Stable tag: 2.4
    88Requires PHP: 7.1
    99License: GPLv2 or later
     
    9393== Changelog ==
    9494
     95= 2.4 =
     96- добавлены настройки для вывода различного текста и ссылок для различных типов пользователей
     97
    9598= 2.1 =
    9699- clear client meta after login
Note: See TracChangeset for help on using the changeset viewer.