Import users from CSV with meta - Version 1.17.8.3

Version Description

  • Export shortcode parameter column now also defines the order of the columns
Download this release

Release Info

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

Code changes from version 1.17.8.2 to 1.17.8.3

classes/export.php CHANGED
@@ -16,9 +16,11 @@ class ACUI_Exporter{
16
  add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
17
  add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
18
  add_filter( 'acui_export_non_date_keys', array( $this, 'get_non_date_keys' ), 1, 1 );
19
- add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), PHP_INT_MAX, 2 );
20
- add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), PHP_INT_MAX, 5 );
21
- add_filter( 'acui_export_data', array( $this, 'maybe_double_encapsulate_serialized_values' ), PHP_INT_MAX - 1, 5 );
 
 
22
  }
23
 
24
  public static function admin_gui(){
@@ -132,6 +134,10 @@ class ACUI_Exporter{
132
  return array_merge( $first_two_columns, $to_order_columns );
133
  }
134
 
 
 
 
 
135
  function maybe_order_row_alphabetically( $row, $user, $datetime_format, $columns, $args ){
136
  if( !$args['order_fields_alphabetically'] )
137
  return $row;
@@ -144,6 +150,18 @@ class ACUI_Exporter{
144
  return $row_sorted;
145
  }
146
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  function maybe_double_encapsulate_serialized_values( $row, $user, $datetime_format, $columns, $args ){
148
  if( !$args['double_encapsulate_serialized_values'] )
149
  return $row;
@@ -261,7 +279,7 @@ class ACUI_Exporter{
261
  $row[] = $key;
262
  }
263
 
264
- $row = apply_filters( 'acui_export_columns', $row, array( 'order_fields_alphabetically' => $order_fields_alphabetically, 'double_encapsulate_serialized_values' => $double_encapsulate_serialized_values ) );
265
  $from = apply_filters( 'acui_export_user_registered_from_date', $from );
266
  $to = apply_filters( 'acui_export_user_registered_to_date', $to );
267
 
@@ -289,7 +307,7 @@ class ACUI_Exporter{
289
  if( count( $filtered_columns ) == 0 || in_array( 'user_email', $filtered_columns ) || in_array( 'user_login', $filtered_columns ) )
290
  $row = $this->maybe_fill_empty_data( $row, $user, $filtered_columns );
291
 
292
- $row = apply_filters( 'acui_export_data', $row, $user, $datetime_format, $columns, array( 'order_fields_alphabetically' => $order_fields_alphabetically, 'double_encapsulate_serialized_values' => $double_encapsulate_serialized_values ));
293
  $data[] = array_values( $row );
294
  $row = array();
295
  }
16
  add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
17
  add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
18
  add_filter( 'acui_export_non_date_keys', array( $this, 'get_non_date_keys' ), 1, 1 );
19
+ add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), 10, 2 );
20
+ add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_filtered_columns_parameter' ), 11, 2 );
21
+ add_filter( 'acui_export_data', array( $this, 'maybe_double_encapsulate_serialized_values' ), 9 - 1, 5 );
22
+ add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), 10, 5 );
23
+ add_filter( 'acui_export_data', array( $this, 'maybe_order_row_filtered_columns_parameter' ), 11, 5 );
24
  }
25
 
26
  public static function admin_gui(){
134
  return array_merge( $first_two_columns, $to_order_columns );
135
  }
136
 
137
+ function maybe_order_columns_filtered_columns_parameter( $row, $args ){
138
+ return ( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 ) ? $row : $args['filtered_columns'];
139
+ }
140
+
141
  function maybe_order_row_alphabetically( $row, $user, $datetime_format, $columns, $args ){
142
  if( !$args['order_fields_alphabetically'] )
143
  return $row;
150
  return $row_sorted;
151
  }
152
 
153
+ function maybe_order_row_filtered_columns_parameter( $row, $user, $datetime_format, $columns, $args ){
154
+ if( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 )
155
+ return $row;
156
+
157
+ $row_sorted = array();
158
+ foreach( $args['filtered_columns'] as $field ){
159
+ $row_sorted[ $field ] = $row[ $field ];
160
+ }
161
+
162
+ return $row_sorted;
163
+ }
164
+
165
  function maybe_double_encapsulate_serialized_values( $row, $user, $datetime_format, $columns, $args ){
166
  if( !$args['double_encapsulate_serialized_values'] )
167
  return $row;
279
  $row[] = $key;
280
  }
281
 
282
+ $row = apply_filters( 'acui_export_columns', $row, array( 'order_fields_alphabetically' => $order_fields_alphabetically, 'double_encapsulate_serialized_values' => $double_encapsulate_serialized_values, 'filtered_columns' => $filtered_columns ) );
283
  $from = apply_filters( 'acui_export_user_registered_from_date', $from );
284
  $to = apply_filters( 'acui_export_user_registered_to_date', $to );
285
 
307
  if( count( $filtered_columns ) == 0 || in_array( 'user_email', $filtered_columns ) || in_array( 'user_login', $filtered_columns ) )
308
  $row = $this->maybe_fill_empty_data( $row, $user, $filtered_columns );
309
 
310
+ $row = apply_filters( 'acui_export_data', $row, $user, $datetime_format, $columns, array( 'order_fields_alphabetically' => $order_fields_alphabetically, 'double_encapsulate_serialized_values' => $double_encapsulate_serialized_values, 'filtered_columns' => $filtered_columns ));
311
  $data[] = array_values( $row );
312
  $row = array();
313
  }
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.8.2
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.8.3
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.8
7
- Stable tag: 1.17.8.2
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.8.2 =
107
  * Password documentation updated
108
  * New hooks added for filtering from and to user_registered date in export acui_export_user_registered_from_date and acui_export_user_registered_to_date
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
7
+ Stable tag: 1.17.8.3
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.8.3 =
107
+ * Export shortcode parameter column now also defines the order of the columns
108
+
109
  = 1.17.8.2 =
110
  * Password documentation updated
111
  * New hooks added for filtering from and to user_registered date in export acui_export_user_registered_from_date and acui_export_user_registered_to_date