Import users from CSV with meta - Version 1.19.2.5

Version Description

  • Ready for WordPress 6.0
  • Fixed a problem when no selecting a default role (https://wordpress.org/support/topic/default-role-and-update/#post-15626130) and roles was not being updated
  • Roles are now translated when showing
Download this release

Release Info

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

Code changes from version 1.19.2.4 to 1.19.2.5

classes/helper.php CHANGED
@@ -46,7 +46,7 @@ class ACUI_Helper{
46
  $list_editable_roles = array();
47
 
48
  foreach ($editable_roles as $key => $editable_role)
49
- $list_editable_roles[$key] = $editable_role["name"];
50
 
51
  return $list_editable_roles;
52
  }
46
  $list_editable_roles = array();
47
 
48
  foreach ($editable_roles as $key => $editable_role)
49
+ $list_editable_roles[$key] = translate_user_role( $editable_role["name"] );
50
 
51
  return $list_editable_roles;
52
  }
classes/homepage.php CHANGED
@@ -76,7 +76,7 @@ class ACUI_Homepage{
76
  <td>
77
  <?php
78
  foreach ( ACUI_Helper::get_editable_roles() as $key => $value )
79
- ACUIHTML()->checkbox( array( 'label' => $value, 'name' => 'role[]', 'compare_value' => $last_roles_used, 'current' => $key, 'array' => true, 'class' => 'roles' ) );
80
  ?>
81
  <p class="description"><?php _e( 'You can also import roles from a CSV column. Please read documentation tab to see how it can be done. If you choose more than one role, the roles would be assigned correctly but you should use some plugin like <a href="https://wordpress.org/plugins/user-role-editor/">User Role Editor</a> to manage them.', 'import-users-from-csv-with-meta' ); ?></p>
82
  </td>
@@ -243,6 +243,7 @@ class ACUI_Homepage{
243
  <?php wp_nonce_field( 'codection-security', 'security' ); ?>
244
 
245
  <input class="button-primary" type="submit" name="uploadfile" id="uploadfile_btn" value="<?php _e( 'Start importing', 'import-users-from-csv-with-meta' ); ?>"/>
 
246
  </form>
247
  </div>
248
 
@@ -285,7 +286,7 @@ class ACUI_Homepage{
285
  jQuery( document ).ready( function( $ ){
286
  check_delete_users_checked();
287
 
288
- $( '#acui_form' ).submit( function(){
289
  if( $( '#uploadfile' ).val() == "" && $( '#upload_file' ).is( ':visible' ) ) {
290
  alert("<?php _e( 'Please choose a file', 'import-users-from-csv-with-meta' ); ?>");
291
  return false;
76
  <td>
77
  <?php
78
  foreach ( ACUI_Helper::get_editable_roles() as $key => $value )
79
+ ACUIHTML()->checkbox( array( 'label' => translate_user_role( $value ), 'name' => 'role[]', 'compare_value' => $last_roles_used, 'current' => $key, 'array' => true, 'class' => 'roles' ) );
80
  ?>
81
  <p class="description"><?php _e( 'You can also import roles from a CSV column. Please read documentation tab to see how it can be done. If you choose more than one role, the roles would be assigned correctly but you should use some plugin like <a href="https://wordpress.org/plugins/user-role-editor/">User Role Editor</a> to manage them.', 'import-users-from-csv-with-meta' ); ?></p>
82
  </td>
243
  <?php wp_nonce_field( 'codection-security', 'security' ); ?>
244
 
245
  <input class="button-primary" type="submit" name="uploadfile" id="uploadfile_btn" value="<?php _e( 'Start importing', 'import-users-from-csv-with-meta' ); ?>"/>
246
+ <input class="button-primary" type="submit" name="save_options" id="save_options" value="<?php _e( 'Save options without importing', 'import-users-from-csv-with-meta' ); ?>"/>
247
  </form>
248
  </div>
249
 
286
  jQuery( document ).ready( function( $ ){
287
  check_delete_users_checked();
288
 
289
+ $( '#uploadfile_btn' ).click( function(){
290
  if( $( '#uploadfile' ).val() == "" && $( '#upload_file' ).is( ':visible' ) ) {
291
  alert("<?php _e( 'Please choose a file', 'import-users-from-csv-with-meta' ); ?>");
292
  return false;
classes/import.php CHANGED
@@ -23,7 +23,9 @@ class ACUI_Import{
23
  ACUI_Options::update( 'last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
24
  ACUI_Options::update( 'path_to_file', sanitize_text_field( $_POST['path_to_file'] ) );
25
  ACUI_Options::save_options( $_POST );
26
- $this->fileupload_process( $_POST, false );
 
 
27
  return;
28
  break;
29
 
@@ -246,7 +248,7 @@ class ACUI_Import{
246
  array_walk( $role_default, 'sanitize_text_field' );
247
 
248
  $update_emails_existing_users = isset( $form_data["update_emails_existing_users"] ) ? sanitize_text_field( $form_data["update_emails_existing_users"] ) : 'yes';
249
- $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
250
  $update_allow_update_passwords = isset( $form_data["update_allow_update_passwords"] ) ? sanitize_text_field( $form_data["update_allow_update_passwords"] ) : 'yes';
251
  $empty_cell_action = isset( $form_data["empty_cell_action"] ) ? sanitize_text_field( $form_data["empty_cell_action"] ) : '';
252
  $delete_users = isset( $form_data["delete_users"] ) ? sanitize_text_field( $form_data["delete_users"] ) : '';
@@ -391,12 +393,15 @@ class ACUI_Import{
391
  $role = $roles_cells;
392
  }
393
 
394
- if( ( !empty( $role ) || is_array( $role ) && empty( $role[0] ) ) && !empty( array_diff( $role, $all_roles ) ) ){
395
- $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Some of the next roles "%s" does not exists', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
 
 
 
396
  continue;
397
  }
398
 
399
- if ( ( !empty( $role ) || is_array( $role ) && empty( $role[0] ) ) && !empty( array_diff( $role, $editable_roles ) ) ){ // users only are able to import users with a role they are allowed to edit
400
  $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'You do not have permission to assign some of the next roles "%s"', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
401
  $created = false;
402
  continue;
23
  ACUI_Options::update( 'last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
24
  ACUI_Options::update( 'path_to_file', sanitize_text_field( $_POST['path_to_file'] ) );
25
  ACUI_Options::save_options( $_POST );
26
+
27
+ if( isset( $_POST['uploadfile'] ) && !empty( $_POST['uploadfile'] ) )
28
+ $this->fileupload_process( $_POST, false );
29
  return;
30
  break;
31
 
248
  array_walk( $role_default, 'sanitize_text_field' );
249
 
250
  $update_emails_existing_users = isset( $form_data["update_emails_existing_users"] ) ? sanitize_text_field( $form_data["update_emails_existing_users"] ) : 'yes';
251
+ $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : 'no';
252
  $update_allow_update_passwords = isset( $form_data["update_allow_update_passwords"] ) ? sanitize_text_field( $form_data["update_allow_update_passwords"] ) : 'yes';
253
  $empty_cell_action = isset( $form_data["empty_cell_action"] ) ? sanitize_text_field( $form_data["empty_cell_action"] ) : '';
254
  $delete_users = isset( $form_data["delete_users"] ) ? sanitize_text_field( $form_data["delete_users"] ) : '';
393
  $role = $roles_cells;
394
  }
395
 
396
+ if( ( !empty( $role ) || is_array( $role ) && empty( $role[0] ) ) && !empty( array_diff( $role, $all_roles ) ) && $update_roles_existing_users != 'no' ){
397
+ if( is_array( $role ) && empty( $role[0] ) )
398
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'If you are upgrading roles, you must choose at least one role', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
399
+ else
400
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Some of the next roles "%s" does not exists', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
401
  continue;
402
  }
403
 
404
+ if ( ( !empty( $role ) || is_array( $role ) && empty( $role[0] ) ) && !empty( array_diff( $role, $editable_roles ) && $update_roles_existing_users != 'no' ) ){ // users only are able to import users with a role they are allowed to edit
405
  $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'You do not have permission to assign some of the next roles "%s"', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
406
  $created = false;
407
  continue;
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.19.2.4
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -11,11 +11,10 @@ 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
-
15
  if ( ! defined( 'ABSPATH' ) )
16
  exit;
17
 
18
- define( 'ACUI_VERSION', '1.19.2.4' );
19
 
20
  class ImportExportUsersCustomers{
21
  var $file;
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.19.2.5
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
  if ( ! defined( 'ABSPATH' ) )
15
  exit;
16
 
17
+ define( 'ACUI_VERSION', '1.19.2.5' );
18
 
19
  class ImportExportUsersCustomers{
20
  var $file;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: carazo, hornero
3
  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.9.3
7
- Stable tag: 1.19.2.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,11 @@ Plugin will automatically detect:
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = 1.19.2.4 =
111
  * Fixed a notice in the new user page if you are using custom fields created by the plugin
112
 
3
  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: 6.0
7
+ Stable tag: 1.19.2.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.19.2.5 =
111
+ * Ready for WordPress 6.0
112
+ * Fixed a problem when no selecting a default role (https://wordpress.org/support/topic/default-role-and-update/#post-15626130) and roles was not being updated
113
+ * Roles are now translated when showing
114
+
115
  = 1.19.2.4 =
116
  * Fixed a notice in the new user page if you are using custom fields created by the plugin
117