Import Export WordPress Users and WooCommerce Customers - Version 2.2.6

Version Description

  • Improvements: Optimise user email search filter to work without WooCommerce
Download this release

Release Info

Developer webtoffee
Plugin Icon 128x128 Import Export WordPress Users and WooCommerce Customers
Version 2.2.6
Comparing to
See all releases

Code changes from version 2.2.5 to 2.2.6

admin/class-wt-import-export-for-woo-admin.php CHANGED
@@ -120,12 +120,13 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
120
  'settings_success'=>__('Settings updated.'),
121
  'all_fields_mandatory'=>__('All fields are mandatory'),
122
  'settings_error'=>__('Unable to update Settings.'),
123
- 'template_del_error'=>__('Unable to delete template'),
124
- 'template_del_loader'=>__('Deleting template...'),
125
  'value_empty'=>__('Value is empty.'),
126
  'error'=>sprintf(__('An unknown error has occurred! Refer to our %stroubleshooting guide%s for assistance.'), '<a href="'.WT_IEW_DEBUG_BASIC_TROUBLESHOOT.'" target="_blank">', '</a>'),
127
  'success'=>__('Success.'),
128
  'loading'=>__('Loading...'),
 
129
  'sure'=>__('Are you sure?'),
130
  'use_expression'=>__('Use expression as value.'),
131
  'cancel'=>__('Cancel'),
@@ -286,6 +287,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
286
  * Delete pre-saved temaplates entry from DB - ajax hook
287
  */
288
  public function delete_template() {
 
289
  $out = array(
290
  'status' => false,
291
  'msg' => __('Error'),
@@ -434,5 +436,62 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
434
  $links[] = '<a href="https://www.webtoffee.com/support/" target="_blank">'.__('Support').'</a>';
435
  return $links;
436
  }
437
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  }
120
  'settings_success'=>__('Settings updated.'),
121
  'all_fields_mandatory'=>__('All fields are mandatory'),
122
  'settings_error'=>__('Unable to update Settings.'),
123
+ 'template_del_error'=>__('Unable to delete template'),
124
+ 'template_del_loader'=>__('Deleting template...'),
125
  'value_empty'=>__('Value is empty.'),
126
  'error'=>sprintf(__('An unknown error has occurred! Refer to our %stroubleshooting guide%s for assistance.'), '<a href="'.WT_IEW_DEBUG_BASIC_TROUBLESHOOT.'" target="_blank">', '</a>'),
127
  'success'=>__('Success.'),
128
  'loading'=>__('Loading...'),
129
+ 'no_results_found'=>__('No results found.'),
130
  'sure'=>__('Are you sure?'),
131
  'use_expression'=>__('Use expression as value.'),
132
  'cancel'=>__('Cancel'),
287
  * Delete pre-saved temaplates entry from DB - ajax hook
288
  */
289
  public function delete_template() {
290
+
291
  $out = array(
292
  'status' => false,
293
  'msg' => __('Error'),
436
  $links[] = '<a href="https://www.webtoffee.com/support/" target="_blank">'.__('Support').'</a>';
437
  return $links;
438
  }
439
+
440
+
441
+ /**
442
+ * Search for users and return json.
443
+ */
444
+ public static function ajax_user_search() {
445
+
446
+ if (Wt_Iew_Sh::check_write_access(WT_IEW_PLUGIN_ID_BASIC)) {
447
+
448
+ if (!current_user_can('export')) {
449
+ wp_die(-1);
450
+ }
451
+
452
+ $term = isset($_POST['term']) ? (string) sanitize_text_field(wp_unslash($_POST['term'])) : '';
453
+ $limit = 0;
454
+
455
+ if (empty($term)) {
456
+ wp_die();
457
+ }
458
+
459
+ // If search is smaller than 3 characters, limit result set to avoid
460
+ // too many rows being returned.
461
+ if (3 > strlen($term)) {
462
+ $limit = 20;
463
+ } else {
464
+ $limit = 50;
465
+ }
466
+
467
+
468
+ $found_users = array();
469
+ $users = new WP_User_Query( apply_filters( 'wt_iew_user_search_query_args', array(
470
+ 'search' => '*' . esc_attr($term) . '*',
471
+ 'number' => $limit,
472
+ 'search_columns' => array(
473
+ 'user_login',
474
+ 'user_email',
475
+ )),
476
+ ));
477
+ $users_found = $users->get_results();
478
+
479
+ foreach ($users_found as $user) {
480
+ $the_customer = get_userdata($user->ID);
481
+ /* translators: 1: user display name 2: user ID 3: user email */
482
+ $found_users[] = array('id' => $the_customer->ID, 'text' => sprintf(
483
+ /* translators: $1: user name, $2 user id, $3: user email */
484
+ esc_html__('%1$s (#%2$s - %3$s)'),
485
+ $the_customer->first_name . ' ' . $the_customer->last_name,
486
+ $the_customer->ID,
487
+ $the_customer->user_email
488
+ )
489
+ );
490
+ }
491
+
492
+ wp_send_json(apply_filters('wt_json_search_found_users', $found_users));
493
+ }
494
+ }
495
+
496
+ }
497
  }
