Import users from CSV with meta - Version 1.20.3

Version Description

  • Changed the way the button to choose files in the import from front end is displayed to make it easier to apply styles to it
  • Improved error detection when importing users from the front end
Download this release

Release Info

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

Code changes from version 1.20.2 to 1.20.3

classes/frontend.php CHANGED
@@ -378,45 +378,50 @@ class ACUI_Frontend{
378
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
379
  }
380
 
381
- do_action( 'acui_pre_frontend_import' );
382
-
383
- $file = array_keys( $_FILES );
384
- $csv_file_id = $this->upload_file( $file[0] );
385
-
386
- // start
387
- $form_data = array();
388
- $form_data["path_to_file"] = get_attached_file( $csv_file_id );
389
-
390
- // emails
391
- $form_data["sends_email"] = get_option( "acui_frontend_send_mail" );
392
- $form_data["send_email_updated"] = get_option( "acui_frontend_send_mail_updated" );
393
- $form_data["force_user_reset_password"] = get_option( "acui_frontend_force_user_reset_password" );
394
-
395
- // roles
396
- $form_data["role"] = empty( $atts["role"] ) ? get_option( "acui_frontend_role") : $atts["role"];
397
-
398
- // update
399
- $form_data["update_existing_users"] = empty( get_option( "acui_frontend_update_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_existing_users" );
400
- $form_data["update_roles_existing_users"] = empty( get_option( "acui_frontend_update_roles_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_roles_existing_users" );
401
-
402
- // delete
403
- $form_data["delete_users_not_present"] = ( get_option( "acui_frontend_delete_users" ) ) ? 'yes' : 'no';
404
- $form_data["delete_users_assign_posts"] = get_option( "acui_frontend_delete_users_assign_posts" );
405
- $form_data["delete_users_only_specified_role"] = empty( $form_data[ "role" ] ) ? false : $atts['delete-only-specified-role'];
406
-
407
- // others
408
- $form_data["empty_cell_action"] = "leave";
409
- $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" );
410
- $form_data["security"] = wp_create_nonce( "codection-security" );
411
-
412
- $form_data = apply_filters( 'acui_frontend_import_form_data', $form_data );
413
-
414
- $acui_import = new ACUI_Import();
415
- $acui_import->fileupload_process( $form_data, false, true );
416
-
417
- wp_delete_attachment( $csv_file_id, true );
418
-
419
- do_action( 'acui_post_frontend_import' );
 
 
 
 
 
420
  else:
421
  ?>
422
 
@@ -426,11 +431,12 @@ class ACUI_Frontend{
426
  <?php do_action( 'acui_frontend_import_before_input_file' ); ?>
427
 
428
  <label><?php _e( 'CSV file <span class="description">(required)</span>', 'import-users-from-csv-with-meta' ); ?></label></th>
429
- <input class="acui_frontend_file" type="file" name="uploadfile" id="uploadfile" size="35" class="uploadfile" />
 
430
 
431
  <?php do_action( 'acui_frontend_import_after_input_file' ); ?>
432
 
433
- <input class="acui_frontend_submit" type="submit" value="<?php apply_filters( 'acui_import_shortcode_button_text', _e( 'Upload and process', 'import-users-from-csv-with-meta' ) ); ?>"/>
434
 
435
  <?php do_action( 'acui_frontend_import_after_submit' ); ?>
436
 
378
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
379
  }
380
 
381
+ if( $_FILES['uploadfile']['error'] != 0 || $_FILES['uploadfile']['size'] == 0 ){
382
+ _e( 'You must choose a file', 'import-users-from-csv-with-meta' );
383
+ }
384
+ else{
385
+ do_action( 'acui_pre_frontend_import' );
386
+
387
+ $file = array_keys( $_FILES );
388
+ $csv_file_id = $this->upload_file( $file[0] );
389
+
390
+ // start
391
+ $form_data = array();
392
+ $form_data["path_to_file"] = get_attached_file( $csv_file_id );
393
+
394
+ // emails
395
+ $form_data["sends_email"] = get_option( "acui_frontend_send_mail" );
396
+ $form_data["send_email_updated"] = get_option( "acui_frontend_send_mail_updated" );
397
+ $form_data["force_user_reset_password"] = get_option( "acui_frontend_force_user_reset_password" );
398
+
399
+ // roles
400
+ $form_data["role"] = empty( $atts["role"] ) ? get_option( "acui_frontend_role") : $atts["role"];
401
+
402
+ // update
403
+ $form_data["update_existing_users"] = empty( get_option( "acui_frontend_update_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_existing_users" );
404
+ $form_data["update_roles_existing_users"] = empty( get_option( "acui_frontend_update_roles_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_roles_existing_users" );
405
+
406
+ // delete
407
+ $form_data["delete_users_not_present"] = ( get_option( "acui_frontend_delete_users" ) ) ? 'yes' : 'no';
408
+ $form_data["delete_users_assign_posts"] = get_option( "acui_frontend_delete_users_assign_posts" );
409
+ $form_data["delete_users_only_specified_role"] = empty( $form_data[ "role" ] ) ? false : $atts['delete-only-specified-role'];
410
+
411
+ // others
412
+ $form_data["empty_cell_action"] = "leave";
413
+ $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" );
414
+ $form_data["security"] = wp_create_nonce( "codection-security" );
415
+
416
+ $form_data = apply_filters( 'acui_frontend_import_form_data', $form_data );
417
+
418
+ $acui_import = new ACUI_Import();
419
+ $acui_import->fileupload_process( $form_data, false, true );
420
+
421
+ wp_delete_attachment( $csv_file_id, true );
422
+
423
+ do_action( 'acui_post_frontend_import' );
424
+ }
425
  else:
426
  ?>
427
 
431
  <?php do_action( 'acui_frontend_import_before_input_file' ); ?>
432
 
433
  <label><?php _e( 'CSV file <span class="description">(required)</span>', 'import-users-from-csv-with-meta' ); ?></label></th>
434
+ <input type="button" onclick="document.getElementById('uploadfile').click();" value="<?php echo apply_filters( 'acui_import_shortcode_file_button_text', __( 'Choose file', 'import-users-from-csv-with-meta' ) ); ?>">
435
+ <input class="acui_frontend_file" type="file" name="uploadfile" id="uploadfile" class="uploadfile" style="display:none;"/>
436
 
437
  <?php do_action( 'acui_frontend_import_after_input_file' ); ?>
438
 
439
+ <input class="acui_frontend_submit" type="submit" value="<?php echo apply_filters( 'acui_import_shortcode_button_text', __( 'Upload and process', 'import-users-from-csv-with-meta' ) ); ?>" />
440
 
441
  <?php do_action( 'acui_frontend_import_after_submit' ); ?>
442
 
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.2
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.20.2' );
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.20.3
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.20.3' );
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.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,10 @@ Plugin will automatically detect:
107
 
108
  == Changelog ==
109
 
 
 
 
 
110
  = 1.20.2 =
111
  * Improved section on forcing password reset, including new explanations in the documentation and a tool to reset user data in case a redirection loop problem is encountered
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.3
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.3 =
111
+ * Changed the way the button to choose files in the import from front end is displayed to make it easier to apply styles to it
112
+ * Improved error detection when importing users from the front end
113
+
114
  = 1.20.2 =
115
  * Improved section on forcing password reset, including new explanations in the documentation and a tool to reset user data in case a redirection loop problem is encountered
116