Import users from CSV with meta - Version 1.15.6.5

Version Description

  • Users only can import users with a role that they allowed to edit (thanks to @nonprofitweb https://wordpress.org/support/topic/import-user-with-higher-role/)
Download this release

Release Info

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

Code changes from version 1.15.6.4 to 1.15.6.5

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.6.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.15.6.5
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
importer.php CHANGED
@@ -14,6 +14,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
14
  $wp_users_fields = acui_get_wp_users_fields();
15
  $acui_not_meta_fields = acui_get_not_meta_fields();
16
  $acui_restricted_fields = acui_get_restricted_fields();
 
17
 
18
  if( is_plugin_active( 'wp-access-areas/wp-access-areas.php' ) ){
19
  $wpaa_labels = WPAA_AccessArea::get_available_userlabels();
@@ -220,6 +221,13 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
220
  $role = $roles_cells;
221
  }
222
 
 
 
 
 
 
 
 
223
  if( !empty( $id ) ){ // if user have used id
224
  if( acui_user_id_exists( $id ) ){
225
  if( $update_existing_users == 'no' ){
14
  $wp_users_fields = acui_get_wp_users_fields();
15
  $acui_not_meta_fields = acui_get_not_meta_fields();
16
  $acui_restricted_fields = acui_get_restricted_fields();
17
+ $editable_roles = array_keys( get_editable_roles() );
18
 
19
  if( is_plugin_active( 'wp-access-areas/wp-access-areas.php' ) ){
20
  $wpaa_labels = WPAA_AccessArea::get_available_userlabels();
221
  $role = $roles_cells;
222
  }
223
 
224
+ if ( !empty( array_diff( $role, $editable_roles ) ) ){ // users only are able to import users with a role they are allowed to edit
225
+ $error_string = 'You do not have permission to assign this role';
226
+ echo '<script>alert("' . __( 'Problems with user:', 'import-users-from-csv-with-meta' ) . $username . __( ', we are going to skip. \r\nError: ', 'import-users-from-csv-with-meta') . $error_string . '");</script>';
227
+ $created = false;
228
+ continue;
229
+ }
230
+
231
  if( !empty( $id ) ){ // if user have used id
232
  if( acui_user_id_exists( $id ) ){
233
  if( $update_existing_users == 'no' ){
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.4.1
7
- Stable tag: 1.15.6.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,9 @@ Plugin will automatically detect:
99
 
100
  == Changelog ==
101
 
 
 
 
102
  = 1.15.6.4 =
103
  * Now you can use variables also in Subject, thanks to @vbarrier (https://wordpress.org/support/topic/use-variables-also-in-subject/)
104
 
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.4.1
7
+ Stable tag: 1.15.6.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 1.15.6.5 =
103
+ * Users only can import users with a role that they allowed to edit (thanks to @nonprofitweb https://wordpress.org/support/topic/import-user-with-higher-role/)
104
+
105
  = 1.15.6.4 =
106
  * Now you can use variables also in Subject, thanks to @vbarrier (https://wordpress.org/support/topic/use-variables-also-in-subject/)
107