admin/modules/export/assets/js/main.js CHANGED
@@ -414,6 +414,7 @@ var wt_iew_basic_export=(function( $ ) {
414
  });
415
  this.form_data['filter_form_data']=JSON.stringify(filter_form_data);
416
  }
 
417
  }
418
  else if(this.current_step=='mapping')
419
  {
@@ -615,6 +616,9 @@ var wt_iew_basic_export=(function( $ ) {
615
  if(this.current_step=='filter')
616
  {
617
  this.load_meta_mapping_fields();
 
 
 
618
  }else if(this.current_step=='advanced')
619
  {
620
  wt_field_group.Set();
@@ -907,7 +911,39 @@ var wt_iew_basic_export=(function( $ ) {
907
  {
908
  return confirm("Changes that you made may not be saved.");
909
  };
910
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  }
912
  return wt_iew_basic_export;
913
 
@@ -922,5 +958,7 @@ jQuery(function() {
922
  wt_iew_basic_export.rerun_id=wt_iew_export_basic_params.rerun_id;
923
  wt_iew_basic_export.on_rerun=true;
924
  }
925
- wt_iew_basic_export.Set();
926
- });
 
 
414
  });
415
  this.form_data['filter_form_data']=JSON.stringify(filter_form_data);
416
  }
417
+
418
  }
419
  else if(this.current_step=='mapping')
420
  {
616
  if(this.current_step=='filter')
617
  {
618
  this.load_meta_mapping_fields();
619
+ if($('.wt-user-search').length>0){
620
+ wt_iew_basic_export.initiate_user_search();
621
+ }
622
  }else if(this.current_step=='advanced')
623
  {
624
  wt_field_group.Set();
911
  {
912
  return confirm("Changes that you made may not be saved.");
913
  };
914
+ },
915
+ initiate_user_search: function(){
916
+
917
+ jQuery(".wt-user-search").select2({
918
+ minimumInputLength: 2,
919
+ multiple: true,
920
+ noResults: wt_iew_basic_params.msgs.no_results_found,
921
+ ajax: {
922
+ url: wt_iew_basic_params.ajax_url,
923
+ dataType: 'json',
924
+ type: "POST",
925
+ quietMillis: 50,
926
+
927
+ data: function (terms) {
928
+ return {
929
+ term: terms.term,
930
+ _wpnonce: wt_iew_basic_params.nonces.main,
931
+ action: 'wt_iew_ajax_user_search',
932
+ };
933
+ },
934
+ processResults: function (data) {
935
+ return {
936
+ results: jQuery.map(data, function (item) {
937
+ return {
938
+ id: item.id,
939
+ text: item.text
940
+ }
941
+ })
942
+ };
943
+ }
944
+ }
945
+ });
946
+ }
947
  }
948
  return wt_iew_basic_export;
949
 
958
  wt_iew_basic_export.rerun_id=wt_iew_export_basic_params.rerun_id;
959
  wt_iew_basic_export.on_rerun=true;
960
  }
