Import Export WordPress Users and WooCommerce Customers - Version 2.3.2

Version Description

2022-07-05 = * Enhancement: Export to CSV option to Bulk Action drop-down menu in Users listing page. * Enhancement: Import progress screen improvements. * WooCommerce 6.6 Tested OK.

Download this release

Release Info

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

Code changes from version 2.3.1 to 2.3.2

admin/class-wt-import-export-for-woo-admin.php CHANGED
@@ -469,7 +469,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
469
 
470
  public function tools_wtexport_text(){
471
 
472
- echo "<p><b>" . sprintf( __( 'Export WordPress users and WooCommerce customers in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export' ) ) . "</b></p>";
473
  if( !is_plugin_active( 'order-import-export-for-woocommerce/order-import-export-for-woocommerce.php' ) ){
474
  echo "<p><b>" . sprintf(
475
  /* translators: %s: Order Import Export for WooCommerce plugin URL */
@@ -477,7 +477,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
477
  admin_url('plugin-install.php?tab=plugin-information&plugin=order-import-export-for-woocommerce')
478
  ) . "</b></p>";
479
  }else{
480
- echo "<p><b>" . sprintf( __( 'Export WooCommerce orders and coupons in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export' ) ) . "</b></p>";
481
  }
482
 
483
  if( !is_plugin_active( 'product-import-export-for-woo/product-import-export-for-woo.php' ) ){
@@ -487,7 +487,7 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
487
  admin_url('plugin-install.php?tab=plugin-information&plugin=product-import-export-for-woo')
488
  ) . "</b></p>";
489
  }else{
490
- echo "<p><b>" . sprintf( __( 'Export WooCommerce products, product categories, product tags and product reviews in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export' ) ) . "</b></p>";
491
  }
492
  }
493
 
469
 
470
  public function tools_wtexport_text(){
471
 
472
+ echo "<p><b>" . sprintf( __( 'Export WordPress users and WooCommerce customers in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=user' ) ) . "</b></p>";
473
  if( !is_plugin_active( 'order-import-export-for-woocommerce/order-import-export-for-woocommerce.php' ) ){
474
  echo "<p><b>" . sprintf(
475
  /* translators: %s: Order Import Export for WooCommerce plugin URL */
477
  admin_url('plugin-install.php?tab=plugin-information&plugin=order-import-export-for-woocommerce')
478
  ) . "</b></p>";
479
  }else{
480
+ echo "<p><b>" . sprintf( __( 'Export WooCommerce orders and coupons in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=order' ) ) . "</b></p>";
481
  }
482
 
483
  if( !is_plugin_active( 'product-import-export-for-woo/product-import-export-for-woo.php' ) ){
487
  admin_url('plugin-install.php?tab=plugin-information&plugin=product-import-export-for-woo')
488
  ) . "</b></p>";
489
  }else{
490
+ echo "<p><b>" . sprintf( __( 'Export WooCommerce products, product categories, product tags and product reviews in CSV format using <a href="%s">this exporter</a>.' ), admin_url( 'admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=product' ) ) . "</b></p>";
491
  }
492
  }
493
 
