Import users from CSV with meta - Version 1.17.4

Version Description

  • New shortcode to export users
Download this release

Release Info

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

Code changes from version 1.17.3.6 to 1.17.4

addons/advanced-custom-fields.php CHANGED
@@ -65,7 +65,7 @@ class ACUI_ACF{
65
  $data = explode( ',', $row[ $pos ] );
66
 
67
  foreach ( $data as $it => $slug ) {
68
- $data[ $it ] = $this->get_post_id_by_slug( $slug );
69
  }
70
  }
71
  elseif( $types[ $key ][ 'multiple' ] ){
65
  $data = explode( ',', $row[ $pos ] );
66
 
67
  foreach ( $data as $it => $slug ) {
68
+ $data[ $it ] = ACUI_Helper::get_post_id_by_slug( $slug );
69
  }
70
  }
71
  elseif( $types[ $key ][ 'multiple' ] ){
classes/export.php CHANGED
@@ -197,6 +197,10 @@ class ACUI_Exporter{
197
  case 'TAB':
198
  $delimiter = "\t";
199
  break;
 
 
 
 
200
  }
201
 
202
  $data = array();
197
  case 'TAB':
198
  $delimiter = "\t";
199
  break;
200
+
201
+ default:
202
+ $delimiter = ",";
203
+ break;
204
  }
205
 
206
  $data = array();
classes/frontend.php CHANGED
@@ -6,7 +6,8 @@ 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' ) );
 
10
  }
11
 
