PluginProbe
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on / 1.2.7
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on v1.2.7
2.0 1.7.1 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.5 1.6 1.7 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8
← All changes | importExtensions/UsersImport.php +12 -3 1.2.41.2.7 View file →
@@ -32,9 +32,9 @@
32 32 $created_count = $updated_row_counts['created'];
33 33 $updated_count = $updated_row_counts['updated'];
34 34 $skipped_count = $updated_row_counts['skipped'];
35 35
36 - $data_array['role'] = trim($data_array['role']);
36 + $data_array['role'] = trim(isset($data_array['role']));
37 37 if ( isset( $data_array['role'] ) && $data_array['role'] != '') {
38 38 $user_capability = '';
39 39 if ( !is_numeric( $data_array['role'] ) ) {
40 40 $roles = $this->getRoles();
@@ -64,8 +64,11 @@
64 64 $data_array['role'] = 'subscriber'; #TODO: Add log message for assigning the default role
65 65 }
66 66 $user_email = $data_array['user_email'];
67 67
68 + //filter to change user meta values before import
69 + $data_array = apply_filters('smack_csv_modify_userdata_filter', $data_array);
70 +
68 71 if ( $mode == 'Insert' ) {
69 72 if ( empty( $data_array['user_pass'] ) ) {
70 73 $data_array['user_pass'] = wp_generate_password( 12, false );
71 74 $additional_meta_info = array(
@@ -75,9 +78,12 @@
75 78 'role' => $data_array['role']
76 79 );
77 80 $data_array['smack_uci_import'] = $additional_meta_info;
78 81 }
79 - else{
82 + else{
83 + if (strlen($data_array['user_pass'])!== 34 && $data_array['user_pass'][0]!=='$'){
84 + $data_array['user_pass']=wp_hash_password($data_array['user_pass']);
85 + }
80 86 $additional_meta_info = array(
81 87 'user_login' => $data_array['user_login'],
82 88 'user_pass' => $data_array['user_pass'],
83 89 'user_email' => $data_array['user_email'],
@@ -154,14 +160,17 @@
154 160
155 161 if ( ! empty ( $metaData ) ) {
156 162 foreach ( $metaData as $meta_key => $meta_value ) {
157 163 update_user_meta( $retID, $meta_key, $meta_value );
164 +
165 + //filter for modifying user metadata after import
166 + apply_filters('smack_csv_modify_metadata_filter', $retID, $meta_key, $meta_value);
158 167 }
159 168 }
160 169 $core_instance->detailed_log[$line_number]['Email'] = $data_array['user_email'];
161 170 $core_instance->detailed_log[$line_number]['Role'] = $data_array['role'];
162 171 $ucisettings = get_option('sm_uci_pro_settings');
163 - if($ucisettings['send_user_password'] == "true") {
172 + if(isset($ucisettings['send_user_password']) && $ucisettings['send_user_password'] == "true") {
164 173 $send_user_password = new SendPassword;
165 174 $send_user_password->send_login_credentials_to_users();
166 175 }
167 176 $returnArr['ID'] = $retID;