Version Description
- Cron import fixed. It failed because of get_editable_roles was not declared in cron import
- Check if role exists in order to show a better message when importing
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.15.6.8 |
Comparing to | |
See all releases |
Code changes from version 1.15.6.7 to 1.15.6.8
- import-users-from-csv-with-meta.php +1 -1
- importer.php +15 -2
- readme.txt +6 -2
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.
|
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.8
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
importer.php
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
|
4 |
function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){
|
|
|
|
|
|
|
5 |
?>
|
6 |
<div class="wrap">
|
7 |
<h2><?php echo apply_filters( 'acui_log_main_title', __('Importing users','import-users-from-csv-with-meta') ); ?></h2>
|
@@ -14,6 +17,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 |
$editable_roles = array_keys( get_editable_roles() );
|
18 |
|
19 |
if( is_plugin_active( 'wp-access-areas/wp-access-areas.php' ) ){
|
@@ -221,9 +225,18 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
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 |
-
$
|
226 |
-
|
|
|
227 |
$created = false;
|
228 |
continue;
|
229 |
}
|
2 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
|
4 |
function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){
|
5 |
+
if ( ! function_exists( 'get_editable_roles' ) ) {
|
6 |
+
require_once ABSPATH . 'wp-admin/includes/user.php';
|
7 |
+
}
|
8 |
?>
|
9 |
<div class="wrap">
|
10 |
<h2><?php echo apply_filters( 'acui_log_main_title', __('Importing users','import-users-from-csv-with-meta') ); ?></h2>
|
17 |
$wp_users_fields = acui_get_wp_users_fields();
|
18 |
$acui_not_meta_fields = acui_get_not_meta_fields();
|
19 |
$acui_restricted_fields = acui_get_restricted_fields();
|
20 |
+
$all_roles = array_keys( wp_roles()->roles );
|
21 |
$editable_roles = array_keys( get_editable_roles() );
|
22 |
|
23 |
if( is_plugin_active( 'wp-access-areas/wp-access-areas.php' ) ){
|
225 |
$role = $roles_cells;
|
226 |
}
|
227 |
|
228 |
+
if ( !empty( array_diff( $role, $all_roles ) ) ){
|
229 |
+
$roles_printable = implode( ', ', $role );
|
230 |
+
$error_string = sprintf( __( 'Some of the next roles "%s" does not exists', 'import-users-from-csv-with-meta' ), $roles_printable );
|
231 |
+
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>';
|
232 |
+
$created = false;
|
233 |
+
continue;
|
234 |
+
}
|
235 |
+
|
236 |
if ( !empty( array_diff( $role, $editable_roles ) ) ){ // users only are able to import users with a role they are allowed to edit
|
237 |
+
$roles_printable = implode( ', ', $role );
|
238 |
+
$error_string = sprintf( __( 'You do not have permission to assign some of the next roles "%s"', 'import-users-from-csv-with-meta' ), $roles_printable );
|
239 |
+
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>';
|
240 |
$created = false;
|
241 |
continue;
|
242 |
}
|
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.4.
|
7 |
-
Stable tag: 1.15.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -99,6 +99,10 @@ Plugin will automatically detect:
|
|
99 |
|
100 |
== Changelog ==
|
101 |
|
|
|
|
|
|
|
|
|
102 |
= 1.15.6.7 =
|
103 |
* A non-user admin could delete himself automatically deleting users not present in CSV (thanks again to @nonprofitweb https://wordpress.org/support/topic/non-admin-user-can-delete-self/#post-12950734)
|
104 |
* Improved "Users only can import users with a role that they allowed to edit" thanks also to @nonprofitweb
|
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.4.2
|
7 |
+
Stable tag: 1.15.6.8
|
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.8 =
|
103 |
+
* Cron import fixed. It failed because of get_editable_roles was not declared in cron import
|
104 |
+
* Check if role exists in order to show a better message when importing
|
105 |
+
|
106 |
= 1.15.6.7 =
|
107 |
* A non-user admin could delete himself automatically deleting users not present in CSV (thanks again to @nonprofitweb https://wordpress.org/support/topic/non-admin-user-can-delete-self/#post-12950734)
|
108 |
* Improved "Users only can import users with a role that they allowed to edit" thanks also to @nonprofitweb
|