961
+ wt_iew_basic_export.Set();
962
+
963
+ });
964
+
admin/modules/export/views/_export_method_export_page.php CHANGED
@@ -20,6 +20,9 @@ if (!defined('ABSPATH')) {
20
  <td colspan="2" style="width:75%;">
21
  <div class="wt_iew_radio_block">
22
  <?php
 
 
 
23
  foreach($this->export_obj->export_methods as $key => $value)
24
  {
25
  ?>
@@ -34,8 +37,8 @@ if (!defined('ABSPATH')) {
34
 
35
  </td>
36
  </tr>
37
-
38
- <!-- <tr class="wt-iew-export-method-options wt-iew-export-method-options-quick">
39
  <th style="width:150px; text-align:left; vertical-align:top;"><label><?php _e('Include fields from the respective groups');?></label></th>
40
  <td colspan="2" style="width:75%;">
41
  <?php
@@ -63,8 +66,8 @@ if (!defined('ABSPATH')) {
63
  ?>
64
  <span class="wt-iew_form_help"><?php _e('Enabling any of these ensures that all the fields from the respective groups are included in your export.');?></span>
65
  </td>
66
- </tr>-->
67
-
68
 
69
  <tr class="wt-iew-export-method-options wt-iew-export-method-options-template" style="display:none;">
70
  <th><label><?php _e('Export template');?></label></th>
20
  <td colspan="2" style="width:75%;">
21
  <div class="wt_iew_radio_block">
22
  <?php
23
+ if(empty($this->mapping_templates)){
24
+ unset($this->export_obj->export_methods['template']);
25
+ }
26
  foreach($this->export_obj->export_methods as $key => $value)
27
  {
28
  ?>
37
 
38
  </td>
39
  </tr>
40
+ <?php if(!empty($this->mapping_enabled_fields)):?>
41
+ <tr class="wt-iew-export-method-options wt-iew-export-method-options-quick">
42
  <th style="width:150px; text-align:left; vertical-align:top;"><label><?php _e('Include fields from the respective groups');?></label></th>
43
  <td colspan="2" style="width:75%;">
44
  <?php
66
  ?>
67
  <span class="wt-iew_form_help"><?php _e('Enabling any of these ensures that all the fields from the respective groups are included in your export.');?></span>
68
  </td>
69
+ </tr>
70
+ <?php endif; ?>
71
 
72
  <tr class="wt-iew-export-method-options wt-iew-export-method-options-template" style="display:none;">
73
  <th><label><?php _e('Export template');?></label></th>
admin/modules/import/views/_import_method_import_page.php CHANGED
@@ -14,6 +14,9 @@ if (!defined('ABSPATH')) {
14
  <td colspan="2" style="width:75%;">
15
  <div class="wt_iew_radio_block">
16
  <?php
 
 
 
17
  foreach($this->import_obj->import_methods as $key => $value)
18
  {
19
  ?>
14
  <td colspan="2" style="width:75%;">
15
  <div class="wt_iew_radio_block">
16
  <?php
17
+ if(empty($this->mapping_templates)){
18
+ unset($this->import_obj->import_methods['template']);
19
+ }
20
  foreach($this->import_obj->import_methods as $key => $value)
21
  {
22
  ?>
admin/modules/user/user.php CHANGED
@@ -368,13 +368,14 @@ class Wt_Import_Export_For_Woo_basic_User {
368
  'placeholder' => __('All users'),
369
  'field_name' => 'email',
370
  'sele_vals' => '',
371
- 'help_text' => __('Input the user emails separated by comma to export information pertaining to only these users.'),
 
 
372
  'validation_rule' => array('type'=>'text_arr')
373
  );
374
  if(is_plugin_active('woocommerce/woocommerce.php'))
375
  {
376
- $fields['email']['help_text']=__('Input the customer email to export information pertaining to only these customers.');
377
- $fields['email']['type']='multi_select';
378
  $fields['email']['css_class']='wc-customer-search';
379
  }
380
 
368
  'placeholder' => __('All users'),
369
  'field_name' => 'email',
370
  'sele_vals' => '',
371
+ 'type' => 'multi_select',
372
+ 'help_text' => __('Input the user name or email to specify the users.'),
373
+ 'css_class' => 'wc-enhanced-select wt-user-search',
374
  'validation_rule' => array('type'=>'text_arr')
375
  );
376
  if(is_plugin_active('woocommerce/woocommerce.php'))
377
  {
378
+ $fields['email']['help_text']=__('Input the customer name or email to specify the customers.');
 
379
  $fields['email']['css_class']='wc-customer-search';
380
  }
381
 
admin/partials/_form_field_generator.php CHANGED
@@ -229,7 +229,7 @@ foreach($form_fields as $key=>$value)
229
  }
230
  }
231
  }
232
- if(in_array('wc-customer-search', $css_class_arr)){
233
  foreach($vl as $single_vl)
234
  {
235
  $single_vl=(int) $single_vl;
229
  }
230
  }
231
  }
232
+ if(in_array('wc-customer-search', $css_class_arr) || in_array('wt-user-search', $css_class_arr) ){
233
  foreach($vl as $single_vl)
234
  {
235
  $single_vl=(int) $single_vl;
includes/class-wt-import-export-for-woo.php CHANGED
@@ -80,7 +80,7 @@ class Wt_Import_Export_For_Woo_Basic {
80
  if ( defined( 'WT_U_IEW_VERSION' ) ) {
81
  $this->version = WT_U_IEW_VERSION;
82
  } else {
83
- $this->version = '2.2.5';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
@@ -193,7 +193,8 @@ class Wt_Import_Export_For_Woo_Basic {
193
  {
194
  //ajax hook for saving settings, Includes plugin main settings and settings from module
195
  $this->loader->add_action('wp_ajax_wt_iew_save_settings_basic',$this->plugin_admin,'save_settings');
196
- $this->loader->add_action('wp_ajax_wt_iew_delete_template',$this->plugin_admin,'delete_template');
 
197
  /* Loading admin modules */
198
  $this->plugin_admin->admin_modules();
199
 
80
  if ( defined( 'WT_U_IEW_VERSION' ) ) {
81
  $this->version = WT_U_IEW_VERSION;
82
  } else {
83
+ $this->version = '2.2.6';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
193
  {
194
  //ajax hook for saving settings, Includes plugin main settings and settings from module
195
  $this->loader->add_action('wp_ajax_wt_iew_save_settings_basic',$this->plugin_admin,'save_settings');
196
+ $this->loader->add_action('wp_ajax_wt_iew_delete_template',$this->plugin_admin,'delete_template');
197
+ $this->loader->add_action('wp_ajax_wt_iew_ajax_user_search',$this->plugin_admin,'ajax_user_search');
198
  /* Loading admin modules */
199
  $this->plugin_admin->admin_modules();
200
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: user import, user export, csv, woocommerce, customers, export import users
5
  Requires at least: 3.0.1
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 2.2.5
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -25,6 +25,8 @@ WordPress User Import Export plugin allows the import and export of WordPress us
25
  &#128312; Retain user passwords (optional)
26
  &#128312; Map and Transform fields while importing customers/users
27
  &#128312; Change values (bulk modify) while importing customers/users using Evaluation Fields
 
 
28
  &#128312; Tested OK with WordPress 5.8
29
  &#128312; Tested OK with WooCommerce 6.1
30
  &#128312; Tested OK with PHP 8.0
@@ -214,6 +216,8 @@ Please refer the article on how to <a href="https://www.webtoffee.com/refresh-wo
214
 
215
  == Changelog ==
216
 
 
 
217
  = 2.2.5 =
218
  * WC 6.1 Tested OK
219
  * Add - Export guest users option.
@@ -409,7 +413,5 @@ Please refer the article on how to <a href="https://www.webtoffee.com/refresh-wo
409
 
410
  == Upgrade Notice ==
411
 
412
- = 2.2.5 =
413
- * WC 6.1 Tested OK
414
- * Add - Export guest users option.
415
- * Fix - user_status column value export.
5
  Requires at least: 3.0.1
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
+ Stable tag: 2.2.6
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
25
  &#128312; Retain user passwords (optional)
26
  &#128312; Map and Transform fields while importing customers/users
27
  &#128312; Change values (bulk modify) while importing customers/users using Evaluation Fields
28
+ &#128312; Export Guest users - Include data of WooCommerce guest customers(users who bought products from site without creating an account).
29
+ &#128312; Export specific users based on username/email - Suggests email addresses and names in export data filter fields while you type in.
30
  &#128312; Tested OK with WordPress 5.8
31
  &#128312; Tested OK with WooCommerce 6.1
32
  &#128312; Tested OK with PHP 8.0
216
 
217
  == Changelog ==
218
 
219
+ = 2.2.6 =
220
+ * Improvements: Optimise user email search filter to work without WooCommerce
221
  = 2.2.5 =
222
  * WC 6.1 Tested OK
223
  * Add - Export guest users option.
413
 
414
  == Upgrade Notice ==
415
 
416
+ = 2.2.6 =
417
+ * Improvements: Optimise user email search filter to work without WooCommerce
 
 
users-customers-import-export-for-wp-woocommerce.php CHANGED
@@ -5,7 +5,7 @@
5
  Description: Export and Import User/Customers details From and To your WordPress/WooCommerce.
6
  Author: WebToffee
7
  Author URI: https://www.webtoffee.com/product/wordpress-users-woocommerce-customers-import-export/
8
- Version: 2.2.5
9
  WC tested up to: 6.1
10
  Text Domain: users-customers-import-export-for-wp-woocommerce
11
  License: GPLv3
@@ -45,7 +45,7 @@ if (!defined('WT_IEW_DEBUG_BASIC_TROUBLESHOOT')) {
45
  * Start at version 1.0.0 and use SemVer - https://semver.org
46
  * Rename this for your plugin and update it as you release new versions.
47
  */
48
- define('WT_U_IEW_VERSION', '2.2.5');
49
 
50
  /**
51
  * The code that runs during plugin activation.
5
  Description: Export and Import User/Customers details From and To your WordPress/WooCommerce.
6
  Author: WebToffee
7
  Author URI: https://www.webtoffee.com/product/wordpress-users-woocommerce-customers-import-export/
8
+ Version: 2.2.6
9
  WC tested up to: 6.1
10
  Text Domain: users-customers-import-export-for-wp-woocommerce
11
  License: GPLv3
45
  * Start at version 1.0.0 and use SemVer - https://semver.org
46
  * Rename this for your plugin and update it as you release new versions.
47
  */
48
+ define('WT_U_IEW_VERSION', '2.2.6');
49
 
50
  /**
51
  * The code that runs during plugin activation.