12
  public static function admin_gui(){
@@ -37,7 +38,7 @@ class ACUI_Frontend{
37
  if( empty( $update_roles_existing_users ) )
38
  $update_roles_existing_users = 'no';
39
  ?>
40
- <h3><?php _e( "Execute an import of users in the frontend", 'import-users-from-csv-with-meta' ); ?></h3>
41
 
42
  <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8">
43
  <table class="form-table">
@@ -195,6 +196,51 @@ class ACUI_Frontend{
195
  <input class="button-primary" type="submit" value="<?php _e( 'Save frontend import options', 'import-users-from-csv-with-meta'); ?>"/>
196
  </form>
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  <script>
199
  jQuery( document ).ready( function( $ ){
200
  check_delete_users_checked();
@@ -211,6 +257,14 @@ class ACUI_Frontend{
211
  $temp.remove();
212
  } );
213
 
 
 
 
 
 
 
 
 
214
  function check_delete_users_checked(){
215
  if( $('#delete-users-frontend').is(':checked') ){
216
  $( '#change-role-not-present-role-frontend' ).prop( 'disabled', true );
@@ -258,7 +312,7 @@ class ACUI_Frontend{
258
  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' ) );
259
  }
260
 
261
- function shortcode( $atts ) {
262
  $atts = shortcode_atts( array( 'role' => '', 'delete-only-specified-role' => false ), $atts );
263
 
264
  ob_start();
@@ -332,6 +386,31 @@ class ACUI_Frontend{
332
  $attach_id = media_handle_upload( $file_handler, 0 );
333
  return $attach_id;
334
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  }
336
 
337
  new 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(){
38
  if( empty( $update_roles_existing_users ) )
39
  $update_roles_existing_users = 'no';
40
  ?>
41
+ <h3><?php _e( "Execute an import of users in the frontend", 'import-users-from-csv-with-meta' ); ?> <em><a href="#export_frontend">(<?php _e( "you can also do an export in the frontend", 'import-users-from-csv-with-meta' ); ?>)</a></em></h3>
42
 
43
  <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8">
44
  <table class="form-table">
196
  <input class="button-primary" type="submit" value="<?php _e( 'Save frontend import options', 'import-users-from-csv-with-meta'); ?>"/>
197
  </form>
198
 
199
+ <h3 id="export_frontend"><?php _e( "Execute an export of users in the frontend", 'import-users-from-csv-with-meta' ); ?></h3>
200
+ <table class="form-table">
201
+ <tbody>
202
+
203
+ <tr class="form-field">
204
+ <th scope="row"><label for=""><?php _e( 'Use this shortcode in any page or post', 'import-users-from-csv-with-meta' ); ?></label></th>
205
+ <td>
206
+ <pre>[export-users]</pre>
207
+ <input class="button-primary" type="button" id="copy_to_clipboard_export" value="<?php _e( 'Copy to clipboard', 'import-users-from-csv-with-meta'); ?>"/>
208
+ </td>
209
+ </tr>
210
+
211
+ <tr class="form-field">
212
+ <th scope="row"><label for=""><?php _e( 'Attribute role', 'import-users-from-csv-with-meta' ); ?></label></th>
213
+ <td><?php _e( 'You can use role as attribute to choose directly in the shortcode the role to use during the export. 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>
214
+ </td>
215
+ </tr>
216
+
217
+ <tr class="form-field">
218
+ <th scope="row"><label for=""><?php _e( 'Attribute from', 'import-users-from-csv-with-meta' ); ?></label></th>
219
+ <td><?php _e( 'You can use from attribute to filter users created from a specified date. Date format has to be: Y-m-d, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta from="<?php echo date( 'Y-m-d' ); ?>"]</pre>
220
+ </td>
221
+ </tr>
222
+
223
+ <tr class="form-field">
224
+ <th scope="row"><label for=""><?php _e( 'Attribute to', 'import-users-from-csv-with-meta' ); ?></label></th>
225
+ <td><?php _e( 'You can use from attribute to filter users created before a specified date. Date format has to be: Y-m-d, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta to="<?php echo date( 'Y-m-d' ); ?>"]</pre>
226
+ </td>
227
+ </tr>
228
+
229
+ <tr class="form-field">
230
+ <th scope="row"><label for=""><?php _e( 'Attribute delimiter', 'import-users-from-csv-with-meta' ); ?></label></th>
231
+ <td><?php _e( 'You can use delimiter attribute to set which delimiter is going to be used, allowed values are:', 'import-users-from-csv-with-meta' ); ?> COMMA, COLON, SEMICOLON, TAB <pre>[import-users-from-csv-with-meta delimiter="SEMICOLON"]</pre>
232
+ </td>
233
+ </tr>
234
+
235
+ <tr class="form-field">
236
+ <th scope="row"><label for=""><?php _e( 'Attribute order-alphabetically', 'import-users-from-csv-with-meta' ); ?></label></th>
237
+ <td><?php _e( 'You can use order-alphabetically attribute to order alphabetically the fields, for example', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta order-alphabetically]</pre>
238
+ </td>
239
+ </tr>
240
+
241
+ </tbody>
242
+ </table>
243
+
244
  <script>
245
  jQuery( document ).ready( function( $ ){
246
  check_delete_users_checked();
257
  $temp.remove();
258
  } );
259
 
260
+ $( '#copy_to_clipboard_export' ).click( function(){
261
+ var $temp = $("<input>");
262
+ $("body").append($temp);
263
+ $temp.val( '[export-users]' ).select();
264
+ document.execCommand("copy");
265
+ $temp.remove();
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 );
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 ) {
316
  $atts = shortcode_atts( array( 'role' => '', 'delete-only-specified-role' => false ), $atts );
317
 
318
  ob_start();
386
  $attach_id = media_handle_upload( $file_handler, 0 );
387
  return $attach_id;
388
  }
389
+
390
+ function shortcode_export( $atts ) {
391
+ $atts = shortcode_atts( array( 'role' => '', 'from' => '', 'to' => '', 'delimiter' => '', 'order-alphabetically' => '' ), $atts );
392
+
393
+ ob_start();
394
+
395
+ if( !current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
396
+ wp_die( __( 'Only users who are able to create users can export them.', 'import-users-from-csv-with-meta' ) );
397
+
398
+
399
+ ?>
400
+ <form method="POST" action="<?php echo admin_url( 'admin-ajax.php' ); ?>" class="acui_frontend_form">
401
+ <input type="hidden" name="action" value="acui_export_users_csv"/>
402
+
403
+ <?php foreach( $atts as $key => $value ): ?>
404
+ <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
405
+ <?php endforeach; ?>
406
+
407
+ <input class="acui_frontend_submit" type="submit" value="<?php _e( 'Export', 'import-users-from-csv-with-meta' ); ?>"/>
408
+
409
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
410
+ </form>
411
+ <?php
412
+ return ob_get_clean();
413
+ }
414
  }
415
 
416
  new ACUI_Frontend();
classes/import.php CHANGED
@@ -104,7 +104,7 @@ class ACUI_Import{
104
  'donate' => __( 'Donate/Patreon', 'import-users-from-csv-with-meta' ),
105
  'shop' => __( 'Shop', 'import-users-from-csv-with-meta' ),
106
  'help' => __( 'Hire an expert', 'import-users-from-csv-with-meta' ),
107
- 'new_features' => __( 'New features', 'import-users-from-csv-with-meta' )
108
  );
109
 
110
  $tabs = apply_filters( 'acui_tabs', $tabs );
104
  'donate' => __( 'Donate/Patreon', 'import-users-from-csv-with-meta' ),
105
  'shop' => __( 'Shop', 'import-users-from-csv-with-meta' ),
106
  'help' => __( 'Hire an expert', 'import-users-from-csv-with-meta' ),
107
+ // 'new_features' => __( 'New features', 'import-users-from-csv-with-meta' )
108
  );
109
 
110
  $tabs = apply_filters( 'acui_tabs', $tabs );
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.3.6
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
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
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
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.3.6
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.3.6 =
107
  * Fixed problem importing ACF multiple select field type, thanks to @lpointet
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
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 =
107
+ * New shortcode to export users
108
+
109
  = 1.17.3.6 =
110
  * Fixed problem importing ACF multiple select field type, thanks to @lpointet
111