Version Description
- Improved error handling to avoid the use of wp_die in some error handling and allow for better UX.
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.20.4 |
Comparing to | |
See all releases |
Code changes from version 1.20.3.1 to 1.20.4
- classes/import.php +12 -11
- import-users-from-csv-with-meta.php +2 -2
- readme.txt +4 -1
classes/import.php
CHANGED
@@ -206,19 +206,21 @@ class ACUI_Import{
|
|
206 |
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
207 |
}
|
208 |
|
209 |
-
if( empty( $_FILES['uploadfile']['name'] ) || $is_frontend )
|
210 |
$path_to_file = wp_normalize_path( $form_data["path_to_file"] );
|
211 |
|
212 |
if( validate_file( $path_to_file ) !== 0 ){
|
213 |
-
|
|
|
214 |
}
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
}
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
222 |
$uploadfile = wp_handle_upload( $_FILES['uploadfile'], array( 'test_form' => false, 'mimes' => array('csv' => 'text/csv') ) );
|
223 |
|
224 |
if ( !$uploadfile || isset( $uploadfile['error'] ) ) {
|
@@ -226,7 +228,7 @@ class ACUI_Import{
|
|
226 |
} else {
|
227 |
$this->import_users( $uploadfile['file'], $form_data, ACUI_Helper::get_attachment_id_by_url( $uploadfile['url'] ), $is_cron, $is_frontend );
|
228 |
}
|
229 |
-
|
230 |
}
|
231 |
|
232 |
function import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){
|
@@ -566,8 +568,7 @@ class ACUI_Import{
|
|
566 |
|
567 |
$user_id = wp_create_user( $username, $password, $email );
|
568 |
$password_changed = true;
|
569 |
-
}
|
570 |
-
|
571 |
if( is_wp_error( $user_id ) ){ // in case the user is generating errors after this checks
|
572 |
$errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Problems with user: "%s" does not exists, error: %s', 'import-users-from-csv-with-meta' ), $username, $user_id->get_error_message() ) );
|
573 |
continue;
|
206 |
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
207 |
}
|
208 |
|
209 |
+
if( empty( $_FILES['uploadfile']['name'] ) || $is_frontend ){
|
210 |
$path_to_file = wp_normalize_path( $form_data["path_to_file"] );
|
211 |
|
212 |
if( validate_file( $path_to_file ) !== 0 ){
|
213 |
+
echo "<p>" . __( 'Error, path to file is not well written', 'import-users-from-csv-with-meta' ) . ": $path_to_file</p>";
|
214 |
+
echo sprintf( __( 'Reload or try <a href="%s">a new import here</a>', 'import-users-from-csv-with-meta' ), get_admin_url( null, 'tools.php?page=acui&tab=homepage' ) );
|
215 |
}
|
216 |
+
elseif( !file_exists ( $path_to_file ) ){
|
217 |
+
echo "<p>" . __( 'Error, we cannot find the file', 'import-users-from-csv-with-meta' ) . ": $path_to_file</p>";
|
218 |
+
echo sprintf( __( 'Reload or try <a href="%s">a new import here</a>', 'import-users-from-csv-with-meta' ), get_admin_url( null, 'tools.php?page=acui&tab=homepage' ) );
|
219 |
}
|
220 |
+
else{
|
221 |
+
$this->import_users( $path_to_file, $form_data, 0, $is_cron, $is_frontend );
|
222 |
+
}
|
223 |
+
}else{
|
224 |
$uploadfile = wp_handle_upload( $_FILES['uploadfile'], array( 'test_form' => false, 'mimes' => array('csv' => 'text/csv') ) );
|
225 |
|
226 |
if ( !$uploadfile || isset( $uploadfile['error'] ) ) {
|
228 |
} else {
|
229 |
$this->import_users( $uploadfile['file'], $form_data, ACUI_Helper::get_attachment_id_by_url( $uploadfile['url'] ), $is_cron, $is_frontend );
|
230 |
}
|
231 |
+
}
|
232 |
}
|
233 |
|
234 |
function import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){
|
568 |
|
569 |
$user_id = wp_create_user( $username, $password, $email );
|
570 |
$password_changed = true;
|
571 |
+
}
|
|
|
572 |
if( is_wp_error( $user_id ) ){ // in case the user is generating errors after this checks
|
573 |
$errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Problems with user: "%s" does not exists, error: %s', 'import-users-from-csv-with-meta' ), $username, $user_id->get_error_message() ) );
|
574 |
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.20.
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
@@ -14,7 +14,7 @@ Domain Path: /languages
|
|
14 |
if ( ! defined( 'ABSPATH' ) )
|
15 |
exit;
|
16 |
|
17 |
-
define( 'ACUI_VERSION', '1.20.
|
18 |
|
19 |
class ImportExportUsersCustomers{
|
20 |
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.20.4
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
14 |
if ( ! defined( 'ABSPATH' ) )
|
15 |
exit;
|
16 |
|
17 |
+
define( 'ACUI_VERSION', '1.20.4' );
|
18 |
|
19 |
class ImportExportUsersCustomers{
|
20 |
var $file;
|
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: 6.0.2
|
7 |
-
Stable tag: 1.20.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -107,6 +107,9 @@ Plugin will automatically detect:
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
110 |
= 1.20.3.1 =
|
111 |
* When choosing a file to import in the frontend import, the name of the file appears, this is something that was lost in yesterday's graphical improvement of this part of the import
|
112 |
|
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.2
|
7 |
+
Stable tag: 1.20.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 1.20.4 =
|
111 |
+
* Improved error handling to avoid the use of wp_die in some error handling and allow for better UX.
|
112 |
+
|
113 |
= 1.20.3.1 =
|
114 |
* When choosing a file to import in the frontend import, the name of the file appears, this is something that was lost in yesterday's graphical improvement of this part of the import
|
115 |
|