admin/css/wt-import-export-for-woo-admin.css CHANGED
@@ -242,6 +242,159 @@ span.wt_iew_mapping_field_val::after {
242
  /* popup */
243
  .wt_iew_overlay{ position:fixed; z-index:100000000; width:100%; height:100%; background-color:rgba(0,0,0,.5); left:0px; top:0px; display:none;}
244
  .wt_iew_popup{position:fixed; z-index:100000001; background:#fff; border:solid 1px #eee; text-align:center; box-shadow:0px 2px 5px #333; left:50%; display:none;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  .wt_iew_popup_hd{display:inline-block; width:100%; box-sizing:border-box; font-weight:bold; background-color:#f3f3f3; height:40px; text-align:left; line-height:40px; padding:0px 20px;}
246
  .wt_iew_popup_close{float:right; width:40px; height:40px; text-align:right; line-height:40px; cursor:pointer;}
247
  .wt_iew_popup_footer{width:100%; text-align:right; margin-top:10px;}
242
  /* popup */
243
  .wt_iew_overlay{ position:fixed; z-index:100000000; width:100%; height:100%; background-color:rgba(0,0,0,.5); left:0px; top:0px; display:none;}
244
  .wt_iew_popup{position:fixed; z-index:100000001; background:#fff; border:solid 1px #eee; text-align:center; box-shadow:0px 2px 5px #333; left:50%; display:none;}
245
+
246
+
247
+
248
+
249
+
250
+
251
+ .wt_iew_import_progress_wrap{
252
+ position: fixed;
253
+ overflow: scroll;
254
+ display: none;
255
+ top: 15px;
256
+ left: 50%;
257
+ width: 100%;
258
+ /*max-width: 580px;*/
259
+ height: 700px;
260
+ margin-left: -260px;
261
+ background: #ffffff;
262
+ border-radius: 3px;
263
+ z-index: 100000001;
264
+ box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
265
+ }
266
+ .wt_iew_import_progress_wrap.open {
267
+ display: flex;
268
+ flex-direction: column;
269
+ }
270
+ .wt_iew_import_progress_content{
271
+ height: 100%;
272
+ overflow-y: auto;
273
+ /*padding: 10px;*/
274
+ }
275
+ .wt_iew_import_progress_header{
276
+ padding: 15px;
277
+ top: 15px;
278
+ border-radius: 3px 3px 0 0;
279
+ }
280
+ .wt_iew_import_progress_wrap th, .wt_iew_import_progress_wrap td{text-align: center}
281
+ .wt_iew_import_progress{border: none !important;}
282
+
283
+
284
+
285
+
286
+ .wt_iew_import_progress table, .wt_iew_import_progress td {
287
+ border-collapse: collapse;
288
+ /*border: 1px solid #000;*/
289
+ }
290
+
291
+ .wt_iew_import_progress thead {
292
+ display: table; /* to take the same width as tr */
293
+ width: 100%;
294
+ }
295
+
296
+ .wt_iew_import_progress tbody {
297
+ display: block; /* to enable vertical scrolling */
298
+ max-height: 430px; /* e.g. */
299
+ overflow-y: scroll; /* keeps the scrollbar even if it doesn't need it; display purpose */
300
+ }
301
+
302
+ .wt_iew_import_progress th, .wt_iew_import_progress td {
303
+ /*width: 33.33%;*/
304
+ /* to enable "word-break: break-all" */
305
+ padding: 5px;
306
+ word-break: break-all; /* 4. */
307
+ }
308
+
309
+ .wt_iew_import_progress tr {
310
+ display: table; /* display purpose; th's border */
311
+ width: 100%;
312
+ box-sizing: border-box; /* because of the border (Chrome needs this line, but not FF) */
313
+ }
314
+
315
+ .wt_iew_import_progress td {
316
+ text-align: center;
317
+ border-bottom: none;
318
+ border-left: none;
319
+ }
320
+
321
+ progress {
322
+ height: 30px;
323
+ border-radius: 30px;
324
+ width:100%;
325
+ }
326
+ progress[value]::-webkit-progress-bar {
327
+ background-color: #EDEDED;
328
+ border-radius: 40px;
329
+ }
330
+ progress[value]::-moz-progress-bar {
331
+ background-color: #008000;
332
+ border-radius: 40px;
333
+ }
334
+ progress[value]::-webkit-progress-value {
335
+ border-radius: 40px;
336
+ background-color:#008000;
337
+ }
338
+
339
+ .wt-iew-import-result-row {
340
+ display: table;
341
+ width: 100%; /*Optional*/
342
+ table-layout: fixed; /*Optional*/
343
+ border-spacing: 10px; /*Optional*/
344
+ }
345
+ .wt-iew-import-result-column {
346
+ display: table-cell;
347
+ padding-bottom: 20px;
348
+ }
349
+ .wt-iew-import-completed .dashicons-yes:before{color: green;}
350
+
351
+ #wt_iew_import_progress .dashicons-dismiss:before {color: red;}
352
+ #wt_iew_import_progress .dashicons-yes-alt:before {color: green;}
353
+
354
+ .wt_iew_view_imported_items:focus, .wt_iew_view_imported_items:visited{
355
+ outline: none !important;
356
+ box-shadow: none !important;
357
+ }
358
+
359
+ .progressa {
360
+ border-radius: 50px !important;
361
+ line-height: 36px;
362
+ font-size: 14px;
363
+ overflow: hidden;
364
+ margin-bottom: 45px;
365
+ background-color: #dadada80;
366
+ border-radius: 4px;
367
+ -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
368
+ box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
369
+ line-height: 30px;
370
+ height: 40px;
371
+ font-size: 14px;
372
+ /*border: 3px solid transparent;*/
373
+ margin-left:25px;
374
+ width:95%;
375
+ }
376
+ .progressab {
377
+ /*background-image: -webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);
378
+ background-image: -o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);
379
+ */
380
+ -webkit-background-size: 40px 40px;
381
+ background-size: 40px 40px;
382
+ -webkit-transition: width .25s ease,height .25s ease,font-size .25s ease;
383
+ -moz-transition: width .25s ease,height .25s ease,font-size .25s ease;
384
+ -ms-transition: width .25s ease,height .25s ease,font-size .25s ease;
385
+ -o-transition: width .25s ease,height .25s ease,font-size .25s ease;
386
+ transition: width .25s ease,height .25s ease,font-size .25s ease;
387
+ width: 0;
388
+ color: #fff;
389
+ text-align: center;
390
+ font-family: 'Open Sans',sans-serif !important;
391
+ animation: progress-bar-stripes 2s linear infinite reverse;
392
+ }
393
+
394
+
395
+
396
+
397
+
398
  .wt_iew_popup_hd{display:inline-block; width:100%; box-sizing:border-box; font-weight:bold; background-color:#f3f3f3; height:40px; text-align:left; line-height:40px; padding:0px 20px;}
399
  .wt_iew_popup_close{float:right; width:40px; height:40px; text-align:right; line-height:40px; cursor:pointer;}
400
  .wt_iew_popup_footer{width:100%; text-align:right; margin-top:10px;}
admin/js/wt-import-export-for-woo-admin.js CHANGED
@@ -268,6 +268,15 @@ wt_iew_popup={
268
  popup_elm.find('.wt_iew_popup_body').css({'max-height':ph+'px','overflow':'auto'});
269
  jQuery('.wt_iew_overlay').show();
270
  },
 
 
 
 
 
 
 
 
 
271
  hidePopup:function()
272
  {
273
  jQuery('.wt_iew_popup_close').click();
@@ -280,7 +289,7 @@ wt_iew_popup={
280
  wt_iew_popup.hidePopup();
281
  }
282
  });
283
- jQuery('.wt_iew_popup_close, .wt_iew_popup_cancel').unbind('click').click(function(){
284
  jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
285
  });
286
  }
268
  popup_elm.find('.wt_iew_popup_body').css({'max-height':ph+'px','overflow':'auto'});
269
  jQuery('.wt_iew_overlay').show();
270
  },
271
+ showimportPopup:function(popup_elm)
272
+ {
273
+ var pw=popup_elm.outerWidth();
274
+ var wh=jQuery(window).height();
275
+ var ph=wh-150;
276
+ popup_elm.css({'margin-left':((pw/2)*-1),'display':'block','top':'50px'});
277
+ popup_elm.find('.wt_iew_popup_body').css({'max-height':ph+'px','overflow':'auto'});
278
+ jQuery('.wt_iew_overlay').show();
279
+ },
280
  hidePopup:function()
281
  {
282
  jQuery('.wt_iew_popup_close').click();
289
  wt_iew_popup.hidePopup();
290
  }
291
  });
292
+ jQuery('.wt_iew_popup_close, .wt_iew_popup_cancel, .wt_iew_popup_close_btn').unbind('click').click(function(){
293
  jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
294
  });
295
  }
