Import users from CSV with meta - Version 1.16.3.5

Version Description

  • New option in standard import to choose if passwords should be updated when updating users
Download this release

Release Info

Developer carazo
Plugin Icon 128x128 Import users from CSV with meta
Version 1.16.3.5
Comparing to
See all releases

Code changes from version 1.16.3.4 to 1.16.3.5

classes/homepage.php CHANGED
@@ -120,6 +120,16 @@ class ACUI_Homepage{
120
  </select>
121
  </td>
122
  </tr>
 
 
 
 
 
 
 
 
 
 
123
  </tbody>
124
  </table>
125
 
120
  </select>
121
  </td>
122
  </tr>
123
+
124
+ <tr id="acui_update_allow_update_passwords_wrapper" class="form-field form-required">
125
+ <th scope="row"><label for="update_allow_update_passwords"><?php _e( 'Never update passwords?', 'import-users-from-csv-with-meta' ); ?></label></th>
126
+ <td>
127
+ <select name="update_allow_update_passwords">
128
+ <option value="yes"><?php _e( 'Update passwords as it is described in documentation', 'import-users-from-csv-with-meta' ); ?></option>
129
+ <option value="no"><?php _e( 'Never update passwords when updating a user', 'import-users-from-csv-with-meta' ); ?></option>
130
+ </select>
131
+ </td>
132
+ </tr>
133
  </tbody>
134
  </table>
135
 
import-users-from-csv-with-meta.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Import and export users and customers
4
  Plugin URI: https://www.codection.com
5
  Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
6
- Version: 1.16.3.4
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
3
  Plugin Name: Import and export users and customers
4
  Plugin URI: https://www.codection.com
5
  Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
6
+ Version: 1.16.3.5
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
importer.php CHANGED
@@ -53,6 +53,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
53
  array_walk( $role_default, 'sanitize_text_field' );
54
 
55
  $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
 
56
  $empty_cell_action = isset( $form_data["empty_cell_action"] ) ? sanitize_text_field( $form_data["empty_cell_action"] ) : '';
57
  $delete_users = isset( $form_data["delete_users"] ) ? sanitize_text_field( $form_data["delete_users"] ) : '';
58
  $delete_users_assign_posts = isset( $form_data["delete_users_assign_posts"] ) ? sanitize_text_field( $form_data["delete_users_assign_posts"] ) : '';
@@ -190,13 +191,12 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
190
  $user_id = 0;
191
  $problematic_row = false;
192
  $password_position = $positions["password"];
193
- $password = "";
194
  $role_position = $positions["role"];
195
  $role = "";
196
  $id_position = $positions["id"];
197
  $id = ( empty( $id_position ) ) ? '' : $data[ $id_position ];
198
  $created = true;
199
- $password = ( $password_position === false ) ? wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) ) : $data[ $password_position ];
200
 
201
  if( $role_position === false ){
202
  $role = $role_default;
@@ -239,7 +239,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
239
  if( $user->user_login == $username ){
240
  $user_id = $id;
241
 
242
- if( $password !== "" )
243
  wp_set_password( $password, $user_id );
244
 
245
  if( !empty( $email ) ) {
@@ -289,7 +289,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
289
  $user_object = get_user_by( "login", $username );
290
  $user_id = $user_object->ID;
291
 
292
- if( $password !== "" )
293
  wp_set_password( $password, $user_id );
294
 
295
  if( !empty( $email ) ) {
@@ -321,7 +321,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
321
  $problematic_row = true;
322
  $error_importing = true;
323
 
324
- if( $password !== "" )
325
  wp_set_password( $password, $user_id );
326
 
327
  $created = false;
@@ -444,6 +444,9 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
444
  continue;
445
  }
446
  elseif( strtolower( $headers[ $i ] ) == "user_pass" ){ // hashed pass
 
 
 
447
  $wpdb->update( $wpdb->users, array( 'user_pass' => wp_slash( $data[ $i ] ) ), array( 'ID' => $user_id ) );
448
  wp_cache_delete( $user_id, 'users' );
449
  continue;
53
  array_walk( $role_default, 'sanitize_text_field' );
54
 
55
  $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
56
+ $update_allow_update_passwords = isset( $form_data["update_allow_update_passwords"] ) ? sanitize_text_field( $form_data["update_allow_update_passwords"] ) : 'yes';
57
  $empty_cell_action = isset( $form_data["empty_cell_action"] ) ? sanitize_text_field( $form_data["empty_cell_action"] ) : '';
58
  $delete_users = isset( $form_data["delete_users"] ) ? sanitize_text_field( $form_data["delete_users"] ) : '';
59
  $delete_users_assign_posts = isset( $form_data["delete_users_assign_posts"] ) ? sanitize_text_field( $form_data["delete_users_assign_posts"] ) : '';
191
  $user_id = 0;
192
  $problematic_row = false;
193
  $password_position = $positions["password"];
194
+ $password = ( $password_position === false ) ? wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) ) : $data[ $password_position ];
195
  $role_position = $positions["role"];
196
  $role = "";
197
  $id_position = $positions["id"];
198
  $id = ( empty( $id_position ) ) ? '' : $data[ $id_position ];
199
  $created = true;
 
200
 
201
  if( $role_position === false ){
202
  $role = $role_default;
239
  if( $user->user_login == $username ){
240
  $user_id = $id;
241
 
242
+ if( $password !== "" && $update_allow_update_passwords == 'yes' )
243
  wp_set_password( $password, $user_id );
244
 
245
  if( !empty( $email ) ) {
289
  $user_object = get_user_by( "login", $username );
290
  $user_id = $user_object->ID;
291
 
292
+ if( $password !== "" && $update_allow_update_passwords == 'yes' )
293
  wp_set_password( $password, $user_id );
294
 
295
  if( !empty( $email ) ) {
321
  $problematic_row = true;
322
  $error_importing = true;
323
 
324
+ if( $password !== "" && $update_allow_update_passwords == 'yes' )
325
  wp_set_password( $password, $user_id );
326
 
327
  $created = false;
444
  continue;
445
  }
446
  elseif( strtolower( $headers[ $i ] ) == "user_pass" ){ // hashed pass
447
+ if( !$created && $update_allow_update_passwords == 'no' )
448
+ continue;
449
+
450
  $wpdb->update( $wpdb->users, array( 'user_pass' => wp_slash( $data[ $i ] ) ), array( 'ID' => $user_id ) );
451
  wp_cache_delete( $user_id, 'users' );
452
  continue;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://codection.com/go/donate-import-users-from-csv-with-meta/
4
  Tags: csv, import, importer, meta data, meta, user, users, user meta, editor, profile, custom, fields, delimiter, update, insert
5
  Requires at least: 3.4
6
  Tested up to: 5.5.3
7
- Stable tag: 1.16.3.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,9 @@ Plugin will automatically detect:
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 1.16.3.4 =
107
  * Export data can now be ordered alphabetically
108
 
4
  Tags: csv, import, importer, meta data, meta, user, users, user meta, editor, profile, custom, fields, delimiter, update, insert
5
  Requires at least: 3.4
6
  Tested up to: 5.5.3
7
+ Stable tag: 1.16.3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.16.3.5 =
107
+ * New option in standard import to choose if passwords should be updated when updating users
108
+
109
  = 1.16.3.4 =
110
  * Export data can now be ordered alphabetically
111