Import users from CSV with meta - Version 1.17.5.5

Version Description

  • Frontend settings GUI improved
  • Force users to reset their passwords after login also available for frontend import
  • Fixed issue created in 1.17.5.4 saving options in frontend when import started
Download this release

Release Info

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

Code changes from version 1.17.5.4 to 1.17.5.5

classes/frontend.php CHANGED
@@ -56,20 +56,25 @@ class ACUI_Frontend{
56
  </td>
57
  </tr>
58
 
59
- <tr class="form-field">
60
  <th scope="row"><label for=""><?php _e( 'Attribute role', 'import-users-from-csv-with-meta' ); ?></label></th>
61
  <td><?php _e( 'You can use role as attribute to choose directly in the shortcode the role to use during the import. Remind that you must use the role slug, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta role="editor"]</pre>
62
  </td>
63
  </tr>
64
 
65
- <tr class="form-field">
66
  <th scope="row"><label for=""><?php _e( 'Attribute delete-only-specified-role', 'import-users-from-csv-with-meta' ); ?></label></th>
67
  <td><?php _e( 'You can use this attribute to make delete only users of the specified role that are not present in the CSV, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta role="editor" delete-only-specified-role="true"]</pre> <?php _e( 'will only delete (if the deletion is active) the users not present in the CSV with are editors', 'import-users-from-csv-with-meta' ); ?>
68
  </td>
69
  </tr>
 
 
70
 
 
 
 
71
  <tr class="form-field form-required">
72
- <th scope="row"><label for="role"><?php _e( 'Role', 'import-users-from-csv-with-meta' ); ?></label></th>
73
  <td>
74
  <select id="role-frontend" name="role-frontend">
75
  <?php
@@ -90,18 +95,32 @@ class ACUI_Frontend{
90
  <p class="description"><?php _e( 'Which role would be used to import users?', 'import-users-from-csv-with-meta' ); ?></p>
91
  </td>
92
  </tr>
 
 
93
 
94
- <tr class="form-field form-required">
95
- <th scope="row"><label for="send-mail-frontend"><?php _e( 'Send mail when using frontend import?', 'import-users-from-csv-with-meta' ); ?></label></th>
 
 
 
 
96
  <td>
97
- <input type="checkbox" name="send-mail-frontend" value="yes" <?php if( $send_mail_frontend == true ) echo "checked='checked'"; ?>/>
 
 
 
 
 
 
 
98
  </td>
99
  </tr>
100
 
101
- <tr class="form-field form-required">
102
- <th scope="row"><label for="send-mail-updated-frontend"><?php _e( 'Send mail also to users that are being updated?', 'import-users-from-csv-with-meta' ); ?></label></th>
103
  <td>
104
- <input type="checkbox" name="send-mail-updated-frontend" value="yes" <?php if( $send_mail_updated_frontend == true ) echo "checked='checked'"; ?>/>
 
105
  </td>
106
  </tr>
107
 
@@ -307,19 +326,7 @@ class ACUI_Frontend{
307
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
308
  }
309
 
310
- update_option( "acui_frontend_send_mail", isset( $form_data["send-mail-frontend"] ) && $form_data["send-mail-frontend"] == "yes" );
311
- update_option( "acui_frontend_send_mail_updated", isset( $form_data["send-mail-updated-frontend"] ) && $form_data["send-mail-updated-frontend"] == "yes" );
312
- update_option( "acui_frontend_mail_admin", isset( $form_data["send_mail_admin_frontend"] ) && $form_data["send_mail_admin_frontend"] == "yes" );
313
- update_option( "acui_frontend_send_mail_admin_address_list", sanitize_text_field( $form_data["send_mail_admin_frontend_address_list"] ) );
314
- update_option( "acui_frontend_delete_users", isset( $form_data["delete_users_frontend"] ) && $form_data["delete_users_frontend"] == "yes" );
315
- update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
316
- update_option( "acui_frontend_change_role_not_present", isset( $form_data["change_role_not_present_frontend"] ) && $form_data["change_role_not_present_frontend"] == "yes" );
317
- update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change_role_not_present_role_frontend"] ) );
318
- update_option( "acui_frontend_activate_users_wp_members", isset( $form_data["activate-users-wp-members-frontend"] ) ? sanitize_text_field( $form_data["activate-users-wp-members-frontend"] ) : 'no_activate' );
319
-
320
- update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
321
- update_option( "acui_frontend_update_existing_users", sanitize_text_field( $form_data["update_existing_users"] ) );
322
- update_option( "acui_frontend_update_roles_existing_users", sanitize_text_field( $form_data["update_roles_existing_users"] ) );
323
  ?>
324
  <div class="updated">
325
  <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
@@ -369,6 +376,7 @@ class ACUI_Frontend{
369
  // emails
370
  $form_data[ "sends_email" ] = get_option( "acui_frontend_send_mail" );
371
  $form_data[ "send_email_updated" ] = get_option( "acui_frontend_send_mail_updated" );
 
372
 
373
  // roles
374
  $form_data[ "role" ] = empty( $atts['role'] ) ? get_option( "acui_frontend_role") : $atts['role'];
56
  </td>
57
  </tr>
58
 
59
+ <tr class="form-field">
60
  <th scope="row"><label for=""><?php _e( 'Attribute role', 'import-users-from-csv-with-meta' ); ?></label></th>
61
  <td><?php _e( 'You can use role as attribute to choose directly in the shortcode the role to use during the import. Remind that you must use the role slug, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta role="editor"]</pre>
62
  </td>
63
  </tr>
64
 
65
+ <tr class="form-field">
66
  <th scope="row"><label for=""><?php _e( 'Attribute delete-only-specified-role', 'import-users-from-csv-with-meta' ); ?></label></th>
67
  <td><?php _e( 'You can use this attribute to make delete only users of the specified role that are not present in the CSV, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta role="editor" delete-only-specified-role="true"]</pre> <?php _e( 'will only delete (if the deletion is active) the users not present in the CSV with are editors', 'import-users-from-csv-with-meta' ); ?>
68
  </td>
69
  </tr>
70
+ </tbody>
71
+ </table>
72
 
73
+ <h2 id="acui_roles_header"><?php _e( 'Roles', 'import-users-from-csv-with-meta'); ?></h2>
74
+ <table class="form-table">
75
+ <tbody>
76
  <tr class="form-field form-required">
77
+ <th scope="row"><label for="role"><?php _e( 'Default role', 'import-users-from-csv-with-meta' ); ?></label></th>
78
  <td>
79
  <select id="role-frontend" name="role-frontend">
80
  <?php
95
  <p class="description"><?php _e( 'Which role would be used to import users?', 'import-users-from-csv-with-meta' ); ?></p>
96
  </td>
97
  </tr>
98
+ </tbody>
99
+ </table>
100
 
101
+ <h2 id="acui_options_header"><?php _e( 'Options', 'import-users-from-csv-with-meta'); ?></h2>
102
+ <table class="form-table">
103
+ <tbody>
104
+
105
+ <tr id="acui_send_email_wrapper" class="form-field">
106
+ <th scope="row"><label for="user_login"><?php _e( 'Send mail', 'import-users-from-csv-with-meta' ); ?></label></th>
107
  <td>
108
+ <p id="sends_email_wrapper">
109
+ <?php _e( 'Do you wish to send a mail with credentials and other data?', 'import-users-from-csv-with-meta' ); ?>
110
+ <input type="checkbox" name="send-mail-frontend" value="yes" <?php checked( $send_mail_frontend ); ?>/>
111
+ </p>
112
+ <p id="send_email_updated_wrapper">
113
+ <?php _e( 'Do you wish to send this mail also to users that are being updated? (not only to the one which are being created)', 'import-users-from-csv-with-meta' ); ?>
114
+ <input type="checkbox" name="send-mail-updated-frontend" value="yes" <?php checked( $send_mail_updated_frontend ); ?>/>
115
+ </p>
116
  </td>
117
  </tr>
118
 
119
+ <tr class="form-field form-required">
120
+ <th scope="row"><label for=""><?php _e( 'Force users to reset their passwords?', 'import-users-from-csv-with-meta' ); ?></label></th>
121
  <td>
122
+ <input type="checkbox" name="force_user_reset_password" value="yes" <?php checked( get_option( 'acui_frontend_force_user_reset_password' ) ); ?>/>
123
+ <p class="description"><?php _e( 'If a password is set to an user and you activate this option, the user will be forced to reset their password in their first login', 'import-users-from-csv-with-meta' ); ?></p>
124
  </td>
125
  </tr>
126
 
326
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
327
  }
328
 
329
+ ACUI_Options::save_options( $form_data, false, true );
 
 
 
 
 
 
 
 
 
 
 
 
330
  ?>
331
  <div class="updated">
332
  <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
376
  // emails
377
  $form_data[ "sends_email" ] = get_option( "acui_frontend_send_mail" );
378
  $form_data[ "send_email_updated" ] = get_option( "acui_frontend_send_mail_updated" );
379
+ $form_data["force_user_reset_password"] = get_option( "acui_frontend_force_user_reset_password" );
380
 
381
  // roles
382
  $form_data[ "role" ] = empty( $atts['role'] ) ? get_option( "acui_frontend_role") : $atts['role'];
classes/import.php CHANGED
@@ -17,6 +17,7 @@ class ACUI_Import{
17
  case 'homepage':
18
  ACUI_Options::update( 'last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
19
  ACUI_Options::update( 'path_to_file', sanitize_text_field( $_POST['path_to_file'] ) );
 
20
  $this->fileupload_process( $_POST, false );
21
  return;
22
  break;
@@ -92,7 +93,7 @@ class ACUI_Import{
92
  }
93
  }
94
 
95
- public static function admin_tabs( $current = 'homepage' ) {
96
  $tabs = array(
97
  'homepage' => __( 'Import', 'import-users-from-csv-with-meta' ),
98
  'export' => __( 'Export', 'import-users-from-csv-with-meta' ),
@@ -180,15 +181,13 @@ class ACUI_Import{
180
  $headers_filtered = array();
181
  $is_backend = !$is_frontend && !$is_cron;
182
 
183
- ACUI_Options::save_options( $form_data, $is_cron, $is_frontend );
184
-
185
  $update_existing_users = isset( $form_data["update_existing_users"] ) ? sanitize_text_field( $form_data["update_existing_users"] ) : '';
186
 
187
  $role_default = isset( $form_data["role"] ) ? $form_data["role"] : array( '' );
188
  if( !is_array( $role_default ) )
189
  $role_default = array( $role_default );
190
  array_walk( $role_default, 'sanitize_text_field' );
191
-
192
  $update_emails_existing_users = isset( $form_data["update_emails_existing_users"] ) ? sanitize_text_field( $form_data["update_emails_existing_users"] ) : 'yes';
193
  $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
194
  $update_allow_update_passwords = isset( $form_data["update_allow_update_passwords"] ) ? sanitize_text_field( $form_data["update_allow_update_passwords"] ) : 'yes';
17
  case 'homepage':
18
  ACUI_Options::update( 'last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
19
  ACUI_Options::update( 'path_to_file', sanitize_text_field( $_POST['path_to_file'] ) );
20
+ ACUI_Options::save_options( $_POST );
21
  $this->fileupload_process( $_POST, false );
22
  return;
23
  break;
93
  }
94
  }
95
 
96
+ static function admin_tabs( $current = 'homepage' ) {
97
  $tabs = array(
98
  'homepage' => __( 'Import', 'import-users-from-csv-with-meta' ),
99
  'export' => __( 'Export', 'import-users-from-csv-with-meta' ),
181
  $headers_filtered = array();
182
  $is_backend = !$is_frontend && !$is_cron;
183
 
 
 
184
  $update_existing_users = isset( $form_data["update_existing_users"] ) ? sanitize_text_field( $form_data["update_existing_users"] ) : '';
185
 
186
  $role_default = isset( $form_data["role"] ) ? $form_data["role"] : array( '' );
187
  if( !is_array( $role_default ) )
188
  $role_default = array( $role_default );
189
  array_walk( $role_default, 'sanitize_text_field' );
190
+
191
  $update_emails_existing_users = isset( $form_data["update_emails_existing_users"] ) ? sanitize_text_field( $form_data["update_emails_existing_users"] ) : 'yes';
192
  $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
193
  $update_allow_update_passwords = isset( $form_data["update_allow_update_passwords"] ) ? sanitize_text_field( $form_data["update_allow_update_passwords"] ) : 'yes';
classes/options.php CHANGED
@@ -39,6 +39,7 @@ class ACUI_Options{
39
  self::$prefix . 'frontend_send_mail'=> false,
40
  self::$prefix . 'frontend_send_mail_updated' => false,
41
  self::$prefix . 'frontend_mail_admin' => false,
 
42
  self::$prefix . 'frontend_send_mail_admin_address_list' => '',
43
  self::$prefix . 'frontend_delete_users' => false,
44
  self::$prefix . 'frontend_delete_users_assign_posts' => 0,
@@ -78,11 +79,26 @@ class ACUI_Options{
78
  return update_option( $key, $value );
79
  }
80
 
81
- static function save_options( $form_data, $is_cron, $is_frontend ){
82
  if( !$is_frontend && !$is_cron ){
83
  update_option( "acui_manually_send_mail", isset( $form_data["sends_email"] ) && $form_data["sends_email"] == 'yes' );
84
  update_option( "acui_manually_send_mail_updated", isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] == 'yes' );
85
  update_option( "acui_manually_force_user_reset_password", isset( $form_data["force_user_reset_password"] ) && $form_data["force_user_reset_password"] == 'yes' );
86
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  }
39
  self::$prefix . 'frontend_send_mail'=> false,
40
  self::$prefix . 'frontend_send_mail_updated' => false,
41
  self::$prefix . 'frontend_mail_admin' => false,
42
+ self::$prefix . 'frontend_force_user_reset_password' => false,
43
  self::$prefix . 'frontend_send_mail_admin_address_list' => '',
44
  self::$prefix . 'frontend_delete_users' => false,
45
  self::$prefix . 'frontend_delete_users_assign_posts' => 0,
79
  return update_option( $key, $value );
80
  }
81
 
82
+ static function save_options( $form_data, $is_cron = false, $is_frontend = false ){
83
  if( !$is_frontend && !$is_cron ){
84
  update_option( "acui_manually_send_mail", isset( $form_data["sends_email"] ) && $form_data["sends_email"] == 'yes' );
85
  update_option( "acui_manually_send_mail_updated", isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] == 'yes' );
86
  update_option( "acui_manually_force_user_reset_password", isset( $form_data["force_user_reset_password"] ) && $form_data["force_user_reset_password"] == 'yes' );
87
  }
88
+ elseif( $is_frontend ){
89
+ update_option( "acui_frontend_send_mail", isset( $form_data["send-mail-frontend"] ) && $form_data["send-mail-frontend"] == "yes" );
90
+ update_option( "acui_frontend_send_mail_updated", isset( $form_data["send-mail-updated-frontend"] ) && $form_data["send-mail-updated-frontend"] == "yes" );
91
+ update_option( "acui_frontend_mail_admin", isset( $form_data["send_mail_admin_frontend"] ) && $form_data["send_mail_admin_frontend"] == "yes" );
92
+ update_option( "acui_frontend_send_mail_admin_address_list", sanitize_text_field( $form_data["send_mail_admin_frontend_address_list"] ) );
93
+ update_option( "acui_frontend_delete_users", isset( $form_data["delete_users_frontend"] ) && $form_data["delete_users_frontend"] == "yes" );
94
+ update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
95
+ update_option( "acui_frontend_change_role_not_present", isset( $form_data["change_role_not_present_frontend"] ) && $form_data["change_role_not_present_frontend"] == "yes" );
96
+ update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change_role_not_present_role_frontend"] ) );
97
+ update_option( "acui_frontend_activate_users_wp_members", isset( $form_data["activate-users-wp-members-frontend"] ) ? sanitize_text_field( $form_data["activate-users-wp-members-frontend"] ) : 'no_activate' );
98
+
99
+ update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
100
+ update_option( "acui_frontend_update_existing_users", sanitize_text_field( $form_data["update_existing_users"] ) );
101
+ update_option( "acui_frontend_update_roles_existing_users", sanitize_text_field( $form_data["update_roles_existing_users"] ) );
102
+ }
103
  }
104
  }
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.17.5.4
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -11,6 +11,7 @@ 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
  if ( ! defined( 'ABSPATH' ) )
15
  exit;
16
 
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.17.5.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
+
15
  if ( ! defined( 'ABSPATH' ) )
16
  exit;
17
 
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.7.2
7
- Stable tag: 1.17.5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,11 @@ Plugin will automatically detect:
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
106
  = 1.17.5.4 =
107
  * Solved this issue https://wordpress.org/support/topic/password-gets-changed/
108
  * Solved this issue https://wordpress.org/support/topic/users-without-an-email-address-are-imported/
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.7.2
7
+ Stable tag: 1.17.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.17.5.5 =
107
+ * Frontend settings GUI improved
108
+ * Force users to reset their passwords after login also available for frontend import
109
+ * Fixed issue created in 1.17.5.4 saving options in frontend when import started
110
+
111
  = 1.17.5.4 =
112
  * Solved this issue https://wordpress.org/support/topic/password-gets-changed/
113
  * Solved this issue https://wordpress.org/support/topic/users-without-an-email-address-are-imported/