Import users from CSV with meta - Version 1.17.4.2

Version Description

  • Frontend import email now can have a list of custom recipients, different to admin email
Download this release

Release Info

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

Code changes from version 1.17.4.1 to 1.17.4.2

classes/frontend.php CHANGED
@@ -4,16 +4,20 @@ if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  class ACUI_Frontend{
6
  function __construct(){
7
- add_action( 'acui_frontend_save_settings', array( $this, 'save_settings' ), 10, 1 );
 
 
 
8
  add_action( 'acui_post_frontend_import', array( $this, 'email_admin' ) );
9
  add_shortcode( 'import-users-from-csv-with-meta', array( $this, 'shortcode_import' ) );
10
  add_shortcode( 'export-users', array( $this, 'shortcode_export' ) );
11
- }
12
 
13
- public static function admin_gui(){
14
  $send_mail_frontend = get_option( "acui_frontend_send_mail" );
15
  $send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated" );
16
  $send_mail_admin_frontend = get_option( "acui_frontend_mail_admin" );
 
17
  $delete_users_frontend = get_option( "acui_frontend_delete_users" );
18
  $delete_users_assign_posts_frontend = get_option( "acui_frontend_delete_users_assign_posts" );
19
  $change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
@@ -102,9 +106,15 @@ class ACUI_Frontend{
102
  </tr>
103
 
104
  <tr class="form-field form-required">
105
- <th scope="row"><label for="send-mail-admin-frontend"><?php _e( 'Send notification to admin when the frontend importer is used?', 'import-users-from-csv-with-meta' ); ?></label></th>
106
  <td>
107
- <input type="checkbox" name="send-mail-admin-frontend" value="yes" <?php if( $send_mail_admin_frontend == true ) echo "checked='checked'"; ?>/>
 
 
 
 
 
 
108
  </td>
109
  </tr>
110
  </tbody>
@@ -142,10 +152,10 @@ class ACUI_Frontend{
142
  <tbody>
143
 
144
  <tr class="form-field form-required">
145
- <th scope="row"><label for="delete-users-frontend"><?php _e( 'Delete users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
146
  <td>
147
  <div style="float:left; margin-top: 10px;">
148
- <input type="checkbox" name="delete-users-frontend" id="delete-users-frontend" value="yes" <?php if( $delete_users_frontend == true ) echo "checked='checked'"; ?>/>
149
  </div>
150
  <div style="margin-left:25px;">
151
  <select id="delete-users-assign-posts-frontend" name="delete-users-assign-posts-frontend">
@@ -171,13 +181,13 @@ class ACUI_Frontend{
171
  </tr>
172
 
173
  <tr class="form-field form-required">
174
- <th scope="row"><label for="change-role-not-present-frontend"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
175
  <td>
176
  <div style="float:left; margin-top: 10px;">
177
- <input type="checkbox" name="change-role-not-present-frontend" id="change-role-not-present-frontend" value="yes" <?php checked( $change_role_not_present_frontend ); ?> />
178
  </div>
179
  <div style="margin-left:25px;">
180
- <select name="change-role-not-present-role-frontend" id="change-role-not-present-role-frontend">
181
  <?php
182
  $list_roles = ACUI_Helper::get_editable_roles();
183
  foreach ($list_roles as $key => $value):
@@ -244,11 +254,16 @@ class ACUI_Frontend{
244
  <script>
245
  jQuery( document ).ready( function( $ ){
246
  check_delete_users_checked();
 
247
 
248
- $( '#delete-users-frontend' ).on( 'click', function() {
249
  check_delete_users_checked();
250
  });
251
 
 
 
 
 
252
  $( '#copy_to_clipboard' ).click( function(){
253
  var $temp = $("<input>");
254
  $("body").append($temp);
@@ -266,14 +281,22 @@ class ACUI_Frontend{
266
  } );
267
 
268
  function check_delete_users_checked(){
269
- if( $('#delete-users-frontend').is(':checked') ){
270
- $( '#change-role-not-present-role-frontend' ).prop( 'disabled', true );
271
- $( '#change-role-not-present-frontend' ).prop( 'disabled', true );
272
  } else {
273
- $( '#change-role-not-present-role-frontend' ).prop( 'disabled', false );
274
- $( '#change-role-not-present-frontend' ).prop( 'disabled', false );
275
  }
276
  }
 
 
 
 
 
 
 
 
277
  });
278
  </script>
279
  <?php
@@ -286,11 +309,12 @@ class ACUI_Frontend{
286
 
287
  update_option( "acui_frontend_send_mail", isset( $form_data["send-mail-frontend"] ) && $form_data["send-mail-frontend"] == "yes" );
288
  update_option( "acui_frontend_send_mail_updated", isset( $form_data["send-mail-updated-frontend"] ) && $form_data["send-mail-updated-frontend"] == "yes" );
289
- update_option( "acui_frontend_mail_admin", isset( $form_data["send-mail-admin-frontend"] ) && $form_data["send-mail-admin-frontend"] == "yes" );
290
- update_option( "acui_frontend_delete_users", isset( $form_data["delete-users-frontend"] ) && $form_data["delete-users-frontend"] == "yes" );
 
291
  update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
292
- update_option( "acui_frontend_change_role_not_present", isset( $form_data["change-role-not-present-frontend"] ) && $form_data["change-role-not-present-frontend"] == "yes" );
293
- update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change-role-not-present-role-frontend"] ) );
294
  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' );
295
 
296
  update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
@@ -304,12 +328,20 @@ class ACUI_Frontend{
304
  }
305
 
306
  function email_admin(){
 
 
 
 
 
 
 
 
307
  $current_user = wp_get_current_user();
308
  $current_user_name = ( empty( $current_user ) ) ? 'User not logged in' : $current_user->user_login;
309
 
310
  $body_mail = sprintf( __("User with username: %s has executed an import using the shortcode in the frontend.", 'import-users-from-csv-with-meta'), $current_user_name );
311
 
312
- wp_mail( get_option( 'admin_email' ), '[Import and export users and customers] Frontend import has been executed', $body_mail, array( 'Content-Type: text/html; charset=UTF-8' ) );
313
  }
314
 
315
  function shortcode_import( $atts ) {
@@ -413,4 +445,5 @@ class ACUI_Frontend{
413
  }
414
  }
415
 
416
- new ACUI_Frontend();
 
4
 
5
  class ACUI_Frontend{
6
  function __construct(){
7
+ }
8
+
9
+ function hooks(){
10
+ add_action( 'acui_frontend_save_settings', array( $this, 'save_settings' ), 10, 1 );
11
  add_action( 'acui_post_frontend_import', array( $this, 'email_admin' ) );
12
  add_shortcode( 'import-users-from-csv-with-meta', array( $this, 'shortcode_import' ) );
13
  add_shortcode( 'export-users', array( $this, 'shortcode_export' ) );
14
+ }
15
 
16
+ static function admin_gui(){
17
  $send_mail_frontend = get_option( "acui_frontend_send_mail" );
18
  $send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated" );
19
  $send_mail_admin_frontend = get_option( "acui_frontend_mail_admin" );
20
+ $send_mail_admin_adress_list_frontend = get_option( "acui_frontend_send_mail_admin_address_list" );
21
  $delete_users_frontend = get_option( "acui_frontend_delete_users" );
22
  $delete_users_assign_posts_frontend = get_option( "acui_frontend_delete_users_assign_posts" );
23
  $change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
106
  </tr>
107
 
108
  <tr class="form-field form-required">
109
+ <th scope="row"><label for="send_mail_admin_frontend"><?php _e( 'Send notification to admin when the frontend importer is used?', 'import-users-from-csv-with-meta' ); ?></label></th>
110
  <td>
111
+ <div style="float:left; margin-top: 10px;">
112
+ <input type="checkbox" id="send_mail_admin_frontend" name="send_mail_admin_frontend" value="yes" <?php checked( $send_mail_admin_frontend ); ?>/>
113
+ </div>
114
+ <div style="margin-left:25px;">
115
+ <input type="text" id="send_mail_admin_frontend_address_list" name="send_mail_admin_frontend_address_list" value="<?php echo $send_mail_admin_adress_list_frontend; ?>" placeholder="<?php _e( 'Include a list of emails where notification will be sent, use commas to separate addresses', 'import-users-from-csv-with-meta' ); ?>"/>
116
+ <p class="description"><?php _e( 'If list is empty, the admin email will be used', 'import-users-from-csv-with-meta' ); ?></p>
117
+ </div>
118
  </td>
119
  </tr>
120
  </tbody>
152
  <tbody>
153
 
154
  <tr class="form-field form-required">
155
+ <th scope="row"><label for="delete_users_frontend"><?php _e( 'Delete users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
156
  <td>
157
  <div style="float:left; margin-top: 10px;">
158
+ <input type="checkbox" name="delete_users_frontend" id="delete_users_frontend" value="yes" <?php if( $delete_users_frontend == true ) echo "checked='checked'"; ?>/>
159
  </div>
160
  <div style="margin-left:25px;">
161
  <select id="delete-users-assign-posts-frontend" name="delete-users-assign-posts-frontend">
181
  </tr>
182
 
183
  <tr class="form-field form-required">
184
+ <th scope="row"><label for="change_role_not_present_frontend"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
185
  <td>
186
  <div style="float:left; margin-top: 10px;">
187
+ <input type="checkbox" name="change_role_not_present_frontend" id="change_role_not_present_frontend" value="yes" <?php checked( $change_role_not_present_frontend ); ?> />
188
  </div>
189
  <div style="margin-left:25px;">
190
+ <select name="change_role_not_present_role_frontend" id="change_role_not_present_role_frontend">
191
  <?php
192
  $list_roles = ACUI_Helper::get_editable_roles();
193
  foreach ($list_roles as $key => $value):
254
  <script>
255
  jQuery( document ).ready( function( $ ){
256
  check_delete_users_checked();
257
+ check_send_mail_admin_frontend();
258
 
259
+ $( '#delete_users_frontend' ).on( 'click', function() {
260
  check_delete_users_checked();
261
  });
262
 
263
+ $( '#send_mail_admin_frontend' ).on( 'click', function() {
264
+ check_send_mail_admin_frontend();
265
+ });
266
+
267
  $( '#copy_to_clipboard' ).click( function(){
268
  var $temp = $("<input>");
269
  $("body").append($temp);
281
  } );
282
 
283
  function check_delete_users_checked(){
284
+ if( $('#delete_users_frontend').is(':checked') ){
285
+ $( '#change_role_not_present_role_frontend' ).prop( 'disabled', true );
286
+ $( '#change_role_not_present_frontend' ).prop( 'disabled', true );
287
  } else {
288
+ $( '#change_role_not_present_role_frontend' ).prop( 'disabled', false );
289
+ $( '#change_role_not_present_frontend' ).prop( 'disabled', false );
290
  }
291
  }
292
+
293
+ function check_send_mail_admin_frontend(){
294
+ if( $('#send_mail_admin_frontend').is(':checked') ){
295
+ $( '#send_mail_admin_frontend_address_list' ).prop( 'disabled', false );
296
+ } else {
297
+ $( '#send_mail_admin_frontend_address_list' ).prop( 'disabled', true );
298
+ }
299
+ }
300
  });
301
  </script>
302
  <?php
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"] ) );
328
  }
329
 
330
  function email_admin(){
331
+ $send_mail_admin_frontend = get_option( "acui_frontend_mail_admin" );
332
+ if( $send_mail_admin_frontend == false )
333
+ return;
334
+
335
+ $send_mail_admin_adress_list_frontend = get_option( "acui_frontend_send_mail_admin_address_list" );
336
+ if( empty( $send_mail_admin_adress_list_frontend ) )
337
+ $send_mail_admin_adress_list_frontend = get_option( 'admin_email' );
338
+
339
  $current_user = wp_get_current_user();
340
  $current_user_name = ( empty( $current_user ) ) ? 'User not logged in' : $current_user->user_login;
341
 
342
  $body_mail = sprintf( __("User with username: %s has executed an import using the shortcode in the frontend.", 'import-users-from-csv-with-meta'), $current_user_name );
343
 
344
+ wp_mail( $send_mail_admin_adress_list_frontend, '[Import and export users and customers] Frontend import has been executed', $body_mail, array( 'Content-Type: text/html; charset=UTF-8' ) );
345
  }
346
 
347
  function shortcode_import( $atts ) {
445
  }
446
  }
447
 
448
+ $acui_frontend = new ACUI_Frontend();
449
+ $acui_frontend->hooks();
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.4.1
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
 
@@ -50,6 +51,7 @@ class ImportExportUsersCustomers{
50
  'acui_frontend_send_mail'=> false,
51
  'acui_frontend_send_mail_updated' => false,
52
  'acui_frontend_mail_admin' => false,
 
53
  'acui_frontend_delete_users' => false,
54
  'acui_frontend_delete_users_assign_posts' => 0,
55
  'acui_frontend_change_role_not_present' => false,
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.4.2
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
 
51
  'acui_frontend_send_mail'=> false,
52
  'acui_frontend_send_mail_updated' => false,
53
  'acui_frontend_mail_admin' => false,
54
+ 'acui_frontend_send_mail_admin_address_list' => '',
55
  'acui_frontend_delete_users' => false,
56
  'acui_frontend_delete_users_assign_posts' => 0,
57
  'acui_frontend_change_role_not_present' => false,
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
7
- Stable tag: 1.17.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,9 @@ Plugin will automatically detect:
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 1.17.4.1 =
107
  * Process import results shown in a table at the end of process
108
 
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
7
+ Stable tag: 1.17.4.2
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.4.2 =
107
+ * Frontend import email now can have a list of custom recipients, different to admin email
108
+
109
  = 1.17.4.1 =
110
  * Process import results shown in a table at the end of process
111