admin/modules/export/assets/js/main.js CHANGED
@@ -5,7 +5,7 @@ var wt_iew_basic_export=(function( $ ) {
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
- to_export:'user',
9
  to_export_title:'',
10
  export_method:'',
11
  current_step:'',
@@ -629,6 +629,9 @@ var wt_iew_basic_export=(function( $ ) {
629
  if(this.to_export!="" && this.to_export_title=='')
630
  {
631
  $('[name="wt_iew_export_post_type"]').val(this.to_export);
 
 
 
632
  this.to_export_title=$('[name="wt_iew_export_post_type"] option:selected').text();
633
  }
634
  $('.wt_iew_step_head_post_type_name').html(this.to_export_title);
5
  ajax_data:{},
6
  selected_template:0,
7
  selected_template_name:'',
8
+ to_export:( wt_iew_export_basic_params.to_export !== '' ) ? wt_iew_export_basic_params.to_export : 'user',
9
  to_export_title:'',
10
  export_method:'',
11
  current_step:'',
629
  if(this.to_export!="" && this.to_export_title=='')
630
  {
631
  $('[name="wt_iew_export_post_type"]').val(this.to_export);
632
+ if(wt_iew_export_basic_params.to_export !== ''){
633
+ $('[name="wt_iew_export_post_type"]').trigger('change');
634
+ }
635
  this.to_export_title=$('[name="wt_iew_export_post_type"] option:selected').text();
636
  }
637
  $('.wt_iew_step_head_post_type_name').html(this.to_export_title);
admin/modules/export/export.php CHANGED
@@ -305,7 +305,7 @@ class Wt_Import_Export_For_Woo_Basic_Export
305
  'sele_vals'=>Wt_Iew_IE_Basic_Helper::_get_csv_delimiters(),
306
  'help_text'=>__( 'Separator for differentiating the columns in the CSV file. Assumes ‘,’ by default.' ),
307
  'validation_rule'=>array('type'=>'skip'),
308
- 'after_form_field'=>'<input type="text" class="wt_iew_custom_delimiter" name="wt_iew_delimiter" value="'.$delimiter_default.'" />',
309
  )
310
  );
311
 
@@ -380,7 +380,7 @@ class Wt_Import_Export_For_Woo_Basic_Export
380
  'item_type'=>'',
381
  'steps'=>$this->steps,
382
  'rerun_id'=>$this->rerun_id,
383
- 'to_export'=>$this->to_export,
384
  'export_method'=>$this->export_method,
385
  'msgs'=>array(
386
  'choosed_template'=>__('Choosed template: '),
305
  'sele_vals'=>Wt_Iew_IE_Basic_Helper::_get_csv_delimiters(),
306
  'help_text'=>__( 'Separator for differentiating the columns in the CSV file. Assumes ‘,’ by default.' ),
307
  'validation_rule'=>array('type'=>'skip'),
308
+ 'after_form_field'=>'<input type="text" class="wt_iew_custom_delimiter" name="wt_iew_delimiter" value="'.$delimiter_default.'" maxlength = "1" />',
309
  )
310
  );
311
 
380
  'item_type'=>'',
381
  'steps'=>$this->steps,
382
  'rerun_id'=>$this->rerun_id,
383
+ 'to_export'=> isset( $_GET['wt_to_export'] ) ? sanitize_text_field( $_GET['wt_to_export'] ) : $this->to_export,
384
  'export_method'=>$this->export_method,
385
  'msgs'=>array(
386
  'choosed_template'=>__('Choosed template: '),
admin/modules/history/assets/js/main.js CHANGED
@@ -11,21 +11,22 @@ var wt_iew_basic_history=(function( $ ) {
11
  },
12
  reg_view_log:function()
13
  {
14
- jQuery(document).on('click', ".wt_iew_view_log_btn", function(){
15
- wt_iew_basic_history.show_log_popup();
16
- var history_id=$(this).attr('data-history-id');
17
- if(history_id>0)
18
- {
19
- wt_iew_basic_history.log_offset=0;
20
- wt_iew_basic_history.load_page(history_id);
21
- }else
22
- {
23
- var log_file=$(this).attr('data-log-file');
24
- if(log_file!="")
25
- {
26
- wt_iew_basic_history.view_raw_log(log_file);
27
- }
28
- }
 
29
  });
30
  },
31
  view_raw_log:function(log_file)
11
  },
12
  reg_view_log:function()
13
  {
14
+ jQuery(document).on('click', ".wt_iew_view_log_btn", function(){
15
+ jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
16
+ wt_iew_basic_history.show_log_popup();
17
+ var history_id=$(this).attr('data-history-id');
18
+ if(history_id>0)
19
+ {
20
+ wt_iew_basic_history.log_offset=0;
21
+ wt_iew_basic_history.load_page(history_id);
22
+ }else
23
+ {
24
+ var log_file=$(this).attr('data-log-file');
25
+ if(log_file!="")
26
+ {
27
+ wt_iew_basic_history.view_raw_log(log_file);
28
+ }
29
+ }
30
  });
31
  },
32
  view_raw_log:function(log_file)
admin/modules/import/assets/js/main.js CHANGED
@@ -20,8 +20,10 @@ var wt_iew_basic_import=(function( $ ) {
20
  local_import_file:'',
21
  url_import_file:'',
22
  on_rerun:false,
 
23
  rerun_id:0,
24
  import_delimiter:',',
 
25
  Set:function()
26
  {
27
  this.step_keys=Object.keys(wt_iew_import_basic_params.steps);
@@ -263,7 +265,7 @@ var wt_iew_basic_import=(function( $ ) {
263
  {
264
  wt_iew_basic_import.set_import_progress_info(wt_iew_import_basic_params.msgs.processing_file);
265
  }
266
- $.ajax({
267
  type: 'POST',
268
  url:wt_iew_basic_params.ajax_url,
269
  data:this.ajax_data,
@@ -283,21 +285,81 @@ var wt_iew_basic_import=(function( $ ) {
283
  //wt_iew_notify_msg.success(wt_iew_basic_params.msgs.success);
284
 
285
  }else if(action=='import')
286
- {
 
287
  if(data.finished==1)
288
  {
289
- wt_iew_basic_import.temp_import_file='';
290
- wt_iew_notify_msg.success(wt_iew_basic_params.msgs.success);
291
- wt_iew_basic_import.set_import_progress_info(data.msg);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
  else
294
  {
295
- wt_iew_basic_import.set_import_progress_info(data.msg);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  wt_iew_basic_import.ajax_data['offset']=data.new_offset;
297
  wt_iew_basic_import.ajax_data['import_id']=data.import_id;
298
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
299
  wt_iew_basic_import.ajax_data['offset_count']=data.offset_count;
300
-
301
  wt_iew_basic_import.ajax_data['total_success']=data.total_success;
302
  wt_iew_basic_import.ajax_data['total_failed']=data.total_failed;
303
  wt_iew_basic_import.do_nonstep_action(action);
@@ -309,6 +371,15 @@ var wt_iew_basic_import=(function( $ ) {
309
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
310
  if(data.finished==3)/* finished file processing */
311
  {
 
 
 
 
 
 
 
 
 
312
  wt_iew_basic_import.ajax_data['offset']=0;
313
  wt_iew_basic_import.ajax_data['offset_count']=0;
314
  wt_iew_basic_import.ajax_data['import_action']='import';
@@ -374,6 +445,34 @@ var wt_iew_basic_import=(function( $ ) {
374
  }
375
  });
376
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  reg_button_actions:function()
378
  {
379
  $('.wt_iew_import_action_btn').unbind('click').click(function(e){
@@ -412,6 +511,19 @@ var wt_iew_basic_import=(function( $ ) {
412
  wt_iew_basic_import.nonstep_actions(action);
413
  }
414
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  },
416
  get_file_from:function()
417
  {
20
  local_import_file:'',
21
  url_import_file:'',
22
  on_rerun:false,
23
+ import_finished:false,
24
  rerun_id:0,
25
  import_delimiter:',',
26
+ import_start_time:0,
27
  Set:function()
28
  {
29
  this.step_keys=Object.keys(wt_iew_import_basic_params.steps);
265
  {
266
  wt_iew_basic_import.set_import_progress_info(wt_iew_import_basic_params.msgs.processing_file);
267
  }
268
+ wt_iew_basic_import.import_ajax_xhr = $.ajax({
269
  type: 'POST',
270
  url:wt_iew_basic_params.ajax_url,
271
  data:this.ajax_data,
285
  //wt_iew_notify_msg.success(wt_iew_basic_params.msgs.success);
286
 
287
  }else if(action=='import')
288
+ {
289
+
290
  if(data.finished==1)
291
  {
292
+ wt_iew_basic_import.temp_import_file='';
293
+ let [firstKey] = Object.keys(data.log_data);
294
+ if(data.log_data[firstKey].post_link){
295
+
296
+ wt_iew_basic_import.show_import_popup();
297
+ $('.wt_iew_import_progress_wrap').addClass('open');
298
+
299
+ var newk = 0;
300
+ $.each(data.log_data, function (j) {
301
+ var status_icon = (data.log_data[j].status == true ) ? 'yes-alt' : 'dismiss';
302
+ var item_name = (data.log_data[j].post_link.edit_url) ? '<a href="'+data.log_data[j].post_link.edit_url+'" target="_blank">'+data.log_data[j].post_link.title+'</a>' : data.log_data[j].post_link.title;
303
+ $('#wt_iew_import_progress tbody').append( '<tr id="row-' + data.log_data[j].row + '" class="' + data.log_data[j].status + '"><td style="width:15%"><span class="result" title="' + data.log_data[j].row + '">' + data.log_data[j].row + '</span></td><td style="width:20%" class="row">' + item_name + '</td><td style="width:50%">' + data.log_data[j].message + '</td><td style="width:20%" class="reason"><span class="dashicons dashicons-'+status_icon+'"></span></td></tr>' );
304
+ newk = j;
305
+ });
306
+ //$('.wt-iew-importer-progress').val(data.total_percent);
307
+ var elm = document.getElementsByClassName('progressab')[0];
308
+ elm.style.width = 100+"%";
309
+ document.getElementById('row-' + ( newk )).scrollIntoView(false);
310
+ $('.progressa').hide();
311
+
312
+ $('#wt-iew-import-results-total-count').html((data.total_success + data.total_failed));
313
+ $('#wt-iew-import-results-imported-count').html(data.total_success);
314
+ $('#wt-iew-import-results-failed-count').html(data.total_failed);
315
+
316
+ $('.wt-iew-import-completed').show();
317
+ var time_taken = new Date().getTime() - wt_iew_basic_import.import_start_time;
318
+ time_taken = (time_taken/1000); // convert to seconds
319
+ $('#wt-iew-import-time-taken').html(wt_iew_basic_import.toHHMMSS(time_taken));
320
+ $('.wt-iew-import-time').show();
321
+ $('.wt_iew_view_log_btn').attr('data-log-file', data.log_file);
322
+ $('.wt_iew_view_log_btn').show();
323
+ $('.wt_iew_view_imported_items').attr('href', wt_iew_import_basic_params.addons[wt_iew_basic_import.to_import].page_link);
324
+ $('.wt_iew_view_imported_items').text(wt_iew_import_basic_params.addons[wt_iew_basic_import.to_import].text);
325
+ $('.wt_iew_view_imported_items').show();
326
+ $('.wt_iew_popup_close_btn').show();
327
+ $('.wt_iew_popup_cancel_btn').hide();
328
+ }else{
329
+ wt_iew_notify_msg.success(wt_iew_basic_params.msgs.success, false);
330
+ wt_iew_basic_import.set_import_progress_info(data.msg);
331
+ }
332
+ wt_iew_basic_import.import_finished = true;
333
  }
334
  else
335
  {
336
+ let [firstKey] = Object.keys(data.log_data);
337
+ if(data.log_data[firstKey].post_link){
338
+ wt_iew_basic_import.show_import_popup();
339
+ $('.wt_iew_import_progress_wrap').addClass('open');
340
+ var newk = 0;
341
+ $.each(data.log_data, function (j) {
342
+ var status_icon = (data.log_data[j].status == true ) ? 'yes-alt' : 'dismiss';
343
+ var item_name = (data.log_data[j].post_link.edit_url) ? '<a href="'+data.log_data[j].post_link.edit_url+'" target="_blank">'+data.log_data[j].post_link.title+'</a>' : data.log_data[j].post_link.title;
344
+ $('#wt_iew_import_progress tbody').append( '<tr id="row-' + data.log_data[j].row + '" class="' + data.log_data[j].status + '"><td style="width:15%"><span class="result" title="' + data.log_data[j].row + '">' + data.log_data[j].row + '</span></td><td style="width:20%" class="row">' + item_name + '</td><td style="width:50%">' + data.log_data[j].message + '</td><td style="width:20%" class="reason"><span class="dashicons dashicons-'+status_icon+'"></span></td></tr>' );
345
+ newk = j;
346
+ });
347
+
348
+ var progressval = data.total_percent;
349
+ var elm = document.getElementsByClassName('progressab')[0];
350
+ elm.style.width = progressval+"%";
351
+
352
+ elm.innerText = progressval+"%";
353
+ elm.style.backgroundColor = '#5FBA89';
354
+ //$('.wt-iew-importer-progress').val(data.total_percent);
355
+ document.getElementById('row-' + ( newk )).scrollIntoView({block: 'end', behavior: 'smooth'});
356
+ }else{
357
+ wt_iew_basic_import.set_import_progress_info(data.msg);
358
+ }
359
  wt_iew_basic_import.ajax_data['offset']=data.new_offset;
360
  wt_iew_basic_import.ajax_data['import_id']=data.import_id;
361
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
362
  wt_iew_basic_import.ajax_data['offset_count']=data.offset_count;
 
363
  wt_iew_basic_import.ajax_data['total_success']=data.total_success;
364
  wt_iew_basic_import.ajax_data['total_failed']=data.total_failed;
365
  wt_iew_basic_import.do_nonstep_action(action);
371
  wt_iew_basic_import.ajax_data['total_records']=data.total_records;
372
  if(data.finished==3)/* finished file processing */
373
  {
374
+ wt_iew_basic_import.import_start_time = new Date().getTime();
375
+ $("#wt_iew_import_progress_tbody").empty();
376
+ $('.progressa').show();
377
+ $('.wt-iew-import-completed').hide();
378
+ $('.wt-iew-import-time').hide();
379
+ $('.wt_iew_popup_close_btn').hide();
380
+ $('.wt_iew_view_imported_items').hide();
381
+ $('.wt_iew_view_log_btn').hide();
382
+ $('.wt_iew_popup_cancel_btn').show();
383
  wt_iew_basic_import.ajax_data['offset']=0;
384
  wt_iew_basic_import.ajax_data['offset_count']=0;
385
  wt_iew_basic_import.ajax_data['import_action']='import';
445
  }
446
  });
447
  },
448
+ show_import_popup:function()
449
+ {
450
+ var pop_elm=$('.wt_iew_import_progress_wrap');
451
+ var ww=$(window).width();
452
+ pop_w=(ww<1300 ? ww : 1300)-200;
453
+ pop_w=(pop_w<200 ? 200 : pop_w);
454
+ pop_elm.width(pop_w);
455
+
456
+ wh=$(window).height();
457
+ pop_h=(wh>=400 ? (wh-200) : wh);
458
+ $('.wt_iew_import_progress').css({'max-height':pop_h+'px','overflow':'auto'});
459
+ wt_iew_popup.showimportPopup(pop_elm);
460
+ pop_elm.css({'display':'flex'});
461
+ },
462
+ toHHMMSS:function(sec_taken){
463
+ var sec_num = parseInt(sec_taken, 10); // don't forget the second param
464
+ var hours = Math.floor(sec_num / 3600);
465
+ var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
466
+ var seconds = sec_num - (hours * 3600) - (minutes * 60);
467
+ if(seconds === 0){
468
+ seconds = 1;
469
+ }
470
+
471
+ if (hours < 10) {hours = "0"+hours;}
472
+ if (minutes < 10) {minutes = "0"+minutes;}
473
+ if (seconds < 10) {seconds = "0"+seconds;}
474
+ return hours + ':' + minutes + ':' + seconds;
475
+ },
476
  reg_button_actions:function()
477
  {
478
  $('.wt_iew_import_action_btn').unbind('click').click(function(e){
511
  wt_iew_basic_import.nonstep_actions(action);
512
  }
513
  });
514
+ $('.wt_iew_popup_cancel_btn').unbind('click').click(function(e){
515
+ if (confirm("Are you sure to stop the import?") == true) {
516
+ var temp_err_message = wt_iew_basic_params.msgs.error;
517
+ wt_iew_basic_params.msgs.error = 'Import cancelled';
518
+ wt_iew_basic_import.import_ajax_xhr.abort();
519
+ wt_iew_basic_params.msgs.error = temp_err_message;
520
+ var progressval = 1;
521
+ var elm = document.getElementsByClassName('progressab')[0];
522
+ elm.style.width = progressval+"%";
523
+ elm.innerText = progressval+"%";
524
+ jQuery('.wt_iew_overlay, .wt_iew_popup').hide();
525
+ }
526
+ });
527
  },
528
  get_file_from:function()
529
  {
admin/modules/import/import.php CHANGED
@@ -163,7 +163,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
163
  'type'=>'text',
164
  'value'=>$this->default_batch_count,
165
  'field_name'=>'batch_count',
166
- 'help_text'=>__('The number of records that the server will process for every iteration within the configured timeout interval. If the export fails due to timeout you can lower this number accordingly and try again.'),
167
  'validation_rule'=>array('type'=>'absint'),
168
  )
169
  );
@@ -410,6 +410,40 @@ class Wt_Import_Export_For_Woo_Basic_Import
410
  'upload_done'=>sprintf(__('%s Done.'), '<span class="dashicons dashicons-yes-alt" style="color:#3fa847;"></span>'),
411
  'remove'=>__('Remove'),
412
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  );
414
  wp_localize_script($this->module_id, 'wt_iew_import_basic_params', $params);
415
 
@@ -946,6 +980,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
946
  /* checking action is finshed */
947
  $is_last_offset=false;
948
  $new_offset=$input_data['offset']; //increase the offset
 
949
  if($new_offset>=$total_records) //finished
950
  {
951
  $is_last_offset=true;
@@ -988,7 +1023,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
988
  );
989
 
990
  $import_response=apply_filters('wt_iew_importer_do_import_basic', $input_data['data_arr'], $to_process, $step, $form_data, $this->selected_template_data, $this->import_method, $offset_count, $is_last_offset);
991
-
992
  /**
993
  * Writing import log to file
994
  */
@@ -1034,6 +1069,14 @@ class Wt_Import_Export_For_Woo_Basic_Import
1034
  $log_summary_msg=$this->generate_log_summary($out, $is_last_offset);
1035
 
1036
  $out['finished']=1; //finished
 
 
 
 
 
 
 
 
1037
  $out['msg']=$log_summary_msg;
1038
 
1039
  /* updating finished status */
163
  'type'=>'text',
164
  'value'=>$this->default_batch_count,
165
  'field_name'=>'batch_count',
166
+ 'help_text'=>__('The number of records that the server will process for every iteration within the configured timeout interval. If the import fails due to timeout you can lower this number accordingly and try again.'),
167
  'validation_rule'=>array('type'=>'absint'),
168
  )
169
  );
410
  'upload_done'=>sprintf(__('%s Done.'), '<span class="dashicons dashicons-yes-alt" style="color:#3fa847;"></span>'),
411
  'remove'=>__('Remove'),
412
  ),
413
+ 'addons' => array(
414
+ 'product' => array(
415
+ 'text' => __( 'View Products' ),
416
+ 'page_link' => admin_url('edit.php?post_type=product')
417
+ ),
418
+ 'product_categories' => array(
419
+ 'text' => __( 'View Product categories' ),
420
+ 'page_link' => admin_url('edit-tags.php?taxonomy=product_cat&post_type=product')
421
+ ),
422
+ 'product_tags' => array(
423
+ 'text' => __( 'View Product tags' ),
424
+ 'page_link' => admin_url('edit-tags.php?taxonomy=product_tag&post_type=product')
425
+ ),
426
+ 'product_review' => array(
427
+ 'text' => __( 'View Product reviews' ),
428
+ 'page_link' => admin_url('edit-comments.php')
429
+ ),
430
+ 'order' => array(
431
+ 'text' => __( 'View Orders' ),
432
+ 'page_link' => admin_url('edit.php?post_type=shop_order')
433
+ ),
434
+ 'coupon' => array(
435
+ 'text' => __( 'View Coupons' ),
436
+ 'page_link' => admin_url('edit.php?post_type=shop_coupon')
437
+ ),
438
+ 'user' => array(
439
+ 'text' => __( 'View Users' ),
440
+ 'page_link' => admin_url('users.php')
441
+ ),
442
+ 'subscription' => array(
443
+ 'text' => __( 'View Subscriptions' ),
444
+ 'page_link' => admin_url('edit.php?post_type=shop_subscription')
445
+ )
446
+ )
447
  );
448
  wp_localize_script($this->module_id, 'wt_iew_import_basic_params', $params);
449
 
980
  /* checking action is finshed */
981
  $is_last_offset=false;
982
  $new_offset=$input_data['offset']; //increase the offset
983
+ $out['total_percent']= ceil(($new_offset/$total_records)*100);
984
  if($new_offset>=$total_records) //finished
985
  {
986
  $is_last_offset=true;
1023
  );
1024
 
1025
  $import_response=apply_filters('wt_iew_importer_do_import_basic', $input_data['data_arr'], $to_process, $step, $form_data, $this->selected_template_data, $this->import_method, $offset_count, $is_last_offset);
1026
+ $out['log_data'] = $import_response['log_data'];
1027
  /**
1028
  * Writing import log to file
1029
  */
1069
  $log_summary_msg=$this->generate_log_summary($out, $is_last_offset);
1070
 
1071
  $out['finished']=1; //finished
1072
+ $log_file_name = '';
1073
+ $log_path=Wt_Import_Export_For_Woo_Basic_Log::$log_dir;
1074
+ $log_files = glob($log_path.'/'.$out['history_id'].'_*'.'.log');
1075
+ if(is_array($log_files) && count($log_files)>0)
1076
+ {
1077
+ $log_file_name=basename($log_files[0]);
1078
+ }
1079
+ $out['log_file'] = $log_file_name;
1080
  $out['msg']=$log_summary_msg;
1081
 
1082
  /* updating finished status */
admin/modules/import/views/main.php CHANGED
@@ -31,6 +31,59 @@ select[name=wt_iew_file_from]{visibility: hidden;}
31
 
32
  </div>
33
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  <?php
35
  Wt_Iew_IE_Basic_Helper::debug_panel($this->module_base);
36
  ?>
31
 
32
  </div>
33
  </div>
34
+
35
+ <div class="wt_iew_import_progress_wrap wt_iew_popup">
36
+ <div class="wt_iew_popup_hd wt_iew_import_progress_header">
37
+ <span style="line-height:40px;" class="dashicons dashicons-media-text"></span>
38
+ <span class="wt_iew_popup_hd_label"><?php _e('Import progress');?></span>
39
+ <div class="wt_iew_popup_close">X</div>
40
+ </div>
41
+ <div class="wt_iew_import_progress_content" style="max-height:620px;overflow: auto;">
42
+ <table id="wt_iew_import_progress" class="widefat_importer widefat wt_iew_import_progress wp-list-table fixed striped history_list_tb log_list_tb">
43
+ <thead>
44
+ <tr>
45
+ <th style="width:15%" class="row"><?php _e( 'Row' ); ?></th>
46
+ <th style="width:20%"><?php _e( 'Item' ); ?></th>
47
+ <th style="width:50%"><?php _e( 'Message' ); ?></th>
48
+ <th style="width:20%" class="reason"><?php _e( 'Status' ); ?></th>
49
+ </tr>
50
+ </thead>
51
+ <tbody id="wt_iew_import_progress_tbody"></tbody>
52
+ </table>
53
+ </div>
54
+ <br/>
55
+ <div id="wt_iew_import_progress_end"></div>
56
+ <div class="progressa">
57
+ <div class="progressab" style="background-color: rgb(178, 222, 75);width:5px; "></div>
58
+ </div>
59
+
60
+ <div class="wt-iew-import-completed" style="display:none;border-top: 1px outset;">
61
+ <h3><?php _e('Import Completed'); ?><span style="color:green" class="dashicons dashicons-yes-alt"></span></h3>
62
+ <div class="wt-iew-import-results">
63
+ <div class="wt-iew-import-result-row">
64
+ <div class="wt-iew-import-results-total wt-iew-import-result-column"><?php _e('Total records identified'); ?>:<span id="wt-iew-import-results-total-count"></span></div>
65
+ <div style="color:green" class="wt-iew-import-results-imported wt-iew-import-result-column"><?php _e('Imported successfully'); ?>:<span id="wt-iew-import-results-imported-count"></span></div>
66
+ <div style="color:red" class="wt-iew-import-results-failed wt-iew-import-result-column"><?php _e('Failed/Skipped'); ?>:<span id="wt-iew-import-results-failed-count"></span></div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+
71
+
72
+ <div class="wt-iew-plugin-toolbar bottom" style="padding:5px;margin-left:-10px;">
73
+ <div style="float: left">
74
+ <div class="wt-iew-import-time" style="display:none;padding-left: 40px;margin-top:10px;" ><?php _e( 'Time taken to complete' );?>:<span id="wt-iew-import-time-taken"></span></div>
75
+ </div>
76
+ <div style="float:right;">
77
+ <div style="float:right;">
78
+ <a target="_blank" href="#" class="button button-primary wt_iew_view_imported_items" data-log-file="" style="display:none" type="button" style="margin-right:10px;"><?php _e( 'View Item' );?></a>
79
+ <button class="button button-primary wt_iew_view_log_btn" data-log-file="" style="display:none" type="button" style="margin-right:10px;"><?php _e( 'View Log' );?></button>
80
+ <button class="button button-primary wt_iew_popup_cancel_btn" type="button" style="margin-right:10px;"><?php _e( 'Cancel' );?></button>
81
+ <button class="button button-primary wt_iew_popup_close_btn" style="display:none" type="button" style="margin-right:10px;"><?php _e( 'Close' );?></button>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
  <?php
88
  Wt_Iew_IE_Basic_Helper::debug_panel($this->module_base);
89
  ?>
admin/modules/user/data/data-user-columns.php CHANGED
@@ -43,27 +43,27 @@ if (!function_exists( 'is_plugin_active' ) )
43
 
44
  if( is_plugin_active( 'woocommerce/woocommerce.php' ) ):
45
 
46
- $columns['billing_first_name'] = 'Billing first name';
47
- $columns['billing_last_name'] = 'Billing last name';
48
- $columns['billing_company'] = 'Billing company';
49
- $columns['billing_email'] = 'Billing email';
50
- $columns['billing_phone'] = 'Billing phone';
51
- $columns['billing_address_1'] = 'Billing address 1';
52
- $columns['billing_address_2'] = 'Billing address 2';
53
- $columns['billing_postcode'] = 'Billing postcode';
54
- $columns['billing_city'] = 'Billing city';
55
- $columns['billing_state'] = 'Billing state';
56
- $columns['billing_country'] = 'Billing country';
57
- $columns['shipping_first_name'] = 'Shipping first name';
58
- $columns['shipping_last_name'] = 'Shipping last name';
59
- $columns['shipping_company'] = 'Shipping company';
60
- $columns['shipping_phone'] = 'Shipping phone';
61
- $columns['shipping_address_1'] = 'Shipping address 1';
62
- $columns['shipping_address_2'] = 'Shipping address 2';
63
- $columns['shipping_postcode'] = 'Shipping postcode';
64
- $columns['shipping_city'] = 'Shipping city';
65
- $columns['shipping_state'] = 'Shipping state';
66
- $columns['shipping_country'] = 'Shipping country';
67
 
68
  endif;
69
 
43
 
44
  if( is_plugin_active( 'woocommerce/woocommerce.php' ) ):
45
 
46
+ $columns['billing_first_name'] = 'billing_first_name';
47
+ $columns['billing_last_name'] = 'billing_last_name';
48
+ $columns['billing_company'] = 'billing_company';
49
+ $columns['billing_email'] = 'billing_email';
50
+ $columns['billing_phone'] = 'billing_phone';
51
+ $columns['billing_address_1'] = 'billing_address_1';
52
+ $columns['billing_address_2'] = 'billing_address_2';
53
+ $columns['billing_postcode'] = 'billing_postcode';
54
+ $columns['billing_city'] = 'billing_city';
55
+ $columns['billing_state'] = 'billing_state';
56
+ $columns['billing_country'] = 'billing_country';
57
+ $columns['shipping_first_name'] = 'shipping_first_name';
58
+ $columns['shipping_last_name'] = 'shipping_last_name';
59
+ $columns['shipping_company'] = 'shipping_company';
60
+ $columns['shipping_phone'] = 'shipping_phone';
61
+ $columns['shipping_address_1'] = 'shipping_address_1';
62
+ $columns['shipping_address_2'] = 'shipping_address_2';
63
+ $columns['shipping_postcode'] = 'shipping_postcode';
64
+ $columns['shipping_city'] = 'shipping_city';
65
+ $columns['shipping_state'] = 'shipping_state';
66
+ $columns['shipping_country'] = 'shipping_country';
67
 
68
  endif;
69
 
admin/modules/user/export/class-wt-customerimpexpcsv-basic-exporter.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) {
4
+ exit;
5
+ }
6
+
7
+ class Wt_Import_Export_For_Woo_Basic_User_Bulk_Export {
8
+
9
+ /**
10
+ * Customer Exporter
11
+ * @param array $user_IDS [optional]<p>Array of User Id.</p>
12
+ */
13
+ public static function do_export($user_IDS = array(), $ftp = null) {
14
+ global $wpdb;
15
+
16
+ $csv_columns = include_once( __DIR__ . '/../data/data-user-columns.php' );
17
+
18
+ $user_columns_name = !empty($_POST['columns_name']) ? $_POST['columns_name'] : $csv_columns;
19
+ $export_columns = !empty($_POST['columns']) ? $_POST['columns'] : array();
20
+ $delimiter = !empty($_POST['delimiter']) ? $_POST['delimiter'] : ',';
21
+
22
+ $wpdb->hide_errors();
23
+ @set_time_limit(0);
24
+ if (function_exists('apache_setenv'))
25
+ @apache_setenv('no-gzip', 1);
26
+ @ini_set('zlib.output_compression', 0);
27
+ @ob_end_clean();
28
+
29
+ $file_name = apply_filters('wt_iew_product_bulk_export_user_filename', 'user_export_' . date('Y-m-d-h-i-s') . '.csv');
30
+
31
+ header('Content-Type: text/csv; charset=UTF-8');
32
+ header('Content-Disposition: attachment; filename=' . $file_name);
33
+ header('Pragma: no-cache');
34
+ header('Expires: 0');
35
+
36
+ $fp = fopen('php://output', 'w');
37
+
38
+ $args = array(
39
+ 'fields' => 'ID'
40
+ );
41
+
42
+ if (!empty($user_IDS)) {
43
+ $args['include'] = $user_IDS; // An array of user IDs to include. Default empty array.
44
+ }
45
+
46
+ $users = get_users($args);
47
+
48
+ // Variable to hold the CSV data we're exporting
49
+ $row = array();
50
+
51
+ // Export header rows
52
+ foreach ($csv_columns as $column => $value) {
53
+
54
+ if (!$export_columns || in_array($column, $export_columns)) {
55
+ $temp_head = esc_attr($user_columns_name[$column]);
56
+ $row[] = $temp_head;
57
+ }
58
+ }
59
+
60
+ $row = array_map('Wt_Import_Export_For_Woo_Basic_User_Bulk_Export::wrap_column', apply_filters('wt_user_alter_csv_header', $row));
61
+ fwrite($fp, implode($delimiter, $row) . "\n");
62
+ $header_row = $row;
63
+ unset($row);
64
+
65
+ // Loop users
66
+ foreach ($users as $user) {
67
+ $data = self::get_customers_csv_row($user, $export_columns, $csv_columns, $header_row);
68
+ $data = apply_filters('hf_customer_csv_exclude_admin', $data);
69
+ $row = array_map('Wt_Import_Export_For_Woo_Basic_User_Bulk_Export::wrap_column', $data);
70
+ fwrite($fp, implode($delimiter, $row) . "\n");
71
+ unset($row);
72
+ unset($data);
73
+ }
74
+
75
+
76
+
77
+ fclose($fp);
78
+ exit;
79
+ }
80
+
81
+ public static function format_data($data) {
82
+ //if (!is_array($data));
83
+ //$data = (string) urldecode($data);
84
+ $enc = mb_detect_encoding($data, 'UTF-8, ISO-8859-1', true);
85
+ $data = ( $enc == 'UTF-8' ) ? $data : utf8_encode($data);
86
+ return $data;
87
+ }
88
+
89
+ /**
90
+ * Wrap a column in quotes for the CSV
91
+ * @param string data to wrap
92
+ * @return string wrapped data
93
+ */
94
+ public static function wrap_column($data) {
95
+ return '"' . str_replace('"', '""', $data) . '"';
96
+ }
97
+
98
+ /**
99
+ * Get the customer data for a single CSV row
100
+ * @since 3.0
101
+ * @param int $customer_id
102
+ * @param array $export_columns - user selected columns / all
103
+ * @return array $meta_keys customer/user meta data
104
+ */
105
+ public static function get_customers_csv_row($id, $export_columns, $csv_columns, $header_row) {
106
+ $user = get_user_by('id', $id);
107
+
108
+ $customer_data = array();
109
+ foreach ($csv_columns as $key) {
110
+ if (!$export_columns || in_array($key, $export_columns)) {
111
+ $key = trim(str_replace('meta:', '', $key));
112
+ if ($key == 'roles') {
113
+ $user_roles = (!empty($user->roles)) ? $user->roles : array();
114
+ $customer_data['roles'] = implode(', ', $user_roles);
115
+ continue;
116
+ }
117
+ if ( 'session_tokens' == $key ) {
118
+ $customer_data[$key] = !empty($user->{$key}) ? base64_encode(json_encode(maybe_unserialize($user->{$key}))) : '';
119
+ continue;
120
+ }
121
+ if ($key != 'customer_id') {
122
+ $customer_data[$key] = !empty($user->{$key}) ? maybe_serialize($user->{$key}) : '';
123
+ } else {
124
+ $customer_data[$key] = !empty($user->ID) ? maybe_serialize($user->ID) : '';
125
+ }
126
+ } else {
127
+ continue;
128
+ }
129
+ }
130
+
131
+ /*
132
+ * CSV Customer Export Row.
133
+ * Filter the individual row data for the customer export
134
+ * @since 3.0
135
+ * @param array $customer_data
136
+ */
137
+ return apply_filters('hf_customer_csv_export_data', $customer_data, $header_row);
138
+ }
139
+
140
+ }
admin/modules/user/import/import.php CHANGED
@@ -73,16 +73,16 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
73
  if($this->is_user_exist){
74
  $msg = 'User updated successfully.';
75
  }
76
- $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'post_id'=>$result['id']);
77
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - ".$msg);
78
  $success++;
79
  }else{
80
- $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'post_id'=>'');
81
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Processing failed. Reason: ".$result->get_error_message());
82
  $failed++;
83
  }
84
  }else{
85
- $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'post_id'=>'');
86
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: ".$parsed_data->get_error_message());
87
  $failed++;
88
  }
73
  if($this->is_user_exist){
74
  $msg = 'User updated successfully.';
75
  }
76
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$msg, 'status'=>true, 'status_msg' => __( 'Success' ), 'post_id'=>$result['id'], 'post_link' => Wt_Import_Export_For_Woo_basic_User::get_item_link_by_id($result['id']));
77
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - ".$msg);
78
  $success++;
79
  }else{
80
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$result->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
81
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Processing failed. Reason: ".$result->get_error_message());
82
  $failed++;
83
  }
84
  }else{
85
+ $this->import_results[$row] = array('row'=>$row, 'message'=>$parsed_data->get_error_message(), 'status'=>false, 'status_msg' => __( 'Failed/Skipped' ), 'post_id'=>'', 'post_link' => array( 'title' => __( 'Untitled' ), 'edit_url' => false ) );
86
  Wt_Import_Export_For_Woo_Basic_Logwriter::write_log($this->parent_module->module_base, 'import', "Row :$row - Parsing failed. Reason: ".$parsed_data->get_error_message());
87
  $failed++;
88
  }
admin/modules/user/user.php CHANGED
@@ -58,10 +58,63 @@ class Wt_Import_Export_For_Woo_basic_User {
58
  add_filter('wt_iew_exporter_do_export_basic', array($this, 'exporter_do_export'), 10, 7);
59
  add_filter('wt_iew_importer_do_import_basic', array($this, 'importer_do_import'), 10, 8);
60
 
61
- add_filter('wt_iew_importer_steps_basic', array($this, 'importer_steps'), 10, 2);
 
 
 
 
 
 
 
 
 
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  /**
66
  * Altering advanced step description
67
  */
@@ -548,12 +601,23 @@ class Wt_Import_Export_For_Woo_basic_User {
548
  }
549
 
550
  public function get_item_by_id($id) {
551
- $post['edit_url']=get_edit_user_link($id);
 
552
  $user_info = get_userdata($id);
553
- if($user_info)
554
- $post['title'] = $user_info->user_login;
 
555
  return $post;
556
  }
 
 
 
 
 
 
 
 
 
557
 
558
  }
559
  }
58
  add_filter('wt_iew_exporter_do_export_basic', array($this, 'exporter_do_export'), 10, 7);
59
  add_filter('wt_iew_importer_do_import_basic', array($this, 'importer_do_import'), 10, 8);
60
 
61
+ add_filter('wt_iew_importer_steps_basic', array($this, 'importer_steps'), 10, 2);
62
+
63
+ add_action('admin_footer', array($this, 'wt_add_user_bulk_actions'));
64
+ add_action('load-users.php', array($this, 'wt_process_user_bulk_actions'));
65
+
66
+ }
67
+
68
+
69
+
70
+ public function wt_add_user_bulk_actions() {
71
 
72
+ global $post_type, $post_status;
73
+
74
+ $screen = get_current_screen();
75
+ if ($screen->id != "users") // Only add to users.php page
76
+ return;
77
+ ?>
78
+ <script type="text/javascript">
79
+ jQuery(document).ready(function ($) {
80
+ var $downloadUsers = $('<option>').val('wt_ier_download_users').text('<?php _e('Export to CSV') ?>');
81
+ $('select[name^="action"]').append($downloadUsers);
82
+ });
83
+ </script>
84
+ <?php
85
+
86
  }
87
 
88
+ /**
89
+ * user page bulk export action
90
+ *
91
+ */
92
+ public function wt_process_user_bulk_actions() {
93
+ global $typenow;
94
+
95
+ $wp_list_table = _get_list_table('WP_Posts_List_Table');
96
+ $action = $wp_list_table->current_action();
97
+ if (!in_array($action, array('wt_ier_download_users'))) {
98
+ return;
99
+ }
100
+ // security check
101
+
102
+ check_admin_referer('bulk-users');
103
+
104
+ if (isset($_REQUEST['users'])) {
105
+ $user_ids = array_map('absint', $_REQUEST['users']);
106
+ }
107
+ if (empty($user_ids)) {
108
+ return;
109
+ }
110
+
111
+ if ($action == 'wt_ier_download_users') {
112
+ include_once( 'export/class-wt-customerimpexpcsv-basic-exporter.php' );
113
+ Wt_Import_Export_For_Woo_Basic_User_Bulk_Export::do_export($user_ids);
114
+ }
115
+
116
+ }
117
+
118
  /**
119
  * Altering advanced step description
120
  */
601
  }
602
 
603
  public function get_item_by_id($id) {
604
+ $post = array();
605
+ $post['edit_url'] = get_edit_user_link($id);
606
  $user_info = get_userdata($id);
607
+ if($user_info){
608
+ $post['title'] = $user_info->user_login;
609
+ }
610
  return $post;
611
  }
612
+ public static function get_item_link_by_id($id) {
613
+ $post = array();
614
+ $post['edit_url'] = get_edit_user_link($id);
615
+ $user_info = get_userdata($id);
616
+ if($user_info){
617
+ $post['title'] = $user_info->user_login;
618
+ }
619
+ return $post;
620
+ }
621
 
622
  }
