Version Description
- New Feature: Update existing users.
- Improvement: Content updates.
- Improved UI for better user experience
- Tested OK with WC 4.9.0
- Version 2.0.0 onward has been revamped majorly.
Download this release
Release Info
Developer | webtoffee |
Plugin | Import Export WordPress Users and WooCommerce Customers |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- admin/class-wt-import-export-for-woo-admin.php +8 -0
- admin/classes/class-logwriter.php +2 -0
- admin/js/wt-import-export-for-woo-admin.js +7 -4
- admin/modules/export/assets/js/main.js +1 -0
- admin/modules/export/export.php +7 -6
- admin/modules/history/assets/js/main.js +1 -1
- admin/modules/history/views/settings.php +14 -2
- admin/modules/import/assets/js/main.js +35 -9
- admin/modules/import/import.php +33 -14
- admin/modules/import/views/_import_mapping_page.php +1 -1
- admin/modules/import/views/_import_method_import_page.php +1 -1
- admin/modules/import/views/main.php +10 -0
- admin/modules/user/import/import.php +10 -159
- admin/modules/user/user.php +31 -1
- includes/class-wt-import-export-for-woo.php +1 -1
- readme.txt +45 -17
- users-customers-import-export-for-wp-woocommerce.php +3 -3
admin/class-wt-import-export-for-woo-admin.php
CHANGED
@@ -56,6 +56,14 @@ class Wt_Import_Export_For_Woo_Admin_Basic {
|
|
56 |
|
57 |
public static $addon_modules=array();
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
/**
|
60 |
* Initialize the class and set its properties.
|
61 |
*
|
56 |
|
57 |
public static $addon_modules=array();
|
58 |
|
59 |
+
/*
|
60 |
+
* WebToffee data identifier, this variable used for identify that the data is belongs to WebToffee Import/Export.
|
61 |
+
* Use1: used in evaluation operators prefix.
|
62 |
+
* Use2: We can use this for identify WebToffee operations (@[]/+-*) etc
|
63 |
+
* !!!important: Do not change this value frequently
|
64 |
+
*/
|
65 |
+
public static $wt_iew_prefix = 'wt_iew';
|
66 |
+
|
67 |
/**
|
68 |
* Initialize the class and set its properties.
|
69 |
*
|
admin/classes/class-logwriter.php
CHANGED
@@ -53,6 +53,7 @@ class Wt_Import_Export_For_Woo_Basic_Logwriter extends Wt_Import_Export_For_Woo_
|
|
53 |
*/
|
54 |
public static function write_log($post_type, $action_type, $data)
|
55 |
{
|
|
|
56 |
/**
|
57 |
* Checks log file created for the current day
|
58 |
*/
|
@@ -77,6 +78,7 @@ class Wt_Import_Export_For_Woo_Basic_Logwriter extends Wt_Import_Export_For_Woo_
|
|
77 |
{
|
78 |
self::write_row($date_string." - ".$data);
|
79 |
}
|
|
|
80 |
}
|
81 |
|
82 |
/**
|
53 |
*/
|
54 |
public static function write_log($post_type, $action_type, $data)
|
55 |
{
|
56 |
+
if(Wt_Import_Export_For_Woo_Basic_Common_Helper::get_advanced_settings('enable_import_log')==1){
|
57 |
/**
|
58 |
* Checks log file created for the current day
|
59 |
*/
|
78 |
{
|
79 |
self::write_row($date_string." - ".$data);
|
80 |
}
|
81 |
+
}
|
82 |
}
|
83 |
|
84 |
/**
|
admin/js/wt-import-export-for-woo-admin.js
CHANGED
@@ -579,16 +579,19 @@ var wt_iew_custom_and_preset=
|
|
579 |
{
|
580 |
toggler:function(preset_elm, custom_elm, custom_val) /* Toggle between custom and preset value */
|
581 |
{
|
582 |
-
this.do_toggle(preset_elm, custom_elm, custom_val);
|
583 |
preset_elm.unbind('change').change(function(){
|
584 |
-
wt_iew_custom_and_preset.do_toggle(preset_elm, custom_elm, custom_val);
|
585 |
});
|
586 |
},
|
587 |
-
do_toggle:function(preset_elm, custom_elm, custom_val)
|
588 |
{
|
589 |
if(preset_elm.val()==custom_val)
|
590 |
{
|
591 |
-
custom_elm.prop('readonly', false).css({'background':'#ffffff'}).focus()
|
|
|
|
|
|
|
592 |
}else
|
593 |
{
|
594 |
custom_elm.prop('readonly', true).css({'background':'#efefef'}).val(preset_elm.find('option:selected').attr('data-val'));
|
579 |
{
|
580 |
toggler:function(preset_elm, custom_elm, custom_val) /* Toggle between custom and preset value */
|
581 |
{
|
582 |
+
this.do_toggle(preset_elm, custom_elm, custom_val,true);
|
583 |
preset_elm.unbind('change').change(function(){
|
584 |
+
wt_iew_custom_and_preset.do_toggle(preset_elm, custom_elm, custom_val,false);
|
585 |
});
|
586 |
},
|
587 |
+
do_toggle:function(preset_elm, custom_elm, custom_val, first_load)
|
588 |
{
|
589 |
if(preset_elm.val()==custom_val)
|
590 |
{
|
591 |
+
custom_elm.prop('readonly', false).css({'background':'#ffffff'}).focus();
|
592 |
+
if(!first_load){
|
593 |
+
custom_elm.val('');
|
594 |
+
}
|
595 |
}else
|
596 |
{
|
597 |
custom_elm.prop('readonly', true).css({'background':'#efefef'}).val(preset_elm.find('option:selected').attr('data-val'));
|
admin/modules/export/assets/js/main.js
CHANGED
@@ -314,6 +314,7 @@ var wt_iew_basic_export=(function( $ ) {
|
|
314 |
{
|
315 |
$('.wt_iew_export_action_btn').unbind('click').click(function(e){
|
316 |
e.preventDefault();
|
|
|
317 |
var action=$(this).attr('data-action');
|
318 |
var action_type=$(this).attr('data-action-type');
|
319 |
var is_previous_step=wt_iew_basic_export.is_previous_step(action);
|
314 |
{
|
315 |
$('.wt_iew_export_action_btn').unbind('click').click(function(e){
|
316 |
e.preventDefault();
|
317 |
+
wt_iew_basic_export.remove_ajax_page_loader(); /* remove any loader that are open */
|
318 |
var action=$(this).attr('data-action');
|
319 |
var action_type=$(this).attr('data-action-type');
|
320 |
var is_previous_step=wt_iew_basic_export.is_previous_step(action);
|
admin/modules/export/export.php
CHANGED
@@ -80,9 +80,9 @@ class Wt_Import_Export_For_Woo_Basic_Export
|
|
80 |
|
81 |
|
82 |
$this->export_methods=array(
|
83 |
-
'quick'=>array('title'=>__('Quick export'), 'description'=> __('Quick export only exports
|
84 |
-
'template'=>array('title'=>__('Pre-saved template'), 'description'=> __('
|
85 |
-
'new'=>array('title'=>__('
|
86 |
);
|
87 |
|
88 |
/* advanced plugin settings */
|
@@ -274,7 +274,7 @@ class Wt_Import_Export_For_Woo_Basic_Export
|
|
274 |
'type'=>'text',
|
275 |
'value'=>$this->default_batch_count,
|
276 |
'field_name'=>'batch_count',
|
277 |
-
'help_text'=>
|
278 |
'validation_rule'=>array('type'=>'absint'),
|
279 |
)
|
280 |
);
|
@@ -539,7 +539,7 @@ class Wt_Import_Export_For_Woo_Basic_Export
|
|
539 |
$total_records=0;
|
540 |
if(isset($form_data['advanced_form_data']))
|
541 |
{
|
542 |
-
|
543 |
$file_as=(isset($form_data['advanced_form_data']['wt_iew_file_as']) ? $form_data['advanced_form_data']['wt_iew_file_as'] : 'csv');
|
544 |
$csv_delimiter=(isset($form_data['advanced_form_data']['wt_iew_delimiter']) ? $form_data['advanced_form_data']['wt_iew_delimiter'] : ',');
|
545 |
$csv_delimiter=($csv_delimiter=="" ? ',' : $csv_delimiter);
|
@@ -677,7 +677,8 @@ class Wt_Import_Export_For_Woo_Basic_Export
|
|
677 |
}
|
678 |
|
679 |
$msg.='<br /><br /><a class="button button-secondary" style="margin-top:5px;" onclick="wt_iew_basic_export.hide_export_info_box();">'.__('Close').'</a>';
|
680 |
-
$msg.='<a class="button button-secondary" style="margin-top:5px;" target="_blank" href="'.$out['file_url'].'" >'.__('Download file').'</a></span>';
|
|
|
681 |
|
682 |
$out['msg']=$msg;
|
683 |
|
80 |
|
81 |
|
82 |
$this->export_methods=array(
|
83 |
+
'quick'=>array('title'=>__('Quick export'), 'description'=> __('Quick export only exports the basic/standard fields of the respective post type.')),
|
84 |
+
'template'=>array('title'=>__('Pre-saved template'), 'description'=> __('This option exports data as per the specifications(filters,selective column,mapping etc) from the previously saved file.')),
|
85 |
+
'new'=>array('title'=>__('Advanced export'), 'description'=> __('This option will take you through a detailed process of data filtering/column selection/advanced options that may be required for your export. You can also save this file for future use.')),
|
86 |
);
|
87 |
|
88 |
/* advanced plugin settings */
|
274 |
'type'=>'text',
|
275 |
'value'=>$this->default_batch_count,
|
276 |
'field_name'=>'batch_count',
|
277 |
+
'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'),
|
278 |
'validation_rule'=>array('type'=>'absint'),
|
279 |
)
|
280 |
);
|
539 |
$total_records=0;
|
540 |
if(isset($form_data['advanced_form_data']))
|
541 |
{
|
542 |
+
$batch_count=(isset($form_data['advanced_form_data']['wt_iew_batch_count']) && (int)$form_data['advanced_form_data']['wt_iew_batch_count'] > 0 ? $form_data['advanced_form_data']['wt_iew_batch_count'] : $batch_count);
|
543 |
$file_as=(isset($form_data['advanced_form_data']['wt_iew_file_as']) ? $form_data['advanced_form_data']['wt_iew_file_as'] : 'csv');
|
544 |
$csv_delimiter=(isset($form_data['advanced_form_data']['wt_iew_delimiter']) ? $form_data['advanced_form_data']['wt_iew_delimiter'] : ',');
|
545 |
$csv_delimiter=($csv_delimiter=="" ? ',' : $csv_delimiter);
|
677 |
}
|
678 |
|
679 |
$msg.='<br /><br /><a class="button button-secondary" style="margin-top:5px;" onclick="wt_iew_basic_export.hide_export_info_box();">'.__('Close').'</a>';
|
680 |
+
$msg.='<a class="button button-secondary" style="margin-top:5px;" onclick="wt_iew_basic_export.hide_export_info_box();" target="_blank" href="'.$out['file_url'].'" >'.__('Download file').'</a></span>';
|
681 |
+
|
682 |
|
683 |
$out['msg']=$msg;
|
684 |
|
admin/modules/history/assets/js/main.js
CHANGED
@@ -11,7 +11,7 @@ var wt_iew_basic_history=(function( $ ) {
|
|
11 |
},
|
12 |
reg_view_log:function()
|
13 |
{
|
14 |
-
jQuery('.wt_iew_view_log_btn
|
15 |
wt_iew_basic_history.show_log_popup();
|
16 |
var history_id=$(this).attr('data-history-id');
|
17 |
if(history_id>0)
|
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)
|
admin/modules/history/views/settings.php
CHANGED
@@ -25,10 +25,22 @@ select.wt_iew_bulk_action{ float:left; width:auto; height:20px; margin-right:10p
|
|
25 |
.log_view_tb th, .log_view_tb td{ text-align:center; }
|
26 |
.log_list_tb .log_file_name_col{ text-align:left; }
|
27 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
<div class="wt_iew_view_log wt_iew_popup">
|
29 |
<div class="wt_iew_popup_hd">
|
30 |
<span style="line-height:40px;" class="dashicons dashicons-media-text"></span>
|
31 |
-
<span class="wt_iew_popup_hd_label"><?php _e('
|
32 |
<div class="wt_iew_popup_close">X</div>
|
33 |
</div>
|
34 |
<div class="wt_iew_log_container">
|
@@ -36,7 +48,7 @@ select.wt_iew_bulk_action{ float:left; width:auto; height:20px; margin-right:10p
|
|
36 |
</div>
|
37 |
</div>
|
38 |
<?php
|
39 |
-
if(
|
40 |
{
|
41 |
include plugin_dir_path(__FILE__)."/_log_list.php";
|
42 |
}else
|
25 |
.log_view_tb th, .log_view_tb td{ text-align:center; }
|
26 |
.log_list_tb .log_file_name_col{ text-align:left; }
|
27 |
</style>
|
28 |
+
<?php
|
29 |
+
if(isset($_GET['page']) && $_GET['page']==$this->module_id.'_log')
|
30 |
+
{
|
31 |
+
$page =$this->module_id.'_log';
|
32 |
+
$popup_hd_label = 'Log';
|
33 |
+
}else
|
34 |
+
{
|
35 |
+
$page =$this->module_id;
|
36 |
+
$popup_hd_label = 'History';
|
37 |
+
}
|
38 |
+
?>
|
39 |
+
|
40 |
<div class="wt_iew_view_log wt_iew_popup">
|
41 |
<div class="wt_iew_popup_hd">
|
42 |
<span style="line-height:40px;" class="dashicons dashicons-media-text"></span>
|
43 |
+
<span class="wt_iew_popup_hd_label"><?php _e($popup_hd_label.' Details');?></span>
|
44 |
<div class="wt_iew_popup_close">X</div>
|
45 |
</div>
|
46 |
<div class="wt_iew_log_container">
|
48 |
</div>
|
49 |
</div>
|
50 |
<?php
|
51 |
+
if($page==$this->module_id.'_log')
|
52 |
{
|
53 |
include plugin_dir_path(__FILE__)."/_log_list.php";
|
54 |
}else
|
admin/modules/import/assets/js/main.js
CHANGED
@@ -742,6 +742,15 @@ var wt_iew_basic_import=(function( $ ) {
|
|
742 |
{
|
743 |
wt_iew_file_attacher.Set();
|
744 |
wt_iew_form_toggler.runToggler();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
}
|
746 |
else if(this.current_step=='advanced')
|
747 |
{
|
@@ -855,6 +864,8 @@ var wt_iew_basic_import=(function( $ ) {
|
|
855 |
wt_iew_custom_and_preset.date_format_toggler();
|
856 |
|
857 |
wt_iew_dropzone.init('wt_iew_local_file_dropzone');
|
|
|
|
|
858 |
}
|
859 |
else if(step=='mapping') /* mapping page */
|
860 |
{
|
@@ -1078,7 +1089,7 @@ var wt_iew_basic_import=(function( $ ) {
|
|
1078 |
m.forEach((match, groupIndex) => {
|
1079 |
|
1080 |
/* check date format matching */
|
1081 |
-
var match_arr=match.split('@');
|
1082 |
if(match_arr.length==2)/* date format matched */
|
1083 |
{
|
1084 |
match=match_arr[0];
|
@@ -1168,7 +1179,7 @@ var wt_iew_basic_import=(function( $ ) {
|
|
1168 |
m.forEach((match, groupIndex) => {
|
1169 |
|
1170 |
/* check date format matching */
|
1171 |
-
var match_arr=match.split('@');
|
1172 |
if(match_arr.length==2)/* date format matched */
|
1173 |
{
|
1174 |
match=match_arr[0];
|
@@ -1186,7 +1197,7 @@ var wt_iew_basic_import=(function( $ ) {
|
|
1186 |
|
1187 |
if(match_arr.length==2)/* date format matched */
|
1188 |
{
|
1189 |
-
match=match_arr.join('@');
|
1190 |
if(sample_vl!="")
|
1191 |
{
|
1192 |
sample_vl=mapping_field_editor.format_date(sample_vl);
|
@@ -1273,6 +1284,26 @@ var wt_iew_dropzone=
|
|
1273 |
return false;
|
1274 |
}
|
1275 |
Dropzone.autoDiscover = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1276 |
},
|
1277 |
init:function(elm_id)
|
1278 |
{
|
@@ -1359,18 +1390,13 @@ var wt_iew_dropzone=
|
|
1359 |
/* remove file obj */
|
1360 |
drop_zone_obj.removeFile(file);
|
1361 |
|
1362 |
-
/* register file deleting event */
|
1363 |
-
wt_iew_dropzone.remove_file();
|
1364 |
|
1365 |
if(wt_iew_dropzone.isJson(response))
|
1366 |
{
|
1367 |
response=JSON.parse(response);
|
1368 |
if(response.status==1)
|
1369 |
{
|
1370 |
-
|
1371 |
-
jQuery(".wt_iew_dz_remove_link").html(wt_iew_import_basic_params.msgs.remove);
|
1372 |
-
jQuery(".wt_iew_dz_file_name").html(file_name);
|
1373 |
-
jQuery(".dz-message").css({'margin-top':'60px'});
|
1374 |
|
1375 |
var dropzone_target=wt_iew_dropzone.elm.attr('wt_iew_dropzone_target');
|
1376 |
var dropzone_target_elm=jQuery(dropzone_target);
|
742 |
{
|
743 |
wt_iew_file_attacher.Set();
|
744 |
wt_iew_form_toggler.runToggler();
|
745 |
+
|
746 |
+
if(this.import_method == 'template'){
|
747 |
+
if( this.selected_template == 0){
|
748 |
+
$('.wt-iew-import-method-options-template').not('.wt-iew-import-template-sele-tr').hide();
|
749 |
+
}else{
|
750 |
+
$('.wt-iew-import-method-options-template').show();
|
751 |
+
}
|
752 |
+
|
753 |
+
}
|
754 |
}
|
755 |
else if(this.current_step=='advanced')
|
756 |
{
|
864 |
wt_iew_custom_and_preset.date_format_toggler();
|
865 |
|
866 |
wt_iew_dropzone.init('wt_iew_local_file_dropzone');
|
867 |
+
/* Auto populate template file. */
|
868 |
+
wt_iew_dropzone.auto_populate();
|
869 |
}
|
870 |
else if(step=='mapping') /* mapping page */
|
871 |
{
|
1089 |
m.forEach((match, groupIndex) => {
|
1090 |
|
1091 |
/* check date format matching */
|
1092 |
+
var match_arr=match.split(wt_iew_import_basic_params.wt_iew_prefix+'@');
|
1093 |
if(match_arr.length==2)/* date format matched */
|
1094 |
{
|
1095 |
match=match_arr[0];
|
1179 |
m.forEach((match, groupIndex) => {
|
1180 |
|
1181 |
/* check date format matching */
|
1182 |
+
var match_arr=match.split(wt_iew_import_basic_params.wt_iew_prefix+'@');
|
1183 |
if(match_arr.length==2)/* date format matched */
|
1184 |
{
|
1185 |
match=match_arr[0];
|
1197 |
|
1198 |
if(match_arr.length==2)/* date format matched */
|
1199 |
{
|
1200 |
+
match=match_arr.join(wt_iew_import_basic_params.wt_iew_prefix+'@');
|
1201 |
if(sample_vl!="")
|
1202 |
{
|
1203 |
sample_vl=mapping_field_editor.format_date(sample_vl);
|
1284 |
return false;
|
1285 |
}
|
1286 |
Dropzone.autoDiscover = false;
|
1287 |
+
this.auto_populate();
|
1288 |
+
},
|
1289 |
+
auto_populate:function()
|
1290 |
+
{
|
1291 |
+
var template_val=jQuery.trim(jQuery('#local_file').val());
|
1292 |
+
if(template_val!="")
|
1293 |
+
{
|
1294 |
+
var file_name=template_val.split('/').pop();
|
1295 |
+
this.set_success(file_name);
|
1296 |
+
}
|
1297 |
+
},
|
1298 |
+
set_success:function(file_name)
|
1299 |
+
{
|
1300 |
+
jQuery(".wt_iew_dz_file_success").html(wt_iew_import_basic_params.msgs.upload_done);
|
1301 |
+
jQuery(".wt_iew_dz_remove_link").html(wt_iew_import_basic_params.msgs.remove);
|
1302 |
+
jQuery(".wt_iew_dz_file_name").html(file_name);
|
1303 |
+
jQuery(".dz-message").css({'margin-top':'60px'});
|
1304 |
+
|
1305 |
+
/* register file deleting event */
|
1306 |
+
wt_iew_dropzone.remove_file();
|
1307 |
},
|
1308 |
init:function(elm_id)
|
1309 |
{
|
1390 |
/* remove file obj */
|
1391 |
drop_zone_obj.removeFile(file);
|
1392 |
|
|
|
|
|
1393 |
|
1394 |
if(wt_iew_dropzone.isJson(response))
|
1395 |
{
|
1396 |
response=JSON.parse(response);
|
1397 |
if(response.status==1)
|
1398 |
{
|
1399 |
+
wt_iew_dropzone.set_success(file_name);
|
|
|
|
|
|
|
1400 |
|
1401 |
var dropzone_target=wt_iew_dropzone.elm.attr('wt_iew_dropzone_target');
|
1402 |
var dropzone_target_elm=jQuery(dropzone_target);
|
admin/modules/import/import.php
CHANGED
@@ -74,9 +74,9 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
74 |
);
|
75 |
|
76 |
$this->import_methods=array(
|
77 |
-
'quick'=>array('title'=>__('Quick import'), 'description'=> __('
|
78 |
-
'template'=>array('title'=>__('Pre-saved template'), 'description'=> __('Using a pre-saved template retains the previous filter criteria and other column specifications as per the chosen file and imports data accordingly
|
79 |
-
'new'=>array('title'=>__('
|
80 |
);
|
81 |
|
82 |
/* advanced plugin settings */
|
@@ -150,7 +150,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
150 |
'type'=>'text',
|
151 |
'value'=>$this->default_batch_count,
|
152 |
'field_name'=>'batch_count',
|
153 |
-
'help_text'=>
|
154 |
'validation_rule'=>array('type'=>'absint'),
|
155 |
)
|
156 |
);
|
@@ -185,7 +185,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
185 |
$file_from_field_arr=array(
|
186 |
'label'=>__("Choose file for Import"),
|
187 |
'type'=>'select',
|
188 |
-
'tr_class'=>'wt-iew-import-method-options wt-iew-import-method-options-quick wt-iew-import-method-options-new',
|
189 |
'sele_vals'=>$file_from_arr,
|
190 |
'field_name'=>'file_from',
|
191 |
'default_value'=>'local',
|
@@ -231,7 +231,8 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
231 |
'sele_vals'=>Wt_Iew_IE_Basic_Helper::_get_csv_delimiters(),
|
232 |
'help_text'=>__('Only applicable for CSV imports in order to separate the columns in the CSV file. Takes comma(,) by default.'),
|
233 |
'validation_rule'=>array('type'=>'skip'),
|
234 |
-
|
|
|
235 |
);
|
236 |
|
237 |
|
@@ -353,7 +354,14 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
353 |
//wp_enqueue_media();
|
354 |
|
355 |
wp_enqueue_style(WT_IEW_PLUGIN_ID_BASIC.'-jquery-ui', WT_U_IEW_PLUGIN_URL.'admin/css/jquery-ui.css', array(), WT_U_IEW_VERSION, 'all');
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
$file_extensions=array_keys($this->allowed_import_file_type_mime);
|
358 |
$file_extensions=array_map(function($vl){
|
359 |
return '.'.$vl;
|
@@ -368,6 +376,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
368 |
'temp_import_file'=>$this->temp_import_file,
|
369 |
'allowed_import_file_type_mime'=>$file_extensions,
|
370 |
'max_import_file_size'=>$this->max_import_file_size,
|
|
|
371 |
'msgs'=>array(
|
372 |
'choosed_template'=>__('Choosed template: '),
|
373 |
'choose_import_method'=>__('Please select an import method.'),
|
@@ -937,6 +946,18 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
937 |
/* in scheduled import. The import method will not available so we need to take it from formdata */
|
938 |
$formdata_import_method=(isset($formdata['method_import_form_data']) && isset($formdata['method_import_form_data']['method_import']) ? $formdata['method_import_form_data']['method_import'] : 'quick');
|
939 |
$this->import_method=($this->import_method=="" ? $formdata_import_method : $this->import_method);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
940 |
|
941 |
/**
|
942 |
* Import response format
|
@@ -954,7 +975,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
954 |
/**
|
955 |
* Writing import log to file
|
956 |
*/
|
957 |
-
if(!empty($import_response) && is_array($import_response)
|
958 |
{
|
959 |
$log_writer=new Wt_Import_Export_For_Woo_Basic_Logwriter();
|
960 |
$log_file_name=$this->get_log_file_name($import_id);
|
@@ -1029,6 +1050,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
1029 |
if($is_last_offset)
|
1030 |
{
|
1031 |
$msg='<span class="wt_iew_info_box_title">'.__('Finished').'</span>';
|
|
|
1032 |
}else
|
1033 |
{
|
1034 |
$msg='<span class="wt_iew_info_box_title">'.sprintf(__('Importing...(%d done)'), $data['offset_count']).'</span>';
|
@@ -1036,14 +1058,11 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
1036 |
$msg.='<br />'.__('Total success: ').$data['total_success'].'<br />'.__('Total failed: ').$data['total_failed'];
|
1037 |
if($is_last_offset)
|
1038 |
{
|
1039 |
-
$msg.='<span class="wt_iew_info_box_finished_text">';
|
1040 |
if(Wt_Import_Export_For_Woo_Admin_Basic::module_exists('history'))
|
1041 |
{
|
1042 |
-
$
|
1043 |
-
$history_page_url=admin_url('admin.php?page='.$history_module_id);
|
1044 |
-
$msg.='<br />'.sprintf(__('View detailed log from %s History %s section'), '<a href="'.$history_page_url.'" target="_blank">', '</a>');
|
1045 |
}
|
1046 |
-
$msg.='<br /><a class="button button-secondary" style="margin-top:5px;" onclick="wt_iew_basic_import.hide_import_info_box();">'.__('Close').'</a></span>';
|
1047 |
}
|
1048 |
return $msg;
|
1049 |
}
|
@@ -1222,7 +1241,7 @@ class Wt_Import_Export_For_Woo_Basic_Import
|
|
1222 |
$data_key=trim($value[1]);
|
1223 |
|
1224 |
/* Check for date formatting */
|
1225 |
-
$data_key_arr=explode("@", $data_key);
|
1226 |
$data_format='';
|
1227 |
if(count($data_key_arr)==2) /* date format field given while on import */
|
1228 |
{
|
74 |
);
|
75 |
|
76 |
$this->import_methods=array(
|
77 |
+
'quick'=>array('title'=>__('Quick import'), 'description'=> __('Use this option primarily when your input file was exported using the same plugin.')),
|
78 |
+
'template'=>array('title'=>__('Pre-saved template'), 'description'=> __('Using a pre-saved template retains the previous filter criteria and other column specifications as per the chosen file and imports data accordingly')),
|
79 |
+
'new'=>array('title'=>__('Advanced Import'), 'description'=> __('This option will take you through the entire process of filtering/column selection/advanced options that may be required for your import. You can also save your selections as a template for future use.')),
|
80 |
);
|
81 |
|
82 |
/* advanced plugin settings */
|
150 |
'type'=>'text',
|
151 |
'value'=>$this->default_batch_count,
|
152 |
'field_name'=>'batch_count',
|
153 |
+
'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.'),
|
154 |
'validation_rule'=>array('type'=>'absint'),
|
155 |
)
|
156 |
);
|
185 |
$file_from_field_arr=array(
|
186 |
'label'=>__("Choose file for Import"),
|
187 |
'type'=>'select',
|
188 |
+
'tr_class'=>'wt-iew-import-method-options wt-iew-import-method-options-quick wt-iew-import-method-options-new wt-iew-import-method-options-template',
|
189 |
'sele_vals'=>$file_from_arr,
|
190 |
'field_name'=>'file_from',
|
191 |
'default_value'=>'local',
|
231 |
'sele_vals'=>Wt_Iew_IE_Basic_Helper::_get_csv_delimiters(),
|
232 |
'help_text'=>__('Only applicable for CSV imports in order to separate the columns in the CSV file. Takes comma(,) by default.'),
|
233 |
'validation_rule'=>array('type'=>'skip'),
|
234 |
+
'after_form_field'=>'<input type="text" class="wt_iew_custom_delimiter" name="wt_iew_delimiter" value="'.(!empty($method_import_form_data['wt_iew_delimiter']) ? $method_import_form_data['wt_iew_delimiter'] : ",").'" />',
|
235 |
+
|
236 |
);
|
237 |
|
238 |
|
354 |
//wp_enqueue_media();
|
355 |
|
356 |
wp_enqueue_style(WT_IEW_PLUGIN_ID_BASIC.'-jquery-ui', WT_U_IEW_PLUGIN_URL.'admin/css/jquery-ui.css', array(), WT_U_IEW_VERSION, 'all');
|
357 |
+
|
358 |
+
/* check the history module is available */
|
359 |
+
$history_module_obj=Wt_Import_Export_For_Woo_Basic::load_modules('history');
|
360 |
+
if(!is_null($history_module_obj))
|
361 |
+
{
|
362 |
+
wp_enqueue_script(Wt_Import_Export_For_Woo_Basic::get_module_id('history'),WT_U_IEW_PLUGIN_URL.'admin/modules/history/assets/js/main.js', array('jquery'), WT_U_IEW_VERSION, false);
|
363 |
+
}
|
364 |
+
|
365 |
$file_extensions=array_keys($this->allowed_import_file_type_mime);
|
366 |
$file_extensions=array_map(function($vl){
|
367 |
return '.'.$vl;
|
376 |
'temp_import_file'=>$this->temp_import_file,
|
377 |
'allowed_import_file_type_mime'=>$file_extensions,
|
378 |
'max_import_file_size'=>$this->max_import_file_size,
|
379 |
+
'wt_iew_prefix'=>Wt_Import_Export_For_Woo_Admin_Basic::$wt_iew_prefix,
|
380 |
'msgs'=>array(
|
381 |
'choosed_template'=>__('Choosed template: '),
|
382 |
'choose_import_method'=>__('Please select an import method.'),
|
946 |
/* in scheduled import. The import method will not available so we need to take it from formdata */
|
947 |
$formdata_import_method=(isset($formdata['method_import_form_data']) && isset($formdata['method_import_form_data']['method_import']) ? $formdata['method_import_form_data']['method_import'] : 'quick');
|
948 |
$this->import_method=($this->import_method=="" ? $formdata_import_method : $this->import_method);
|
949 |
+
|
950 |
+
/* no form data to process/Couldnt get any data from csv */
|
951 |
+
// if($this->import_method == 'quick'){
|
952 |
+
if(empty($form_data['mapping_form_data']['mapping_fields'])){
|
953 |
+
$msg='Invalid data/Delimter not right';
|
954 |
+
//no need to add translation function in message
|
955 |
+
Wt_Import_Export_For_Woo_History::record_failure($import_id, $msg);
|
956 |
+
$out['msg']=__($msg);
|
957 |
+
return $out;
|
958 |
+
|
959 |
+
}
|
960 |
+
// }
|
961 |
|
962 |
/**
|
963 |
* Import response format
|
975 |
/**
|
976 |
* Writing import log to file
|
977 |
*/
|
978 |
+
if(!empty($import_response) && is_array($import_response))
|
979 |
{
|
980 |
$log_writer=new Wt_Import_Export_For_Woo_Basic_Logwriter();
|
981 |
$log_file_name=$this->get_log_file_name($import_id);
|
1050 |
if($is_last_offset)
|
1051 |
{
|
1052 |
$msg='<span class="wt_iew_info_box_title">'.__('Finished').'</span>';
|
1053 |
+
$msg.='<span class="wt_iew_popup_close" style="line-height:10px;width:auto" onclick="wt_iew_basic_import.hide_import_info_box();">X</span>';
|
1054 |
}else
|
1055 |
{
|
1056 |
$msg='<span class="wt_iew_info_box_title">'.sprintf(__('Importing...(%d done)'), $data['offset_count']).'</span>';
|
1058 |
$msg.='<br />'.__('Total success: ').$data['total_success'].'<br />'.__('Total failed: ').$data['total_failed'];
|
1059 |
if($is_last_offset)
|
1060 |
{
|
1061 |
+
$msg.='<span class="wt_iew_info_box_finished_text" style="display:block">';
|
1062 |
if(Wt_Import_Export_For_Woo_Admin_Basic::module_exists('history'))
|
1063 |
{
|
1064 |
+
$msg.='<a class="button button-secondary wt_iew_view_log_btn" style="margin-top:10px;" data-history-id="'. $data['history_id'] .'" onclick="wt_iew_basic_import.hide_import_info_box();">'.__('View Details').'</a></span>';
|
|
|
|
|
1065 |
}
|
|
|
1066 |
}
|
1067 |
return $msg;
|
1068 |
}
|
1241 |
$data_key=trim($value[1]);
|
1242 |
|
1243 |
/* Check for date formatting */
|
1244 |
+
$data_key_arr=explode(Wt_Import_Export_For_Woo_Admin_Basic::$wt_iew_prefix."@", $data_key);
|
1245 |
$data_format='';
|
1246 |
if(count($data_key_arr)==2) /* date format field given while on import */
|
1247 |
{
|
admin/modules/import/views/_import_mapping_page.php
CHANGED
@@ -278,5 +278,5 @@ if (!defined('ABSPATH')) {
|
|
278 |
?>
|
279 |
</div>
|
280 |
<script type="text/javascript">
|
281 |
-
|
282 |
</script>
|
278 |
?>
|
279 |
</div>
|
280 |
<script type="text/javascript">
|
281 |
+
var wt_iew_file_head_remaining_meta=<?php echo json_encode(wt_iew_utf8ize_basic($file_heading_meta_fields));?>;
|
282 |
</script>
|
admin/modules/import/views/_import_method_import_page.php
CHANGED
@@ -28,7 +28,7 @@ if (!defined('ABSPATH')) {
|
|
28 |
</td>
|
29 |
</tr>
|
30 |
|
31 |
-
<tr class="wt-iew-import-method-options wt-iew-import-method-options-template" style="display:none;">
|
32 |
<th><label><?php _e('Import template');?></label></th>
|
33 |
<td>
|
34 |
<select class="wt-iew-import-template-sele">
|
28 |
</td>
|
29 |
</tr>
|
30 |
|
31 |
+
<tr class="wt-iew-import-method-options wt-iew-import-method-options-template wt-iew-import-template-sele-tr" style="display:none;">
|
32 |
<th><label><?php _e('Import template');?></label></th>
|
33 |
<td>
|
34 |
<select class="wt-iew-import-template-sele">
|
admin/modules/import/views/main.php
CHANGED
@@ -20,6 +20,16 @@ do_action('wt_iew_importer_before_head');
|
|
20 |
.wt_iew_import_main{ padding:20px 0px; }
|
21 |
select[name=wt_iew_file_from]{visibility: hidden;}
|
22 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<?php
|
24 |
Wt_Iew_IE_Basic_Helper::debug_panel($this->module_base);
|
25 |
?>
|
20 |
.wt_iew_import_main{ padding:20px 0px; }
|
21 |
select[name=wt_iew_file_from]{visibility: hidden;}
|
22 |
</style>
|
23 |
+
<div class="wt_iew_view_log wt_iew_popup" style="text-align:left">
|
24 |
+
<div class="wt_iew_popup_hd">
|
25 |
+
<span style="line-height:40px;" class="dashicons dashicons-media-text"></span>
|
26 |
+
<span class="wt_iew_popup_hd_label"><?php _e('History Details');?></span>
|
27 |
+
<div class="wt_iew_popup_close">X</div>
|
28 |
+
</div>
|
29 |
+
<div class="wt_iew_log_container" style="padding:25px;">
|
30 |
+
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
<?php
|
34 |
Wt_Iew_IE_Basic_Helper::debug_panel($this->module_base);
|
35 |
?>
|
admin/modules/user/import/import.php
CHANGED
@@ -12,20 +12,6 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
12 |
|
13 |
|
14 |
var $merge;
|
15 |
-
var $skip_new;
|
16 |
-
var $use_sku;
|
17 |
-
var $cmd_type;
|
18 |
-
var $merge_empty_cells;
|
19 |
-
var $delete_existing;
|
20 |
-
var $new_id = array();
|
21 |
-
var $parent_data = '';
|
22 |
-
var $csv_last_start = '';
|
23 |
-
|
24 |
-
var $processed_posts = array();
|
25 |
-
var $post_orphans = array();
|
26 |
-
var $attachments = array();
|
27 |
-
var $upsell_skus = array();
|
28 |
-
var $crosssell_skus = array();
|
29 |
|
30 |
public $merge_with = 'id';
|
31 |
public $found_action = 'skip';
|
@@ -80,13 +66,9 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
80 |
|
81 |
public function prepare_data_to_import($import_data,$form_data, $batch_offset, $is_last_batch){
|
82 |
|
83 |
-
$this->skip_new = !empty($form_data['advanced_form_data']['wt_iew_skip_new']) ? 1 : 0;
|
84 |
$this->merge_with = !empty($form_data['advanced_form_data']['wt_iew_merge_with']) ? $form_data['advanced_form_data']['wt_iew_merge_with'] : 'id';
|
85 |
$this->found_action = !empty($form_data['advanced_form_data']['wt_iew_found_action']) ? $form_data['advanced_form_data']['wt_iew_found_action'] : 'skip';
|
86 |
$this->use_same_password = isset($form_data['advanced_form_data']['wt_iew_use_same_password']) ? $form_data['advanced_form_data']['wt_iew_use_same_password'] : 1;
|
87 |
-
$this->merge_empty_cells = !empty($form_data['advanced_form_data']['wt_iew_merge_empty_cells']) ? 1 : 0;
|
88 |
-
$this->send_mail = !empty($form_data['advanced_form_data']['wt_iew_send_mail']) ? 1 : 0;
|
89 |
-
$this->delete_existing = !empty($form_data['advanced_form_data']['wt_iew_delete_products']) ? 1 : 0;
|
90 |
|
91 |
|
92 |
wp_defer_term_counting(true);
|
@@ -211,9 +193,9 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
211 |
}
|
212 |
}
|
213 |
|
214 |
-
if(!$this->is_user_exist && $this->skip_new){
|
215 |
-
throw new Exception('Skipping new item' );
|
216 |
-
}
|
217 |
|
218 |
if(!$this->is_user_exist){
|
219 |
$create_user_without_email = apply_filters('wt_create_user_without_email',FALSE); // create user without email address
|
@@ -294,10 +276,10 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
294 |
unset($post);
|
295 |
return new WP_Error( 'parse-error',sprintf(__('> “%s”' . $usr_msg), $user_id));
|
296 |
}
|
297 |
-
$user_id = $this->hf_update_customer($user_id, $post
|
298 |
} else {
|
299 |
|
300 |
-
$user_id = $this->hf_create_customer($post
|
301 |
$new_added = true;
|
302 |
if (is_wp_error($user_id)) {
|
303 |
|
@@ -333,7 +315,7 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
333 |
}
|
334 |
}
|
335 |
|
336 |
-
public function hf_create_customer($data
|
337 |
$customer_email = (!empty($data['user_details']['user_email']) ) ? $data['user_details']['user_email'] : '';
|
338 |
$username = (!empty($data['user_details']['user_login']) ) ? $data['user_details']['user_login'] : '';
|
339 |
$customer_id = (!empty($data['user_details']['customer_id']) ) ? $data['user_details']['customer_id'] : '';
|
@@ -377,7 +359,8 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
377 |
$found_customer = $insertion_id;
|
378 |
}
|
379 |
|
380 |
-
}
|
|
|
381 |
$found_customer = wp_create_user($username, $password, $customer_email);
|
382 |
}
|
383 |
$user_data = array('ID' => $found_customer, 'user_login' => $username, 'user_email' => $customer_email);
|
@@ -385,8 +368,8 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
385 |
$user_data['user_pass'] = $password;
|
386 |
}
|
387 |
|
388 |
-
wp_insert_user($user_data);
|
389 |
if (!is_wp_error($found_customer)) {
|
|
|
390 |
$wp_user_object = new WP_User($found_customer);
|
391 |
if ( ! function_exists( 'get_editable_roles' ) ) {
|
392 |
require_once ABSPATH . 'wp-admin/includes/user.php';
|
@@ -456,82 +439,6 @@ class Wt_Import_Export_For_Woo_basic_User_Import {
|
|
456 |
update_user_meta($found_customer, $key, $meta_value);
|
457 |
}
|
458 |
|
459 |
-
// $this->hf_make_user_active($found_customer);
|
460 |
-
// send user registration email if admin as chosen to do so
|
461 |
-
if ($email_customer && function_exists('wp_new_user_notification')) {
|
462 |
-
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
463 |
-
$to = $customer_email;
|
464 |
-
$subject = "Your " . $blog_name . " account has been created!";
|
465 |
-
// if ((strlen($password) == 34 && strlen($data['user_details']['user_pass']) == 34)) {
|
466 |
-
|
467 |
-
if (strlen($password) == 34 && $this->use_same_password) {
|
468 |
-
|
469 |
-
$body = "Hi $first_name,
|
470 |
-
|
471 |
-
Thanks for creating an account on " . $blog_name . ". Your username is $username. You can access your account area to view orders, change your password.
|
472 |
-
|
473 |
-
We look forward to seeing you soon.
|
474 |
-
|
475 |
-
" . $blog_name;
|
476 |
-
} elseif (!empty($data['user_details']['user_pass']) && !$this->use_same_password) {
|
477 |
-
$new_password = $data['user_details']['user_pass'];
|
478 |
-
$body = "Hi $first_name,
|
479 |
-
|
480 |
-
Thanks for creating an account on " . $blog_name . ". Your username is $username. You can access your account area to view orders, change your password.
|
481 |
-
|
482 |
-
Your password has been generated: $new_password
|
483 |
-
|
484 |
-
We look forward to seeing you soon.
|
485 |
-
|
486 |
-
" . $blog_name;
|
487 |
-
} else {
|
488 |
-
$body = "Hi $first_name,
|
489 |
-
|
490 |
-
Thanks for creating an account on " . $blog_name . ". Your username is $username. You can access your account area to view orders, change your password.
|
491 |
-
|
492 |
-
Your password has been generated: $password
|
493 |
-
|
494 |
-
We look forward to seeing you soon.
|
495 |
-
|
496 |
-
" . $blog_name;
|
497 |
-
}
|
498 |
-
$headers = '';
|
499 |
-
//$headers[] = 'From: ' . $blog_name;
|
500 |
-
$mail_attrs['to'] = $to;
|
501 |
-
$mail_attrs['subject'] = $subject;
|
502 |
-
$mail_attrs['body'] = $body;
|
503 |
-
$mail_attrs['headers'] = $headers;
|
504 |
-
$mail_attrs['password'] = (isset($new_password)) ? $new_password : $password;
|
505 |
-
$mail_attrs['user_current_roles'] = $user_roles;
|
506 |
-
$mail_attrs['user_new_roles'] = $new_roles;
|
507 |
-
$mail_attrs['user_id'] = $found_customer;
|
508 |
-
$mail_attrs['mail_already_sent'] = FALSE;
|
509 |
-
$mail_template = get_option('wt_' . WT_CUSTOMER_IMP_EXP_ID . '_mail_option', null);
|
510 |
-
if($mail_template['enable_email_templates'] == 1){
|
511 |
-
$fetch_user = get_user_by( 'email', $mail_attrs['to'] );
|
512 |
-
$mail_attrs['headers'] ='Content-Type: text/html; charset=UTF-8';
|
513 |
-
$mail_attrs['subject'] = $mail_template['subject_mail'];
|
514 |
-
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
515 |
-
$mail_body = $mail_template['body_mail'];
|
516 |
-
$mail_body = str_replace( "###EMAIL###", $mail_attrs['to'], $mail_body );
|
517 |
-
$mail_body = str_replace( "###USERNAME###", $fetch_user->user_login, $mail_body );
|
518 |
-
$mail_body = str_replace( "###DISPLAYNAME###", $fetch_user->display_name , $mail_body );
|
519 |
-
// $mail_body = str_replace( "###NICENAME###", $fetch_user->user_nicename , $mail_body );
|
520 |
-
$mail_body = str_replace( "###PASSWORD###", $mail_attrs['password'] , $mail_body );
|
521 |
-
$mail_body = str_replace('###SITENAME###', $blog_name, $mail_body);
|
522 |
-
$mail_body = str_replace('###SITEURL###', home_url(), $mail_body);
|
523 |
-
$mail_body = str_replace('###LOGINURL###', wp_login_url(), $mail_body );
|
524 |
-
$mail_body = str_replace("###LOSTPASSWORDURL###", wp_lostpassword_url(), $mail_body );
|
525 |
-
$mail_attrs['body'] = $mail_body;
|
526 |
-
}
|
527 |
-
$mail_attrs = apply_filters('wt_user_registration_email', $mail_attrs); //this filter can use for alter mail as well as send mail with other third party plugins
|
528 |
-
|
529 |
-
if (!isset($mail_attrs['mail_already_sent']) || $mail_attrs['mail_already_sent'] == FALSE) {// this parameter used for determine whether the email already sent or not by any Custom mail
|
530 |
-
wp_mail($mail_attrs['to'], $mail_attrs['subject'], $mail_attrs['body'], $mail_attrs['headers']);
|
531 |
-
}
|
532 |
-
|
533 |
-
}
|
534 |
-
|
535 |
}
|
536 |
} else {
|
537 |
$found_customer = new WP_Error('hf_invalid_customer', sprintf(__('User could not be created without Email.'), $customer_id));
|
@@ -539,7 +446,7 @@ We look forward to seeing you soon.
|
|
539 |
return apply_filters('xa_user_impexp_alter_user_meta', $found_customer, $this->user_meta_fields, $meta_array);
|
540 |
}
|
541 |
|
542 |
-
public function hf_update_customer($found_customer, $data
|
543 |
$meta_array = array();
|
544 |
if ($found_customer) {
|
545 |
$wp_user_object = new WP_User($found_customer);
|
@@ -631,62 +538,6 @@ We look forward to seeing you soon.
|
|
631 |
wp_insert_user($user_data);
|
632 |
}
|
633 |
|
634 |
-
// send user registration email if admin as chosen to do so
|
635 |
-
if ($email_customer && function_exists('wp_new_user_notification') && isset($user_data['user_pass'])) {
|
636 |
-
//added when implement merge with user id use to get to email id
|
637 |
-
$mail_sent_email = ( $email_updated ) ? $customer_email : $wp_user_object->user_email;
|
638 |
-
unset($email_updated);
|
639 |
-
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
640 |
-
/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
|
641 |
-
$pass_change_text = __('Hi ###USERNAME###,
|
642 |
-
|
643 |
-
This notice confirms that your password was changed on ###SITENAME### to ###PASSWORD###.
|
644 |
-
|
645 |
-
|
646 |
-
This email has been sent to ###EMAIL###
|
647 |
-
|
648 |
-
Regards,
|
649 |
-
All at ###SITENAME###
|
650 |
-
###SITEURL###');
|
651 |
-
$mail_attrs = array(
|
652 |
-
'to' => $mail_sent_email,
|
653 |
-
/* translators: User password change notification email subject. 1: Site name */
|
654 |
-
'subject' => __('[%s] Notice of Password Change'),
|
655 |
-
'message' => $pass_change_text,
|
656 |
-
'headers' => '',
|
657 |
-
);
|
658 |
-
$mail_attrs['message'] = str_replace('###USERNAME###', $wp_user_object->user_login, $mail_attrs['message']);
|
659 |
-
$mail_attrs['message'] = str_replace('###EMAIL###', $wp_user_object->user_email, $mail_attrs['message']);
|
660 |
-
$mail_attrs['message'] = str_replace('###SITENAME###', $blog_name, $mail_attrs['message']);
|
661 |
-
$mail_attrs['message'] = str_replace('###SITEURL###', home_url(), $mail_attrs['message']);
|
662 |
-
$mail_attrs['message'] = str_replace('###PASSWORD###', $user_data['user_pass'], $mail_attrs['message']);
|
663 |
-
$mail_attrs['user_current_roles'] = $user_roles;
|
664 |
-
$mail_attrs['user_new_roles'] = $new_roles;
|
665 |
-
$mail_attrs['user_id'] = $found_customer;
|
666 |
-
$mail_attrs['password'] = $user_data['user_pass'];
|
667 |
-
$mail_attrs['mail_already_sent'] = FALSE;
|
668 |
-
$mail_template = get_option('wt_' . WT_CUSTOMER_IMP_EXP_ID . '_mail_option', null);
|
669 |
-
if($mail_template['enable_update_mail_template'] == 1){
|
670 |
-
$mail_attrs['headers'] ='Content-Type: text/html; charset=UTF-8';
|
671 |
-
$mail_attrs['subject'] = $mail_template['subject_mail_update'];
|
672 |
-
$mail_body_update = $mail_template['body_mail_update'];
|
673 |
-
$mail_body_update = str_replace( "###EMAIL###", $wp_user_object->user_email, $mail_body_update );
|
674 |
-
$mail_body_update = str_replace( "###USERNAME###", $wp_user_object->user_login, $mail_body_update );
|
675 |
-
$mail_body_update = str_replace( "###DISPLAYNAME###", $wp_user_object->display_name , $mail_body_update );
|
676 |
-
$mail_body_update = str_replace( "###PASSWORD###", $mail_attrs['password'] , $mail_body_update );
|
677 |
-
$mail_body_update = str_replace('###SITENAME###', $blog_name, $mail_body_update);
|
678 |
-
$mail_body_update = str_replace('###SITEURL###', home_url(), $mail_body_update);
|
679 |
-
$mail_body_update = str_replace('###LOGINURL###', wp_login_url(), $mail_body_update );
|
680 |
-
$mail_body_update = str_replace("###LOSTPASSWORDURL###", wp_lostpassword_url(), $mail_body_update );
|
681 |
-
|
682 |
-
$mail_attrs['message'] = $mail_body_update;
|
683 |
-
}
|
684 |
-
$mail_attrs = apply_filters('wt_user_password_change_email', $mail_attrs); // this filter can use for alter mail as well as send mail with other third party plugins
|
685 |
-
if (!isset($mail_attrs['mail_already_sent']) || $mail_attrs['mail_already_sent'] == FALSE) { // this parameter used for determine whether the email already sent or not by any Custom mail
|
686 |
-
wp_mail($mail_attrs['to'], sprintf($mail_attrs['subject'], $blog_name), $mail_attrs['message'], $mail_attrs['headers']);
|
687 |
-
}
|
688 |
-
|
689 |
-
}
|
690 |
} else {
|
691 |
$found_customer = new WP_Error('hf_invalid_customer', sprintf(__('User could not be found with given Email or username.'), $customer_email));
|
692 |
}
|
12 |
|
13 |
|
14 |
var $merge;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
public $merge_with = 'id';
|
17 |
public $found_action = 'skip';
|
66 |
|
67 |
public function prepare_data_to_import($import_data,$form_data, $batch_offset, $is_last_batch){
|
68 |
|
|
|
69 |
$this->merge_with = !empty($form_data['advanced_form_data']['wt_iew_merge_with']) ? $form_data['advanced_form_data']['wt_iew_merge_with'] : 'id';
|
70 |
$this->found_action = !empty($form_data['advanced_form_data']['wt_iew_found_action']) ? $form_data['advanced_form_data']['wt_iew_found_action'] : 'skip';
|
71 |
$this->use_same_password = isset($form_data['advanced_form_data']['wt_iew_use_same_password']) ? $form_data['advanced_form_data']['wt_iew_use_same_password'] : 1;
|
|
|
|
|
|
|
72 |
|
73 |
|
74 |
wp_defer_term_counting(true);
|
193 |
}
|
194 |
}
|
195 |
|
196 |
+
// if(!$this->is_user_exist && $this->skip_new){
|
197 |
+
// throw new Exception('Skipping new item' );
|
198 |
+
// }
|
199 |
|
200 |
if(!$this->is_user_exist){
|
201 |
$create_user_without_email = apply_filters('wt_create_user_without_email',FALSE); // create user without email address
|
276 |
unset($post);
|
277 |
return new WP_Error( 'parse-error',sprintf(__('> “%s”' . $usr_msg), $user_id));
|
278 |
}
|
279 |
+
$user_id = $this->hf_update_customer($user_id, $post);
|
280 |
} else {
|
281 |
|
282 |
+
$user_id = $this->hf_create_customer($post);
|
283 |
$new_added = true;
|
284 |
if (is_wp_error($user_id)) {
|
285 |
|
315 |
}
|
316 |
}
|
317 |
|
318 |
+
public function hf_create_customer($data) {
|
319 |
$customer_email = (!empty($data['user_details']['user_email']) ) ? $data['user_details']['user_email'] : '';
|
320 |
$username = (!empty($data['user_details']['user_login']) ) ? $data['user_details']['user_login'] : '';
|
321 |
$customer_id = (!empty($data['user_details']['customer_id']) ) ? $data['user_details']['customer_id'] : '';
|
359 |
$found_customer = $insertion_id;
|
360 |
}
|
361 |
|
362 |
+
}
|
363 |
+
if(!$found_customer) {
|
364 |
$found_customer = wp_create_user($username, $password, $customer_email);
|
365 |
}
|
366 |
$user_data = array('ID' => $found_customer, 'user_login' => $username, 'user_email' => $customer_email);
|
368 |
$user_data['user_pass'] = $password;
|
369 |
}
|
370 |
|
|
|
371 |
if (!is_wp_error($found_customer)) {
|
372 |
+
wp_insert_user($user_data);
|
373 |
$wp_user_object = new WP_User($found_customer);
|
374 |
if ( ! function_exists( 'get_editable_roles' ) ) {
|
375 |
require_once ABSPATH . 'wp-admin/includes/user.php';
|
439 |
update_user_meta($found_customer, $key, $meta_value);
|
440 |
}
|
441 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
}
|
443 |
} else {
|
444 |
$found_customer = new WP_Error('hf_invalid_customer', sprintf(__('User could not be created without Email.'), $customer_id));
|
446 |
return apply_filters('xa_user_impexp_alter_user_meta', $found_customer, $this->user_meta_fields, $meta_array);
|
447 |
}
|
448 |
|
449 |
+
public function hf_update_customer($found_customer, $data) {
|
450 |
$meta_array = array();
|
451 |
if ($found_customer) {
|
452 |
$wp_user_object = new WP_User($found_customer);
|
538 |
wp_insert_user($user_data);
|
539 |
}
|
540 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
} else {
|
542 |
$found_customer = new WP_Error('hf_invalid_customer', sprintf(__('User could not be found with given Email or username.'), $customer_email));
|
543 |
}
|
admin/modules/user/user.php
CHANGED
@@ -68,7 +68,7 @@ class Wt_Import_Export_For_Woo_basic_User {
|
|
68 |
{
|
69 |
if($this->module_base==$base)
|
70 |
{
|
71 |
-
$steps['advanced']['description']=__('Use advanced options from below to
|
72 |
}
|
73 |
return $steps;
|
74 |
}
|
@@ -480,6 +480,36 @@ class Wt_Import_Export_For_Woo_basic_User {
|
|
480 |
}
|
481 |
$out = array();
|
482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
|
484 |
|
485 |
$out['use_same_password'] = array(
|
68 |
{
|
69 |
if($this->module_base==$base)
|
70 |
{
|
71 |
+
$steps['advanced']['description']=__('Use advanced options from below to retain user passwords or not, set batch import count. You can also save the template file for future imports.');
|
72 |
}
|
73 |
return $steps;
|
74 |
}
|
480 |
}
|
481 |
$out = array();
|
482 |
|
483 |
+
|
484 |
+
$out['found_action_merge'] = array(
|
485 |
+
'label' => __("If the user exists in the store"),
|
486 |
+
'type' => 'radio',
|
487 |
+
'radio_fields' => array(
|
488 |
+
'skip' => __('Skip'),
|
489 |
+
'update' => __('Update'),
|
490 |
+
// 'import' => __('Import as new item'),
|
491 |
+
),
|
492 |
+
'value' => 'skip',
|
493 |
+
'field_name' => 'found_action',
|
494 |
+
'help_text_conditional'=>array(
|
495 |
+
array(
|
496 |
+
'help_text'=> __('Retains the user in the store as is and skips the matching user from the input file.'),
|
497 |
+
'condition'=>array(
|
498 |
+
array('field'=>'wt_iew_found_action', 'value'=>'skip')
|
499 |
+
)
|
500 |
+
),
|
501 |
+
array(
|
502 |
+
'help_text'=> __('Update user as per data from the input file'),
|
503 |
+
'condition'=>array(
|
504 |
+
array('field'=>'wt_iew_found_action', 'value'=>'update')
|
505 |
+
)
|
506 |
+
)
|
507 |
+
),
|
508 |
+
'form_toggler'=>array(
|
509 |
+
'type'=>'parent',
|
510 |
+
'target'=>'wt_iew_found_action'
|
511 |
+
)
|
512 |
+
);
|
513 |
|
514 |
|
515 |
$out['use_same_password'] = array(
|
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.0.
|
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.0.5';
|
84 |
}
|
85 |
$this->plugin_name = 'wt-import-export-for-woo-basic';
|
86 |
|
readme.txt
CHANGED
@@ -5,15 +5,13 @@ Tags: user import, user export, csv, woocommerce, customers, import, export, exp
|
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
-
Import users and export users made simple!
|
13 |
|
14 |
-
==
|
15 |
-
|
16 |
-
= Introduction =
|
17 |
|
18 |
WordPress User Import Export plugin allows you to import and export WordPress users and WooCommerce customers quickly and easily. User Export and User import are much required feature while moving Wordpress / WooCommerce websites.
|
19 |
|
@@ -29,7 +27,7 @@ WordPress User Import Export plugin allows you to import and export WordPress us
|
|
29 |
🔸 Map and Transform fields while importing customers/users
|
30 |
🔸 Change values (bulk modify) while importing customers/users using Evaluation Fields
|
31 |
🔸 Tested OK with WordPress 5.6
|
32 |
-
🔸 Tested OK with WooCommerce 4.
|
33 |
🔸 Tested OK with PHP 7.3.5
|
34 |
|
35 |
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.
|
@@ -44,6 +42,10 @@ You can create the CSV from the scratch or you can export the users to get the f
|
|
44 |
|
45 |
More information about the set up of the plugin and a sample CSV that is taken as input by the plugin is given in the <a rel="nofollow" href="https://www.webtoffee.com/user-import-export-plugin-wordpress-user-guide/">WordPress Users & WooCommerce Customers Import Export Plugin - User Guide.</a>
|
46 |
|
|
|
|
|
|
|
|
|
47 |
= Premium version Features =
|
48 |
|
49 |
<blockquote>
|
@@ -169,33 +171,57 @@ Yes. This plugin will import users with password, so users can use same old pass
|
|
169 |
|
170 |
= Does this plugin support woocommerce customer order csv export? =
|
171 |
|
172 |
-
No. You may want to use https://wordpress.org/plugins/order-import-export-for-woocommerce/ for this
|
173 |
|
174 |
= Are you redirected to dashboard or login page while exporting? =
|
175 |
|
176 |
By default, admin and store manager are given access to export users. Please visit <a rel="nofollow" href="https://www.webtoffee.com/how-to-export-items-from-your-site-without-user-role-restriction/">How to export users without user role restriction</a> for more details
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
== Screenshots ==
|
180 |
|
181 |
-
1. WordPress export
|
|
|
|
|
182 |
|
183 |
-
|
184 |
|
185 |
-
|
186 |
|
187 |
-
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
194 |
|
195 |
-
|
196 |
|
|
|
|
|
|
|
|
|
|
|
197 |
|
198 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
= 2.0.4 =
|
200 |
* Improvement: Content updates.
|
201 |
* Tested OK with WC 4.8.0
|
@@ -335,7 +361,9 @@ By default, admin and store manager are given access to export users. Please vis
|
|
335 |
|
336 |
== Upgrade Notice ==
|
337 |
|
338 |
-
= 2.0.
|
|
|
339 |
* Improvement: Content updates.
|
340 |
-
*
|
|
|
341 |
* Version 2.0.0 onward has been revamped majorly.
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.0.5
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
12 |
+
Import users and export users made simple! Fast and easy import and export of WordPress users and WooCommerce customers using CSV files.
|
13 |
|
14 |
+
== WordPress Users and WooCommerce Customer Import Export Plugin - An Easy Import Export Solution ==
|
|
|
|
|
15 |
|
16 |
WordPress User Import Export plugin allows you to import and export WordPress users and WooCommerce customers quickly and easily. User Export and User import are much required feature while moving Wordpress / WooCommerce websites.
|
17 |
|
27 |
🔸 Map and Transform fields while importing customers/users
|
28 |
🔸 Change values (bulk modify) while importing customers/users using Evaluation Fields
|
29 |
🔸 Tested OK with WordPress 5.6
|
30 |
+
🔸 Tested OK with WooCommerce 4.9.0
|
31 |
🔸 Tested OK with PHP 7.3.5
|
32 |
|
33 |
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.
|
42 |
|
43 |
More information about the set up of the plugin and a sample CSV that is taken as input by the plugin is given in the <a rel="nofollow" href="https://www.webtoffee.com/user-import-export-plugin-wordpress-user-guide/">WordPress Users & WooCommerce Customers Import Export Plugin - User Guide.</a>
|
44 |
|
45 |
+
Watch the video on getting started with the plugin.
|
46 |
+
|
47 |
+
[youtube https://www.youtube.com/watch?v=N-wvAtnjjpg&rel=0&showinfo=0]
|
48 |
+
|
49 |
= Premium version Features =
|
50 |
|
51 |
<blockquote>
|
171 |
|
172 |
= Does this plugin support woocommerce customer order csv export? =
|
173 |
|
174 |
+
No. You may want to use <a rel="nofollow" href="https://wordpress.org/plugins/order-import-export-for-woocommerce/">Order Export & Order Import for WooCommerce</a> for this
|
175 |
|
176 |
= Are you redirected to dashboard or login page while exporting? =
|
177 |
|
178 |
By default, admin and store manager are given access to export users. Please visit <a rel="nofollow" href="https://www.webtoffee.com/how-to-export-items-from-your-site-without-user-role-restriction/">How to export users without user role restriction</a> for more details
|
179 |
|
180 |
+
= Do Import Export WordPress Users support Multisite? =
|
181 |
+
|
182 |
+
Yes, the plugin supports exporting users from each sub-sites of the multisite network.
|
183 |
+
|
184 |
+
= Does this plugin export custom data fields? =
|
185 |
+
|
186 |
+
This version of the plugin does not support the import or export of user custom data fields. It is one of our premium features. Please have a look at the <a rel="nofollow" href="https://www.webtoffee.com/product/wordpress-users-woocommerce-customers-import-export/">premium version of the plugin</a> to export and import custom metadata fields.
|
187 |
+
|
188 |
+
= Can this plugin update existing user data? =
|
189 |
+
|
190 |
+
Yes, you can update the user data with the help of this plugin. The users will be updated during an import, if the 'If the user exists in the store' field in the Advanced options is set to 'Update'.
|
191 |
|
192 |
== Screenshots ==
|
193 |
|
194 |
+
1. WordPress user export import plugin general settings
|
195 |
+
|
196 |
+
2. WordPress user exporter screen
|
197 |
|
198 |
+
3. WordPress user export filters
|
199 |
|
200 |
+
4. Map or re-order columns on WordPress user export
|
201 |
|
202 |
+
5. WordPress user batch export
|
203 |
|
204 |
+
6. WordPress user import-export template save option
|
205 |
|
206 |
+
7. WordPress import users screen
|
207 |
|
208 |
+
8. Map or re-order columns on WordPress user import
|
209 |
|
210 |
+
9. Bulk update WordPress users when importing from CSV
|
211 |
|
212 |
+
10. Advanced WordPress user import options and batch import
|
213 |
+
|
214 |
+
11. WordPress user CSV import export history
|
215 |
+
|
216 |
+
12. WordPress user import export log
|
217 |
|
218 |
== Changelog ==
|
219 |
+
= 2.0.5 =
|
220 |
+
* New Feature: Update existing users.
|
221 |
+
* Improvement: Content updates.
|
222 |
+
* Improved UI for better user experience
|
223 |
+
* Tested OK with WC 4.9.0
|
224 |
+
* Version 2.0.0 onward has been revamped majorly.
|
225 |
= 2.0.4 =
|
226 |
* Improvement: Content updates.
|
227 |
* Tested OK with WC 4.8.0
|
361 |
|
362 |
== Upgrade Notice ==
|
363 |
|
364 |
+
= 2.0.5 =
|
365 |
+
* New Feature: Update existing users.
|
366 |
* Improvement: Content updates.
|
367 |
+
* Improved UI for better user experience
|
368 |
+
* Tested OK with WC 4.9.0
|
369 |
* Version 2.0.0 onward has been revamped majorly.
|
users-customers-import-export-for-wp-woocommerce.php
CHANGED
@@ -6,8 +6,8 @@
|
|
6 |
Description: Export and Import User/Customers details From and To your WordPress/WooCommerce.
|
7 |
Author: WebToffee
|
8 |
Author URI: https://www.webtoffee.com/product/wordpress-users-woocommerce-customers-import-export/
|
9 |
-
Version: 2.0.
|
10 |
-
WC tested up to: 4.
|
11 |
Text Domain: users-customers-import-export-for-wp-woocommerce
|
12 |
License: GPLv3
|
13 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
@@ -43,7 +43,7 @@ if ( ! defined( 'WT_IEW_DEBUG_BASIC' ) ) {
|
|
43 |
* Start at version 1.0.0 and use SemVer - https://semver.org
|
44 |
* Rename this for your plugin and update it as you release new versions.
|
45 |
*/
|
46 |
-
define( 'WT_U_IEW_VERSION', '2.0.
|
47 |
|
48 |
/**
|
49 |
* The code that runs during plugin activation.
|
6 |
Description: Export and Import User/Customers details From and To your WordPress/WooCommerce.
|
7 |
Author: WebToffee
|
8 |
Author URI: https://www.webtoffee.com/product/wordpress-users-woocommerce-customers-import-export/
|
9 |
+
Version: 2.0.5
|
10 |
+
WC tested up to: 4.9.0
|
11 |
Text Domain: users-customers-import-export-for-wp-woocommerce
|
12 |
License: GPLv3
|
13 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
43 |
* Start at version 1.0.0 and use SemVer - https://semver.org
|
44 |
* Rename this for your plugin and update it as you release new versions.
|
45 |
*/
|
46 |
+
define( 'WT_U_IEW_VERSION', '2.0.5' );
|
47 |
|
48 |
/**
|
49 |
* The code that runs during plugin activation.
|