Import users from CSV with meta - Version 1.19.1

Version Description

  • Export now allow to choose which columns export also in "Export" tab and not only in frontend
Download this release

Release Info

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

Code changes from version 1.19 to 1.19.1

classes/batch_exporter.php CHANGED
@@ -5,6 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
5
  }
6
 
7
  class ACUI_Batch_Exporter{
 
8
  protected $filename = 'user-export.csv';
9
  protected $limit = 50;
10
  protected $exported_row_count = 0;
@@ -121,6 +122,14 @@ class ACUI_Batch_Exporter{
121
  $this->set_columns_to_export( apply_filters( 'acui_export_columns', $row, array( 'order_fields_alphabetically' => $this->get_order_fields_alphabetically(), 'double_encapsulate_serialized_values' => $this->get_double_encapsulate_serialized_values(), 'filtered_columns' => $this->get_filtered_columns() ) ) );
122
  }
123
 
 
 
 
 
 
 
 
 
124
  function set_columns_to_export( $columns ) {
125
  $this->columns_to_export = $columns;
126
  }
@@ -356,7 +365,7 @@ class ACUI_Batch_Exporter{
356
  }
357
 
358
  function set_limit( $limit ) {
359
- $this->limit = absint( $limit );
360
  }
361
 
362
  function escape_data( $data ) {
@@ -409,6 +418,9 @@ class ACUI_Batch_Exporter{
409
  }
410
 
411
  protected function get_file_path() {
 
 
 
412
  $upload_dir = wp_upload_dir();
413
  return trailingslashit( $upload_dir['basedir'] ) . $this->get_filename();
414
  }
@@ -515,8 +527,8 @@ class ACUI_Batch_Exporter{
515
  function get_user_id_list( $calculate_total = false ){
516
  $args = array( 'fields' => array( 'ID' ), 'order' => $this->get_order() );
517
 
518
- if( !$calculate_total ){
519
- $args['number' ] = $this->get_limit();
520
  $args['offset'] = ($this->get_page() - 1) * $this->get_limit();
521
  }
522
 
5
  }
6
 
7
  class ACUI_Batch_Exporter{
8
+ protected $path = '';
9
  protected $filename = 'user-export.csv';
10
  protected $limit = 50;
11
  protected $exported_row_count = 0;
122
  $this->set_columns_to_export( apply_filters( 'acui_export_columns', $row, array( 'order_fields_alphabetically' => $this->get_order_fields_alphabetically(), 'double_encapsulate_serialized_values' => $this->get_double_encapsulate_serialized_values(), 'filtered_columns' => $this->get_filtered_columns() ) ) );
123
  }
124
 
125
+ function set_path( $path ){
126
+ $this->path = $path;
127
+ }
128
+
129
+ function get_path(){
130
+ return $this->path;
131
+ }
132
+
133
  function set_columns_to_export( $columns ) {
134
  $this->columns_to_export = $columns;
135
  }
365
  }
366
 
367
  function set_limit( $limit ) {
368
+ $this->limit = ( $limit == -1 ) ? $limit : absint( $limit );
369
  }
370
 
371
  function escape_data( $data ) {
418
  }
419
 
420
  protected function get_file_path() {
421
+ if( !empty( $this->get_path() ) )
422
+ return $this->get_path();
423
+
424
  $upload_dir = wp_upload_dir();
425
  return trailingslashit( $upload_dir['basedir'] ) . $this->get_filename();
426
  }
527
  function get_user_id_list( $calculate_total = false ){
528
  $args = array( 'fields' => array( 'ID' ), 'order' => $this->get_order() );
529
 
530
+ if( !$calculate_total && $this->get_limit() != -1 ){
531
+ $args['number'] = $this->get_limit();
532
  $args['offset'] = ($this->get_page() - 1) * $this->get_limit();
533
  }
534
 
classes/export.php CHANGED
@@ -96,6 +96,13 @@ class ACUI_Exporter{
96
  )); ?>
97
  </td>
98
  </tr>
 
 
 
 
 
 
 
99
  <tr id="acui_user_created_wrapper" valign="top">
100
  <th scope="row"><?php _e( 'User created', 'import-users-from-csv-with-meta' ); ?></th>
101
  <td>
96
  )); ?>
97
  </td>