623
  }
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.3.1';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
80
  if ( defined( 'WT_U_IEW_VERSION' ) ) {
81
  $this->version = WT_U_IEW_VERSION;
82
  } else {
83
+ $this->version = '2.3.2';
84
  }
85
  $this->plugin_name = 'wt-import-export-for-woo-basic';
86
 
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: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 2.3.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -28,7 +28,7 @@ WordPress User Import Export plugin allows the import and export of WordPress us
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 6.0
31
- &#128312; Tested OK with WooCommerce 6.5
32
  &#128312; Tested OK with PHP 8.0
33
 
34
  Highlights: WordPress Users Export, WordPress Users CSV Import Suite, Export WordPress Users to CSV. Pro Version supports export and import of all additional user meta like WooCommerce details.
@@ -208,6 +208,10 @@ Please refer the article on how to <a href="https://www.webtoffee.com/refresh-wo
208
 
209
  == Changelog ==
210
 
 
 
 
 
211
  = 2.3.1 2022-05-26 =
212
  * WordPress 6.0 Tested OK.
213
  * WooCommerce 6.5 Tested OK.
@@ -418,7 +422,7 @@ Please refer the article on how to <a href="https://www.webtoffee.com/refresh-wo
418
 
419
  == Upgrade Notice ==
420
 
