Plugin Directory


Ignore:
Timestamp:
07/14/2023 11:32:47 AM (22 months ago)
Author:
webtoffee
Message:

2.4.2

  • [Fix] - Admin user details are updated when importing as shop manager.
  • [Add] - Export and Import the last activity data of users.
  • [Compatibility] - Tested OK with WooCommerce 7.8.2
Location:
users-customers-import-export-for-wp-woocommerce
Files:
197 added
8 edited

Legend:

Unmodified
Added
Removed
  • users-customers-import-export-for-wp-woocommerce/trunk/admin/css/wt-import-export-for-woo-admin.css

    r2884206 r2938705  
    306306  /* to enable "word-break: break-all" */
    307307  padding: 5px;
    308   word-break: break-all; /* 4. */
     308  word-break: normal; /* 4. */
    309309}
    310310
  • users-customers-import-export-for-wp-woocommerce/trunk/admin/modules/user/data/data-user-columns.php

    r2912763 r2938705  
    6868    $columns['shipping_state'] = 'shipping_state';
    6969    $columns['shipping_country'] = 'shipping_country';
     70    $columns['wc_last_active'] = 'wc_last_active';
    7071   
    7172endif;
  • users-customers-import-export-for-wp-woocommerce/trunk/admin/modules/user/data/data/data-wf-reserved-fields-pair.php

    r2912763 r2938705  
    6363    $columns['shipping_state'] = array('title'=>'Shipping state','description'=>'');
    6464    $columns['shipping_country'] = array('title'=>'Shipping country','description'=>'');
    65    
     65    $columns['wc_last_active'] =array('title'=>'Wc last active','description'=>'');
    6666endif;
    6767
  • users-customers-import-export-for-wp-woocommerce/trunk/admin/modules/user/export/export.php

    r2912763 r2938705  
    177177        global $wpdb;
    178178        $csv_columns = $this->parent_module->get_selected_column_names();
    179        
     179
    180180        $user = get_user_by('id', $id);
    181        
    182181        $customer_data = array();
     182
    183183        foreach ($csv_columns as $key => $value) {
    184184
     
    215215                continue;
    216216            }
     217            if( $key == 'last_update'){
     218                $date_in_timestamp = (!empty($user->{$key})) ? $user->{$key} : 0;
     219                $customer_data[$key] = date('Y-m-d H:i:s', $date_in_timestamp);
     220                continue;
     221            }
     222            if($key == 'wc_last_active'){
     223                $date_in_timestamp = (!empty($user->{$key})) ? $user->{$key} : 0;
     224                $customer_data[$key] = date('Y-m-d', $date_in_timestamp);
     225                continue;
     226            }
     227
    217228
    218229            $customer_data[$key] = isset($user->{$key}) ? maybe_serialize($user->{$key}) : '';
  • users-customers-import-export-for-wp-woocommerce/trunk/admin/modules/user/import/import.php

    r2846895 r2938705  
    1212    public $parent_module = null;
    1313    public $parsed_data = array();
     14    public $user_all_fields = array();
     15    public $user_base_fields = array();
     16    public $use_same_password = array();
     17    public $user_meta_fields = array();
     18    public $current_user = array();
    1419         
    1520   
     
    3338    public function __construct($parent_object) {
    3439
     40        $this->current_user = get_current_user_id();
    3541        $this->parent_module = $parent_object;
    3642        $this->user_all_fields = include plugin_dir_path( __FILE__).'../data/data-user-columns.php';
     
    127133     */     
    128134    public function parse_users( $data ) {
    129         
     135       
    130136        try{
    131137            $data = apply_filters('wt_user_importer_pre_parse_data', $data);
     
    222228
    223229            foreach ($this->user_meta_fields as $key => $value){
     230                if($key == 'wc_last_active' || $key == 'last_update'){
     231                    $date = isset( $item[$key] ) ? trim($item[$key]) : "" ;
     232                    $item[$key] = strtotime($date);
     233                }
    224234                $user_meta[] = array( 'key' => $key, 'value' => isset( $item[$key] ) ? trim($item[$key]) : "" );
    225235            }
    226 
     236         
    227237            // the $user_details array will now contain the necessary name-value pairs for the wp_users table, and also any meta data in the 'usermeta' array
    228238            $parsed_details = array();
     
    230240            $parsed_details['user_details'] = $user_details;
    231241            $parsed_details['user_meta'] = $user_meta;
    232 
    233242            return $parsed_details;
    234243        } catch (Exception $e) {
     
    253262
    254263            if ($user_id && $this->merge) {
    255                 $current_user = get_current_user_id();
     264                $current_user = $this->current_user;
    256265                if ($current_user == $user_id) {
    257                     $usr_msg = 'This user is currently logged in hence we cannot update.';
    258                     $this->hf_log_data_change('user-csv-import', sprintf(__('> “%s”' . $usr_msg), $user_id), true);
     266                    $this->hf_log_data_change('user-csv-import', sprintf(__('> “%s” This user is currently logged in hence we cannot update.'), $user_id), true);
    259267                    unset($post);
    260                 return new WP_Error( 'parse-error',sprintf(__('> “%s”' . $usr_msg), $user_id));
    261                 }
     268                return new WP_Error( 'parse-error',sprintf(__('> “%s” This user is currently logged in hence we cannot update.'), $user_id));
     269                }
     270                $user = get_userdata($user_id);
     271                $roles = $user->roles;
     272                $only_update_admin_with_admin = apply_filters('wt_ier_update_admin_only_by_admin_user', true);
     273                if(in_array('administrator', $roles) && $only_update_admin_with_admin ){
     274                    $current_user = get_userdata($current_user);
     275                    $current_roles = $current_user->roles;
     276                    if(!in_array('administrator', $current_roles)){
     277                        return new WP_Error( 'parse-error',sprintf(__('> “%s” Only a user with an Administrator role has the capability to update a user with an Administrator role.'), $user_id));
     278                    }
     279                }
     280
    262281                $user_id = $this->hf_update_customer($user_id, $post);
    263282            } else {
  • users-customers-import-export-for-wp-woocommerce/trunk/includes/class-wt-import-export-for-woo.php

    r2927717 r2938705  
    8181            $this->version = WT_U_IEW_VERSION;
    8282        } else {
    83             $this->version = '2.4.1';
     83            $this->version = '2.4.2';
    8484        }
    8585        $this->plugin_name = 'wt-import-export-for-woo-basic';
  • users-customers-import-export-for-wp-woocommerce/trunk/readme.txt

    r2927717 r2938705  
    66Tested up to: 6.2
    77Requires PHP: 5.6
    8 Stable tag: 2.4.1
     8Stable tag: 2.4.2
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2626🔸 Export specific users based on username/email - Suggests email addresses and names in export data filter fields while you type in.
    2727🔸 Tested OK with WordPress 6.2
    28 🔸 Tested OK with WooCommerce 7.8
     28🔸 Tested OK with WooCommerce 7.8.2
    2929🔸 Tested OK with PHP 8.2
    3030
     
    206206== Changelog ==
    207207
     208= 2.4.2 2023-07-14 =
     209* [Fix] - Admin user details are updated when importing as shop manager.
     210* [Add] - Export and Import the last activity data of users.
     211* [Compatibility] - Tested OK with WooCommerce 7.8.2
    208212= 2.4.1 2023-06-19 =
    209213* [Fix] – Importing custom CSV with a colon in the column heading.
     
    452456== Upgrade Notice ==
    453457
    454 = 2.4.1 =
    455 * [Fix] – Importing custom CSV with a colon in the column heading.
    456 * [Fix] – Auto delete history option does not delete import logs
    457 * [Update] – Tested OK with WooCommerce 7.8
     458= 2.4.2 =
     459* [Fix] - Admin user details are updated when importing as shop manager.
     460* [Add] - Export and Import the last activity data of users.
     461* [Compatibility] - Tested OK with WooCommerce 7.8.2
  • users-customers-import-export-for-wp-woocommerce/trunk/users-customers-import-export-for-wp-woocommerce.php

    r2927717 r2938705  
    66  Author: WebToffee
    77  Author URI: https://www.webtoffee.com/product/wordpress-users-woocommerce-customers-import-export/
    8   Version: 2.4.1
     8  Version: 2.4.2
    99  Text Domain: users-customers-import-export-for-wp-woocommerce
    1010  Domain Path: /languages
    11   WC tested up to: 7.8
     11  WC tested up to: 7.8.2
    1212  Requires at least: 3.0
    1313  Requires PHP: 5.6
     
    4949 * Rename this for your plugin and update it as you release new versions.
    5050 */
    51 define('WT_U_IEW_VERSION', '2.4.1');
     51define('WT_U_IEW_VERSION', '2.4.2');
    5252
    5353/**
Note: See TracChangeset for help on using the changeset viewer.