Import users from CSV with meta - Version 1.10.7

Version Description

  • New feature thanks to Todd Zaroban (@tzarob) now you can choose if override or not current roles of each user when you are updating them
  • Problem solved in repeated email module thanks to @damienper (https://wordpress.org/support/topic/error-in-email_repeated-php/)
  • Problem solved in mail sending with cron thanks to @khansadi (https://wordpress.org/support/topic/no-email-is-sent-to-new-users-when-created-via-corn-import/)
Download this release

Release Info

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

Code changes from version 1.10.6.9 to 1.10.7

email-repeated.php CHANGED
@@ -21,7 +21,7 @@ function acui_hack_restore_remapped_email_address( $user_id, $email ) {
21
 
22
  $wpdb->update(
23
  $wpdb->users,
24
- array( 'user_email' => $hacked_email ),
25
  array( 'ID' => $user_id )
26
  );
27
 
21
 
22
  $wpdb->update(
23
  $wpdb->users,
24
+ array( 'user_email' => $email ),
25
  array( 'ID' => $user_id )
26
  );
27
 
import-users-from-csv-with-meta.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Import users from CSV with meta
4
  Plugin URI: https://www.codection.com
5
  Description: This plugins allows to import users using CSV files to WP database automatically
6
- Version: 1.10.6.9
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
3
  Plugin Name: Import users from CSV with meta
4
  Plugin URI: https://www.codection.com
5
  Description: This plugins allows to import users using CSV files to WP database automatically
6
+ Version: 1.10.7
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
importer.php CHANGED
@@ -263,12 +263,14 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false
263
  $users_registered[] = $user_id;
264
  $user_object = new WP_User( $user_id );
265
 
266
- if( $created || $update_roles_existing_users == 'yes'){
267
  if(!( in_array("administrator", acui_get_roles($user_id), FALSE) || is_multisite() && is_super_admin( $user_id ) )){
268
 
269
- $default_roles = $user_object->roles;
270
- foreach ( $default_roles as $default_role ) {
271
- $user_object->remove_role( $default_role );
 
 
272
  }
273
 
274
  if( !empty( $role ) ){
@@ -407,17 +409,17 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false
407
  flush();
408
 
409
  $mail_for_this_user = false;
410
- if( $created )
411
- $mail_for_this_user = true;
412
- else{
413
- if( !$is_cron && isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] )
414
  $mail_for_this_user = true;
415
- else if( $is_cron && get_option( "acui_send_mail_cron" ) )
 
 
416
  $mail_for_this_user = true;
417
  }
418
 
419
  // send mail
420
- if( isset( $form_data["sends_email"] ) && $form_data["sends_email"] && $mail_for_this_user ):
421
  $key = get_password_reset_key( $user_object );
422
  $user_login= $user_object->user_login;
423
 
@@ -646,7 +648,8 @@ function acui_options()
646
  <td>
647
  <select name="update_roles_existing_users">
648
  <option value="no"><?php _e( 'No', 'import-users-from-csv-with-meta' ); ?></option>
649
- <option value="yes"><?php _e( 'Yes', 'import-users-from-csv-with-meta' ); ?></option>
 
650
  </select>
651
  </td>
652
  </tr>
263
  $users_registered[] = $user_id;
264
  $user_object = new WP_User( $user_id );
265
 
266
+ if( $created || $update_roles_existing_users != 'no' ){
267
  if(!( in_array("administrator", acui_get_roles($user_id), FALSE) || is_multisite() && is_super_admin( $user_id ) )){
268
 
269
+ if( $update_roles_existing_users == 'yes' ){
270
+ $default_roles = $user_object->roles;
271
+ foreach ( $default_roles as $default_role ) {
272
+ $user_object->remove_role( $default_role );
273
+ }
274
  }
275
 
276
  if( !empty( $role ) ){
409
  flush();
410
 
411
  $mail_for_this_user = false;
412
+ if( $is_cron ){
413
+ if( get_option( "acui_send_mail_cron" ) )
 
 
414
  $mail_for_this_user = true;
415
+ }
416
+ else{
417
+ if( $created || ( isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] ) )
418
  $mail_for_this_user = true;
419
  }
420
 
421
  // send mail
422
+ if( isset( $mail_for_this_user ) && $mail_for_this_user ):
423
  $key = get_password_reset_key( $user_object );
424
  $user_login= $user_object->user_login;
425
 
648
  <td>
649
  <select name="update_roles_existing_users">
650
  <option value="no"><?php _e( 'No', 'import-users-from-csv-with-meta' ); ?></option>
651
+ <option value="yes"><?php _e( 'Yes, update and override existing roles', 'import-users-from-csv-with-meta' ); ?></option>
652
+ <option value="yes_no_override"><?php _e( 'Yes, add new roles and not override existing ones', 'import-users-from-csv-with-meta' ); ?></option>
653
  </select>
654
  </td>
655
  </tr>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://paypal.me/codection
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: 4.8
7
- Stable tag: 1.10.6.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -70,6 +70,11 @@ Plugin will automatically detect:
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
73
  = 1.10.6.9 =
74
  * Thanks to Peri Lane from Apis Productions you can now import roles from CSV. Read documentation to see the way to work.
75
 
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: 4.8
7
+ Stable tag: 1.10.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.10.7 =
74
+ * New feature thanks to Todd Zaroban (@tzarob) now you can choose if override or not current roles of each user when you are updating them
75
+ * Problem solved in repeated email module thanks to @damienper (https://wordpress.org/support/topic/error-in-email_repeated-php/)
76
+ * Problem solved in mail sending with cron thanks to @khansadi (https://wordpress.org/support/topic/no-email-is-sent-to-new-users-when-created-via-corn-import/)
77
+
78
  = 1.10.6.9 =
79
  * Thanks to Peri Lane from Apis Productions you can now import roles from CSV. Read documentation to see the way to work.
80