421
- = 2.3.1 =
422
- * WordPress 6.0 Tested OK.
423
- * WooCommerce 6.5 Tested OK.
424
- * Enhancement: Option to choose delimiter when exporting.
5
  Requires at least: 3.0.1
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 2.3.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
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 6.0
31
+ &#128312; Tested OK with WooCommerce 6.6
32
  &#128312; Tested OK with PHP 8.0
33
 
34
  Highlights: WordPress Users Export, WordPress Users CSV Import Suite, Export WordPress Users to CSV. Pro Version supports export and import of all additional user meta like WooCommerce details.
208
 
209
  == Changelog ==
210
 
211
+ = 2.3.2 2022-07-05 =
212
+ * Enhancement: Export to CSV option to Bulk Action drop-down menu in Users listing page.
213
+ * Enhancement: Import progress screen improvements.
214
+ * WooCommerce 6.6 Tested OK.
215
  = 2.3.1 2022-05-26 =
216
  * WordPress 6.0 Tested OK.
217
  * WooCommerce 6.5 Tested OK.
422
 
423
  == Upgrade Notice ==
424
 
425
+ = 2.3.2 =
426
+ * Enhancement: Export to CSV option to Bulk Action drop-down menu in Users listing page.
427
+ * Enhancement: Import progress screen improvements.
428
+ * WooCommerce 6.6 Tested OK.
users-customers-import-export-for-wp-woocommerce.php CHANGED
@@ -5,10 +5,10 @@
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.3.1
9
  Text Domain: users-customers-import-export-for-wp-woocommerce
