Import users from CSV with meta - Version 1.15.2.2

Version Description

  • Part of the code of frontend has been rewritten to improve readibility
  • New options in frontend upload
Download this release

Release Info

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

Code changes from version 1.15.2.1 to 1.15.2.2

classes/frontend.php CHANGED
@@ -15,6 +15,8 @@ class ACUI_Frontend{
15
  $change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
16
  $change_role_not_present_role_frontend = get_option( "acui_frontend_change_role_not_present_role" );
17
  $role = get_option( "acui_frontend_role" );
 
 
18
  $activate_users_wp_members = get_option( "acui_frontend_activate_users_wp_members" );
19
 
20
  if( empty( $send_mail_frontend ) )
@@ -22,6 +24,12 @@ class ACUI_Frontend{
22
 
23
  if( empty( $send_mail_updated_frontend ) )
24
  $send_mail_updated_frontend = false;
 
 
 
 
 
 
25
  ?>
26
  <h3><?php _e( "Execute an import of users in the frontend", 'import-users-from-csv-with-meta' ); ?></h3>
27
 
@@ -82,6 +90,33 @@ class ACUI_Frontend{
82
  </tbody>
83
  </table>
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  <h2><?php _e( 'Users not present in CSV file', 'import-users-from-csv-with-meta'); ?></h2>
86
  <table class="form-table">
87
  <tbody>
@@ -156,35 +191,51 @@ class ACUI_Frontend{
156
  }
157
 
158
  function shortcode( $atts ) {
 
 
159
  ob_start();
160
 
161
  if( !current_user_can( 'create_users' ) )
162
  wp_die( __( 'Only users who are able to create users can manage this form.', 'import-users-from-csv-with-meta' ) );
163
 
164
- $atts = shortcode_atts( array( 'role' => '' ), $atts );
165
-
166
- if ( $_FILES && !empty( $_POST ) ) {
167
  if ( !wp_verify_nonce( $_POST['security'], 'codection-security' ) ){
168
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
169
  }
170
 
171
- foreach ( $_FILES as $file => $array ) {
172
- $csv_file_id = $this->upload_file( $file );
 
 
 
 
 
 
 
 
173
 
174
- $form_data = array();
175
- $form_data[ "path_to_file" ] = get_attached_file( $csv_file_id );
176
- $form_data[ "role" ] = empty( $atts['role'] ) ? get_option( "acui_frontend_role") : $atts['role'];
177
- $form_data[ "empty_cell_action" ] = "leave";
178
- $form_data[ "is_frontend" ] = true;
179
- $form_data[ "security" ] = wp_create_nonce( "codection-security" );
180
 
181
- acui_fileupload_process( $form_data, false, true );
 
 
182
 
183
- wp_delete_attachment( $csv_file_id, true );
 
 
 
184
 
185
- continue;
186
- }
187
- }
 
 
 
 
 
 
188
  ?>
189
  <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" class="acui_frontend_form">
190
  <label><?php _e( 'CSV file <span class="description">(required)</span>', 'import-users-from-csv-with-meta' ); ?></label></th>
@@ -193,6 +244,8 @@ class ACUI_Frontend{
193
 
194
  <?php wp_nonce_field( 'codection-security', 'security' ); ?>
195
  </form>
 
 
196
  <?php
197
  return ob_get_clean();
198
  }
15
  $change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
16
  $change_role_not_present_role_frontend = get_option( "acui_frontend_change_role_not_present_role" );
17
  $role = get_option( "acui_frontend_role" );
18
+ $update_existing_users = get_option( "acui_frontend_update_existing_users" );
19
+ $update_roles_existing_users = get_option( "acui_frontend_update_roles_existing_users" );
20
  $activate_users_wp_members = get_option( "acui_frontend_activate_users_wp_members" );
21
 
22
  if( empty( $send_mail_frontend ) )
24
 
25
  if( empty( $send_mail_updated_frontend ) )
26
  $send_mail_updated_frontend = false;
27
+
28
+ if( empty( $update_existing_users ) )
29
+ $update_existing_users = 'no';
30
+
31
+ if( empty( $update_roles_existing_users ) )
32
+ $update_roles_existing_users = 'no';
33
  ?>
34
  <h3><?php _e( "Execute an import of users in the frontend", 'import-users-from-csv-with-meta' ); ?></h3>
35
 
90
  </tbody>
91
  </table>
92
 
93
+ <h2><?php _e( 'Update users', 'import-users-from-csv-with-meta'); ?></h2>
94
+
95
+ <table class="form-table">
96
+ <tbody>
97
+ <tr class="form-field form-required">
98
+ <th scope="row"><label><?php _e( 'Update existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
99
+ <td>
100
+ <select name="update_existing_users">
101
+ <option value="yes" <?php selected( $update_existing_users, "yes" ); ?>><?php _e( 'Yes', 'import-users-from-csv-with-meta' ); ?></option>
102
+ <option value="no" <?php selected( $update_existing_users, "no" ); ?>><?php _e( 'No', 'import-users-from-csv-with-meta' ); ?></option>
103
+ </select>
104
+ </td>
105
+ </tr>
106
+
107
+ <tr class="form-field form-required">
108
+ <th scope="row"><label><?php _e( 'Update roles for existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
109
+ <td>
110
+ <select name="update_roles_existing_users">
111
+ <option value="no" <?php selected( $update_roles_existing_users, "no" ); ?>><?php _e( 'No', 'import-users-from-csv-with-meta' ); ?></option>
112
+ <option value="yes" <?php selected( $update_roles_existing_users, "yes" ); ?>><?php _e( 'Yes, update and override existing roles', 'import-users-from-csv-with-meta' ); ?></option>
113
+ <option value="yes_no_override" <?php selected( $update_roles_existing_users, "yes_no_override" ); ?>><?php _e( 'Yes, add new roles and not override existing ones', 'import-users-from-csv-with-meta' ); ?></option>
114
+ </select>
115
+ </td>
116
+ </tr>
117
+ </tbody>
118
+ </table>
119
+
120
  <h2><?php _e( 'Users not present in CSV file', 'import-users-from-csv-with-meta'); ?></h2>
121
  <table class="form-table">
122
  <tbody>
191
  }
192
 
193
  function shortcode( $atts ) {
194
+ $atts = shortcode_atts( array( 'role' => '' ), $atts );
195
+
196
  ob_start();
197
 
198
  if( !current_user_can( 'create_users' ) )
199
  wp_die( __( 'Only users who are able to create users can manage this form.', 'import-users-from-csv-with-meta' ) );
200
 
201
+ if ( $_FILES && !empty( $_POST ) ):
 
 
202
  if ( !wp_verify_nonce( $_POST['security'], 'codection-security' ) ){
203
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
204
  }
205
 
206
+ $file = array_keys( $_FILES );
207
+ $csv_file_id = $this->upload_file( $file[0] );
208
+
209
+ // start
210
+ $form_data = array();
211
+ $form_data[ "path_to_file" ] = get_attached_file( $csv_file_id );
212
+
213
+ // emails
214
+ $form_data[ "sends_email" ] = get_option( "acui_frontend_send_mail" );
215
+ $form_data[ "send_email_updated" ] = get_option( "acui_frontend_send_mail_updated" );
216
 
217
+ // update
218
+ $form_data["update_existing_users" ] = empty( get_option( "acui_frontend_update_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_existing_users" );
219
+ $form_data["update_roles_existing_users" ] = empty( get_option( "acui_frontend_update_roles_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_roles_existing_users" );
 
 
 
220
 
221
+ // delete
222
+ $form_data["delete_users"] = ( get_option( "acui_frontend_delete_users" ) ) ? 'yes' : 'no';
223
+ $form_data["delete_users_assign_posts"] = get_option( "acui_frontend_delete_users_assign_posts" );
224
 
225
+ // roles
226
+ $form_data[ "role" ] = empty( $atts['role'] ) ? get_option( "acui_frontend_role") : $atts['role'];
227
+ $form_data["change_role_not_present"] = ( get_option( "acui_frontend_change_role_not_present" ) ) ? 'yes' : 'no';
228
+ $form_data["change_role_not_present_role"] = get_option( "acui_frontend_change_role_not_present_role" );
229
 
230
+ // others
231
+ $form_data[ "empty_cell_action" ] = "leave";
232
+ $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" );
233
+ $form_data[ "security" ] = wp_create_nonce( "codection-security" );
234
+
235
+ acui_fileupload_process( $form_data, false, true );
236
+
237
+ wp_delete_attachment( $csv_file_id, true );
238
+ else:
239
  ?>
240
  <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" class="acui_frontend_form">
241
  <label><?php _e( 'CSV file <span class="description">(required)</span>', 'import-users-from-csv-with-meta' ); ?></label></th>
244
 
245
  <?php wp_nonce_field( 'codection-security', 'security' ); ?>
246
  </form>
247
+ <?php endif; ?>
248
+
249
  <?php
250
  return ob_get_clean();
251
  }
classes/homepage.php CHANGED
@@ -5,41 +5,12 @@ if ( ! defined( 'ABSPATH' ) ) exit;
5
  class ACUI_Homepage{
6
  public static function admin_gui(){
7
  $last_roles_used = empty( get_option( 'acui_last_roles_used' ) ) ? array( 'subscriber' ) : get_option( 'acui_last_roles_used' );
8
- $args_old_csv = array( 'post_type'=> 'attachment', 'post_mime_type' => 'text/csv', 'post_status' => 'inherit', 'posts_per_page' => -1 );
9
- $old_csv_files = new WP_Query( $args_old_csv );
10
-
11
  acui_check_options();
12
  ?>
13
  <div class="wrap acui">
14
 
15
- <?php if( $old_csv_files->found_posts > 0 ): ?>
16
- <div class="postbox">
17
- <div title="<?php _e( 'Click to open/close', 'import-users-from-csv-with-meta' ); ?>" class="handlediv">
18
- <br>
19
- </div>
20
-
21
- <h3 class="hndle"><span>&nbsp;&nbsp;&nbsp;<?php _e( 'Old CSV files uploaded', 'import-users-from-csv-with-meta' ); ?></span></h3>
22
-
23
- <div class="inside" style="display: block;">
24
- <p><?php _e( 'For security reasons you should delete this files, probably they would be visible in the Internet if a bot or someone discover the URL. You can delete each file or maybe you want delete all CSV files you have uploaded:', 'import-users-from-csv-with-meta' ); ?></p>
25
- <input type="button" value="<?php _e( 'Delete all CSV files uploaded', 'import-users-from-csv-with-meta' ); ?>" id="bulk_delete_attachment" style="float:right;" />
26
- <ul>
27
- <?php while($old_csv_files->have_posts()) :
28
- $old_csv_files->the_post();
29
-
30
- if( get_the_date() == "" )
31
- $date = "undefined";
32
- else
33
- $date = get_the_date();
34
- ?>
35
- <li><a href="<?php echo wp_get_attachment_url( get_the_ID() ); ?>"><?php the_title(); ?></a> <?php _e( 'uploaded on', 'import-users-from-csv-with-meta' ) . ' ' . $date; ?> <input type="button" value="<?php _e( 'Delete', 'import-users-from-csv-with-meta' ); ?>" class="delete_attachment" attach_id="<?php the_ID(); ?>" /></li>
36
- <?php endwhile; ?>
37
- <?php wp_reset_postdata(); ?>
38
- </ul>
39
- <div style="clear:both;"></div>
40
- </div>
41
- </div>
42
- <?php endif; ?>
43
 
44
  <div id='message' class='updated'><?php _e( 'File must contain at least <strong>2 columns: username and email</strong>. These should be the first two columns and it should be placed <strong>in this order: username and email</strong>. If there are more columns, this plugin will manage it automatically.', 'import-users-from-csv-with-meta' ); ?></div>
45
  <div id='message-password' class='error'><?php _e( 'Please, read carefully how <strong>passwords are managed</strong> and also take note about capitalization, this plugin is <strong>case sensitive</strong>.', 'import-users-from-csv-with-meta' ); ?></div>
@@ -304,4 +275,38 @@ class ACUI_Homepage{
304
  </script>
305
  <?php
306
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  }
5
  class ACUI_Homepage{
6
  public static function admin_gui(){
7
  $last_roles_used = empty( get_option( 'acui_last_roles_used' ) ) ? array( 'subscriber' ) : get_option( 'acui_last_roles_used' );
8
+
 
 
9
  acui_check_options();
10
  ?>
11
  <div class="wrap acui">
12
 
13
+ <?php self::maybe_remove_old_csv(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  <div id='message' class='updated'><?php _e( 'File must contain at least <strong>2 columns: username and email</strong>. These should be the first two columns and it should be placed <strong>in this order: username and email</strong>. If there are more columns, this plugin will manage it automatically.', 'import-users-from-csv-with-meta' ); ?></div>
16
  <div id='message-password' class='error'><?php _e( 'Please, read carefully how <strong>passwords are managed</strong> and also take note about capitalization, this plugin is <strong>case sensitive</strong>.', 'import-users-from-csv-with-meta' ); ?></div>
275
  </script>
276
  <?php
277
  }
278
+
279
+ public static function maybe_remove_old_csv(){
280
+ $args_old_csv = array( 'post_type'=> 'attachment', 'post_mime_type' => 'text/csv', 'post_status' => 'inherit', 'posts_per_page' => -1 );
281
+ $old_csv_files = new WP_Query( $args_old_csv );
282
+
283
+ if( $old_csv_files->found_posts > 0 ): ?>
284
+ <div class="postbox">
285
+ <div title="<?php _e( 'Click to open/close', 'import-users-from-csv-with-meta' ); ?>" class="handlediv">
286
+ <br>
287
+ </div>
288
+
289
+ <h3 class="hndle"><span>&nbsp;&nbsp;&nbsp;<?php _e( 'Old CSV files uploaded', 'import-users-from-csv-with-meta' ); ?></span></h3>
290
+
291
+ <div class="inside" style="display: block;">
292
+ <p><?php _e( 'For security reasons you should delete this files, probably they would be visible in the Internet if a bot or someone discover the URL. You can delete each file or maybe you want delete all CSV files you have uploaded:', 'import-users-from-csv-with-meta' ); ?></p>
293
+ <input type="button" value="<?php _e( 'Delete all CSV files uploaded', 'import-users-from-csv-with-meta' ); ?>" id="bulk_delete_attachment" style="float:right;" />
294
+ <ul>
295
+ <?php while($old_csv_files->have_posts()) :
296
+ $old_csv_files->the_post();
297
+
298
+ if( get_the_date() == "" )
299
+ $date = "undefined";
300
+ else
301
+ $date = get_the_date();
302
+ ?>
303
+ <li><a href="<?php echo wp_get_attachment_url( get_the_ID() ); ?>"><?php the_title(); ?></a> <?php _e( 'uploaded on', 'import-users-from-csv-with-meta' ) . ' ' . $date; ?> <input type="button" value="<?php _e( 'Delete', 'import-users-from-csv-with-meta' ); ?>" class="delete_attachment" attach_id="<?php the_ID(); ?>" /></li>
304
+ <?php endwhile; ?>
305
+ <?php wp_reset_postdata(); ?>
306
+ </ul>
307
+ <div style="clear:both;"></div>
308
+ </div>
309
+ </div>
310
+ <?php endif;
311
+ }
312
  }
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.2.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -118,6 +118,8 @@ function acui_get_default_options_list(){
118
  'acui_frontend_change_role_not_present' => false,
119
  'acui_frontend_change_role_not_present_role' => 0,
120
  'acui_frontend_role' => '',
 
 
121
  // others
122
  'acui_manually_send_mail' => false,
123
  'acui_manually_send_mail_updated' => false,
@@ -130,7 +132,7 @@ function acui_activate(){
130
  $acui_default_options_list = acui_get_default_options_list();
131
 
132
  foreach ( $acui_default_options_list as $key => $value) {
133
- add_option( $key, $value );
134
  }
135
  }
136
 
@@ -312,7 +314,7 @@ function acui_fileupload_process( $form_data, $is_cron = false, $is_frontend =
312
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
313
  }
314
 
315
- if( empty( $_FILES['uploadfile']['name'] ) || ( isset( $form_data['is_frontend'] ) && $form_data['is_frontend'] ) ):
316
  $path_to_file = wp_normalize_path( $form_data["path_to_file"] );
317
 
318
  if( validate_file( $path_to_file ) !== 0 ){
@@ -328,7 +330,7 @@ function acui_fileupload_process( $form_data, $is_cron = false, $is_frontend =
328
  $uploadfile = wp_handle_upload( $_FILES['uploadfile'], array( 'test_form' => false, 'mimes' => array('csv' => 'text/csv') ) );
329
 
330
  if ( !$uploadfile || isset( $uploadfile['error'] ) ) {
331
- wp_die( __( 'Problem uploading file to import' . var_export( $uploadfile['error'], true ), 'import-users-from-csv-with-meta' ));
332
  } else {
333
  acui_import_users( $uploadfile['file'], $form_data, acui_get_attachment_id_by_url( $uploadfile['url'] ), $is_cron, $is_frontend );
334
  }
@@ -346,13 +348,11 @@ function acui_manage_frontend_process( $form_data ){
346
  update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
347
  update_option( "acui_frontend_change_role_not_present", isset( $form_data["change-role-not-present-frontend"] ) && $form_data["change-role-not-present-frontend"] == "yes" );
348
  update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change-role-not-present-role-frontend"] ) );
349
-
350
- if( isset( $form_data["activate-users-wp-members-frontend"] ) )
351
- update_option( "acui_frontend_activate_users_wp_members", sanitize_text_field( $form_data["activate-users-wp-members-frontend"] ) );
352
- else
353
- update_option( "acui_frontend_activate_users_wp_members", 'no_activate' );
354
 
355
  update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
 
 
356
  ?>
357
  <div class="updated">
358
  <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
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.2.2
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
118
  'acui_frontend_change_role_not_present' => false,
119
  'acui_frontend_change_role_not_present_role' => 0,
120
  'acui_frontend_role' => '',
121
+ 'acui_frontend_update_existing_users' => false,
122
+ 'acui_frontend_update_roles_existing_users' => false,
123
  // others
124
  'acui_manually_send_mail' => false,
125
  'acui_manually_send_mail_updated' => false,
132
  $acui_default_options_list = acui_get_default_options_list();
133
 
134
  foreach ( $acui_default_options_list as $key => $value) {
135
+ add_option( $key, $value, '', false );
136
  }
137
  }
138
 
314
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
315
  }
316
 
317
+ if( empty( $_FILES['uploadfile']['name'] ) || $is_frontend ):
318
  $path_to_file = wp_normalize_path( $form_data["path_to_file"] );
319
 
320
  if( validate_file( $path_to_file ) !== 0 ){
330
  $uploadfile = wp_handle_upload( $_FILES['uploadfile'], array( 'test_form' => false, 'mimes' => array('csv' => 'text/csv') ) );
331
 
332
  if ( !$uploadfile || isset( $uploadfile['error'] ) ) {
333
+ wp_die( __( 'Problem uploading file to import. Error details: ' . var_export( $uploadfile['error'], true ), 'import-users-from-csv-with-meta' ));
334
  } else {
335
  acui_import_users( $uploadfile['file'], $form_data, acui_get_attachment_id_by_url( $uploadfile['url'] ), $is_cron, $is_frontend );
336
  }
348
  update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
349
  update_option( "acui_frontend_change_role_not_present", isset( $form_data["change-role-not-present-frontend"] ) && $form_data["change-role-not-present-frontend"] == "yes" );
350
  update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change-role-not-present-role-frontend"] ) );
351
+ 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' );
 
 
 
 
352
 
353
  update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
354
+ update_option( "acui_frontend_update_existing_users", sanitize_text_field( $form_data["update_existing_users"] ) );
355
+ update_option( "acui_frontend_update_roles_existing_users", sanitize_text_field( $form_data["update_roles_existing_users"] ) );
356
  ?>
357
  <div class="updated">
358
  <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
importer.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
-
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
- function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){?>
 
6
  <div class="wrap">
7
  <h2><?php echo apply_filters( 'acui_log_main_title', __('Importing users','import-users-from-csv-with-meta') ); ?></h2>
8
  <?php
@@ -52,14 +52,8 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
52
  $delete_users_assign_posts = isset( $form_data["delete_users_assign_posts"] ) ? sanitize_text_field( $form_data["delete_users_assign_posts"] ) : '';
53
  $change_role_not_present = isset( $form_data["change_role_not_present"] ) ? sanitize_text_field( $form_data["change_role_not_present"] ) : '';
54
  $change_role_not_present_role = isset( $form_data["change_role_not_present_role"] ) ? sanitize_text_field( $form_data["change_role_not_present_role"] ) : '';
 
55
 
56
- if( $is_frontend ){
57
- $activate_users_wp_members = get_option( "acui_frontend_activate_users_wp_members" );
58
- }
59
- else{
60
- $activate_users_wp_members = ( !isset( $form_data["activate_users_wp_members"] ) || empty( $form_data["activate_users_wp_members"] ) ) ? "no_activate" : sanitize_text_field( $form_data["activate_users_wp_members"] );
61
- }
62
-
63
  if( $is_cron ){
64
  $allow_multiple_accounts = ( get_option( "acui_cron_allow_multiple_accounts" ) == "allowed" ) ? "allowed" : "not_allowed";
65
  }
@@ -548,13 +542,6 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
548
  }
549
  }
550
  }
551
- elseif( $is_frontend ){
552
- if( get_option( "acui_frontend_send_mail" ) ){
553
- if( $created || ( !$created && get_option( "acui_frontend_send_mail_updated" ) ) ){
554
- $mail_for_this_user = true;
555
- }
556
- }
557
- }
558
  else{
559
  if( isset( $form_data["sends_email"] ) && $form_data["sends_email"] ){
560
  if( $created || ( !$created && ( isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] ) ) )
@@ -636,11 +623,6 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
636
  $delete_users_assign_posts = get_option( "acui_cron_delete_users_assign_posts");
637
  }
638
 
639
- if( $is_frontend && get_option( "acui_frontend_delete_users" ) ){
640
- $delete_users_flag = true;
641
- $delete_users_assign_posts = get_option( "acui_frontend_delete_users_assign_posts");
642
- }
643
-
644
  if( $change_role_not_present == 'yes' ){
645
  $change_role_not_present_flag = true;
646
  }
1
  <?php
 
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>
8
  <?php
52
  $delete_users_assign_posts = isset( $form_data["delete_users_assign_posts"] ) ? sanitize_text_field( $form_data["delete_users_assign_posts"] ) : '';
53
  $change_role_not_present = isset( $form_data["change_role_not_present"] ) ? sanitize_text_field( $form_data["change_role_not_present"] ) : '';
54
  $change_role_not_present_role = isset( $form_data["change_role_not_present_role"] ) ? sanitize_text_field( $form_data["change_role_not_present_role"] ) : '';
55
+ $activate_users_wp_members = ( !isset( $form_data["activate_users_wp_members"] ) || empty( $form_data["activate_users_wp_members"] ) ) ? "no_activate" : sanitize_text_field( $form_data["activate_users_wp_members"] );
56
 
 
 
 
 
 
 
 
57
  if( $is_cron ){
58
  $allow_multiple_accounts = ( get_option( "acui_cron_allow_multiple_accounts" ) == "allowed" ) ? "allowed" : "not_allowed";
59
  }
542
  }
543
  }
544
  }
 
 
 
 
 
 
 
545
  else{
546
  if( isset( $form_data["sends_email"] ) && $form_data["sends_email"] ){
547
  if( $created || ( !$created && ( isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] ) ) )
623
  $delete_users_assign_posts = get_option( "acui_cron_delete_users_assign_posts");
624
  }
625
 
 
 
 
 
 
626
  if( $change_role_not_present == 'yes' ){
627
  $change_role_not_present_flag = true;
628
  }
readme.txt CHANGED
@@ -4,11 +4,11 @@ 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.3.2
7
- Stable tag: 1.15.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- A plugin to import users using CSV files to WP database automatically including custom user meta
12
 
13
  == Description ==
14
 
@@ -91,6 +91,10 @@ Plugin will automatically detect:
91
 
92
  == Changelog ==
93
 
 
 
 
 
94
  = 1.15.2.1 =
95
  * Changed name into repository to describe better what plugin does
96
  * Frontend shortcode now accepts role parameter
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.3.2
7
+ Stable tag: 1.15.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Import and export users and customers using CSV files including custom user meta and roles. Integrations with lots of other plugins. Frontend upload, cron import and much more.
12
 
13
  == Description ==
14
 
91
 
92
  == Changelog ==
93
 
94
+ = 1.15.2.2 =
95
+ * Part of the code of frontend has been rewritten to improve readibility
96
+ * New options in frontend upload
97
+
98
  = 1.15.2.1 =
99
  * Changed name into repository to describe better what plugin does
100
  * Frontend shortcode now accepts role parameter