Import users from CSV with meta - Version 1.15.5.4

Version Description

  • Bug fixed in frontend import, roles being updated when it shouldn't be updated thanks to @widevents for reporting (https://wordpress.org/support/topic/change-role-of-users-that-are-not-present-in-the-csv-works-without-ckeckbox-on/)
Download this release

Release Info

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

Code changes from version 1.15.5.3 to 1.15.5.4

classes/frontend.php CHANGED
@@ -167,7 +167,7 @@ class ACUI_Frontend{
167
  <th scope="row"><label for="change-role-not-present-frontend"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
168
  <td>
169
  <div style="float:left; margin-top: 10px;">
170
- <input type="checkbox" name="change-role-not-present-frontend" value="yes" <?php checked( $change_role_not_present_frontend ); ?> />
171
  </div>
172
  <div style="margin-left:25px;">
173
  <select id="change-role-not-present-role-frontend" name="change-role-not-present-role-frontend">
@@ -272,14 +272,11 @@ class ACUI_Frontend{
272
 
273
  // roles
274
  $form_data[ "role" ] = empty( $atts['role'] ) ? get_option( "acui_frontend_role") : $atts['role'];
275
- $form_data["change_role_not_present"] = ( get_option( "acui_frontend_change_role_not_present" ) ) ? 'yes' : 'no';
276
- $form_data["change_role_not_present_role"] = get_option( "acui_frontend_change_role_not_present_role" );
277
 
278
  // others
279
  $form_data[ "empty_cell_action" ] = "leave";
280
  $form_data[ "activate_users_wp_members" ] = empty( get_option( "acui_frontend_activate_users_wp_members" ) ) ? 'no_activate' : get_option( "acui_frontend_activate_users_wp_members" );
281
  $form_data[ "security" ] = wp_create_nonce( "codection-security" );
282
-
283
  acui_fileupload_process( $form_data, false, true );
284
 
285
  wp_delete_attachment( $csv_file_id, true );
167
  <th scope="row"><label for="change-role-not-present-frontend"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
168
  <td>
169
  <div style="float:left; margin-top: 10px;">
170
+ <input type="checkbox" id="change-role-not-present-frontend" name="change-role-not-present-frontend" value="yes" <?php checked( $change_role_not_present_frontend ); ?> />
171
  </div>
172
  <div style="margin-left:25px;">
173
  <select id="change-role-not-present-role-frontend" name="change-role-not-present-role-frontend">
272
 
273
  // roles
274
  $form_data[ "role" ] = empty( $atts['role'] ) ? get_option( "acui_frontend_role") : $atts['role'];
 
 
275
 
276
  // others
277
  $form_data[ "empty_cell_action" ] = "leave";
278
  $form_data[ "activate_users_wp_members" ] = empty( get_option( "acui_frontend_activate_users_wp_members" ) ) ? 'no_activate' : get_option( "acui_frontend_activate_users_wp_members" );
279
  $form_data[ "security" ] = wp_create_nonce( "codection-security" );
 
280
  acui_fileupload_process( $form_data, false, true );
281
 
282
  wp_delete_attachment( $csv_file_id, true );
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.15.5.3
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -11,6 +11,7 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
  Text Domain: import-users-from-csv-with-meta
12
  Domain Path: /languages
13
  */
 
14
  if ( ! defined( 'ABSPATH' ) )
15
  exit;
16
 
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.15.5.4
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
11
  Text Domain: import-users-from-csv-with-meta
12
  Domain Path: /languages
13
  */
14
+
15
  if ( ! defined( 'ABSPATH' ) )
16
  exit;
17
 
importer.php CHANGED
@@ -36,7 +36,8 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
36
 
37
  $users_registered = array();
38
  $headers = array();
39
- $headers_filtered = array();
 
40
  $update_existing_users = isset( $form_data["update_existing_users"] ) ? sanitize_text_field( $form_data["update_existing_users"] ) : '';
41
 
42
  $role_default = isset( $form_data["role"] ) ? $form_data["role"] : array( '' );
@@ -643,16 +644,16 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
643
  $delete_users_assign_posts = get_option( "acui_cron_delete_users_assign_posts");
644
  }
645
 
646
- if( $change_role_not_present == 'yes' ){
647
  $change_role_not_present_flag = true;
648
  }
649
 
650
- if( $is_cron && get_option( "acui_cron_change_role_not_present" ) ){
651
  $change_role_not_present_flag = true;
652
  $change_role_not_present_role = get_option( "acui_cron_change_role_not_present_role");
653
  }
654
 
655
- if( $is_frontend && get_option( "acui_frontend_change_role_not_present" ) ){
656
  $change_role_not_present_flag = true;
657
  $change_role_not_present_role = get_option( "acui_frontend_change_role_not_present_role");
658
  }
36
 
37
  $users_registered = array();
38
  $headers = array();
39
+ $headers_filtered = array();
40
+ $is_backend = !$is_frontend && !$is_cron;
41
  $update_existing_users = isset( $form_data["update_existing_users"] ) ? sanitize_text_field( $form_data["update_existing_users"] ) : '';
42
 
43
  $role_default = isset( $form_data["role"] ) ? $form_data["role"] : array( '' );
644
  $delete_users_assign_posts = get_option( "acui_cron_delete_users_assign_posts");
645
  }
646
 
647
+ if( $is_backend && $change_role_not_present == 'yes' ){
648
  $change_role_not_present_flag = true;
649
  }
650
 
651
+ if( $is_cron && !empty( get_option( "acui_cron_change_role_not_present" ) ) ){
652
  $change_role_not_present_flag = true;
653
  $change_role_not_present_role = get_option( "acui_cron_change_role_not_present_role");
654
  }
655
 
656
+ if( $is_frontend && !empty( get_option( "acui_frontend_change_role_not_present" ) ) ){
657
  $change_role_not_present_flag = true;
658
  $change_role_not_present_role = get_option( "acui_frontend_change_role_not_present_role");
659
  }
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.3.2
7
- Stable tag: 1.15.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -98,6 +98,9 @@ Plugin will automatically detect:
98
 
99
  == Changelog ==
100
 
 
 
 
101
  = 1.15.5.3 =
102
  * Email notification can be sent to administrator of the website when someone use the frontend importer
103
  * Code improvement
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.3.2
7
+ Stable tag: 1.15.5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
98
 
99
  == Changelog ==
100
 
101
+ = 1.15.5.4 =
102
+ * Bug fixed in frontend import, roles being updated when it shouldn't be updated thanks to @widevents for reporting (https://wordpress.org/support/topic/change-role-of-users-that-are-not-present-in-the-csv-works-without-ckeckbox-on/)
103
+
104
  = 1.15.5.3 =
105
  * Email notification can be sent to administrator of the website when someone use the frontend importer
106
  * Code improvement