98
  </tr>
99
+ <tr id="acui_columns" valign="top">
100
+ <th scope="row"><?php _e( 'Columns', 'import-users-from-csv-with-meta' ); ?></th>
101
+ <td>
102
+ <?php ACUIHTML()->textarea( array( 'name' => 'columns' ) ); ?>
103
+ <span class="description"><?php _e( 'You can use this field to set which columns must be exported and in which order. If you leave it empty, all columns will be exported. Use a list of fields separated by commas, for example', 'import-users-from-csv-with-meta' ); ?>: user_email,first_name,last_name</span>
104
+ </td>
105
+ </tr>
106
  <tr id="acui_user_created_wrapper" valign="top">
107
  <th scope="row"><?php _e( 'User created', 'import-users-from-csv-with-meta' ); ?></th>
108
  <td>
classes/html.php CHANGED
@@ -247,6 +247,7 @@ class ACUI_HTML{
247
  'data' => false,
248
  'type' => 'text',
249
  'readonly' => false,
 
250
  );
251
 
252
  $args = wp_parse_args( $args, $defaults );
@@ -260,6 +261,12 @@ class ACUI_HTML{
260
  $readonly = '';
261
  }
262
 
 
 
 
 
 
 
263
  $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
264
  $disabled = '';
265
  if( $args['disabled'] ) {
@@ -282,7 +289,7 @@ class ACUI_HTML{
282
  $output .= '<span class="acui-description">' . esc_html( $args['desc'] ) . '</span>';
283
  }
284
 
285
- $output .= '<input type="' . esc_attr( $args['type'] ) . '" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . '' . $disabled . '' . $readonly . '/>';
286
 
287
  $output .= '</span>';
288
 
@@ -294,6 +301,7 @@ class ACUI_HTML{
294
 
295
  function textarea( $args = array() ) {
296
  $defaults = array(
 
297
  'name' => 'textarea',
298
  'value' => null,
299
  'label' => null,
@@ -324,6 +332,9 @@ class ACUI_HTML{
324
 
325
  $output .= '</span>';
326
 
 
 
 
327
  return $output;
328
  }
329
  }
247
  'data' => false,
248
  'type' => 'text',
249
  'readonly' => false,
250
+ 'required' => false,
251
  );
252
 
253
  $args = wp_parse_args( $args, $defaults );
261
  $readonly = '';
262
  }
263
 
264
+ if ( isset( $args['required'] ) && $args['required'] ) {
265
+ $required = ' required="required"';
266
+ } else {
267
+ $required = '';
268
+ }
269
+
270
  $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
271
  $disabled = '';
272
  if( $args['disabled'] ) {
289
  $output .= '<span class="acui-description">' . esc_html( $args['desc'] ) . '</span>';
290
  }
291
 
292
+ $output .= '<input type="' . esc_attr( $args['type'] ) . '" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . '' . $disabled . '' . $readonly . '' . $required . '/>';
293
 
294
  $output .= '</span>';
295
 
301
 
302
  function textarea( $args = array() ) {
303
  $defaults = array(
304
+ 'echo' => true,
305
  'name' => 'textarea',
306
  'value' => null,
307
  'label' => null,
332
 
333
  $output .= '</span>';
334
 
335
+ if( $args['echo'] )
336
+ echo $output;
337
+
338
  return $output;
339
  }
340
  }
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.19
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -15,7 +15,7 @@ Domain Path: /languages
15
  if ( ! defined( 'ABSPATH' ) )
16
  exit;
17
 
18
- define( 'ACUI_VERSION', '1.19' );
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.19.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
15
  if ( ! defined( 'ABSPATH' ) )
16
  exit;
17
 
18
+ define( 'ACUI_VERSION', '1.19.1' );
19
 
20
  class ImportExportUsersCustomers{
21
  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: 5.8.2
7
- Stable tag: 1.19
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.19 =
107
  * New class to create diffent HTML elements to standarize plugin code
108
  * Different fixes in export function to avoid errors
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.8.2
7
+ Stable tag: 1.19.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.19.1 =
107
+ * Export now allow to choose which columns export also in "Export" tab and not only in frontend
108
+
109
  = 1.19 =
110
  * New class to create diffent HTML elements to standarize plugin code
111
  * Different fixes in export function to avoid errors