10
  Domain Path: /languages
11
- WC tested up to: 6.5
12
  Requires at least: 3.0
13
  Requires PHP: 5.6
14
  License: GPLv3
@@ -48,7 +48,7 @@ if (!defined('WT_IEW_DEBUG_BASIC_TROUBLESHOOT')) {
48
  * Start at version 1.0.0 and use SemVer - https://semver.org
49
  * Rename this for your plugin and update it as you release new versions.
50
  */
51
- define('WT_U_IEW_VERSION', '2.3.1');
52
 
53
  /**
54
  * The code that runs during plugin activation.
@@ -228,3 +228,18 @@ function wt_user_addon_basic_gopro_content() {
228
  }
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3.2
9
  Text Domain: users-customers-import-export-for-wp-woocommerce
10
  Domain Path: /languages
11
+ WC tested up to: 6.6
12
  Requires at least: 3.0
13
  Requires PHP: 5.6
14
  License: GPLv3
48
  * Start at version 1.0.0 and use SemVer - https://semver.org
49
  * Rename this for your plugin and update it as you release new versions.
50
  */
51
+ define('WT_U_IEW_VERSION', '2.3.2');
52
 
53
  /**
54
  * The code that runs during plugin activation.
228
  }
229
  }
230
 
231
+ /**
232
+ * Add Export to CSV link in users listing page near the filter button.
233
+ *
234
+ * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
235
+ */
236
+ function export_csv_linkin_user_listing_page($which) {
237
+
238
+ $currentScreen = get_current_screen();
239
+
240
+ if ('users' === $currentScreen->id) {
241
+ echo '<a target="_blank" href="' . admin_url('admin.php?page=wt_import_export_for_woo_basic_export&wt_to_export=user') . '" class="button" >' . __('Export to CSV') . ' </a>';
242
+ }
243
+ }
244
+
245
+ add_filter('manage_users_extra_tablenav', 'export_csv_linkin_user_listing_page');