Import users from CSV with meta - Version 1.17.7

Version Description

  • New option in export to prevent problems when exporting serialized values: serialized values sometimes can have problems being displayed in Microsoft Excel or LibreOffice, we can double encapsulate this kind of data but you would not be able to import this data beucase instead of serialized data it would be managed as strings
Download this release

Release Info

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

Code changes from version 1.17.6.3 to 1.17.7

addons/wp-user-manager.php CHANGED
@@ -3,7 +3,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
  if( !is_plugin_active( 'wp-user-manager/wp-user-manager.php' ) ){
5
  return;
6
-
7
  }
8
 
9
  class ACUI_WP_User_Manager{
@@ -11,7 +10,7 @@ class ACUI_WP_User_Manager{
11
  add_filter( 'acui_force_reset_password_edit_profile_url', array( $this, 'force_reset_password_edit_profile_url' ) );
12
  add_filter( 'acui_force_reset_password_redirect_condition', array( $this, 'force_reset_password_redirect_condition' ) );
13
  add_action( 'wpum_account_page_content', array( $this, 'force_reset_password_notice' ), 0 );
14
- add_action( 'wpum_after_user_password_change', array( $this, 'force_reset_save_account_details' ) );
15
  }
16
 
17
  function force_reset_password_edit_profile_url(){
@@ -38,4 +37,4 @@ class ACUI_WP_User_Manager{
38
  delete_user_meta( $user_id, 'acui_force_reset_password' );
39
  }
40
  }
41
- new ACUI_WP_User_Manager();
3
 
4
  if( !is_plugin_active( 'wp-user-manager/wp-user-manager.php' ) ){
5
  return;
 
6
  }
7
 
8
  class ACUI_WP_User_Manager{
10
  add_filter( 'acui_force_reset_password_edit_profile_url', array( $this, 'force_reset_password_edit_profile_url' ) );
11
  add_filter( 'acui_force_reset_password_redirect_condition', array( $this, 'force_reset_password_redirect_condition' ) );
12
  add_action( 'wpum_account_page_content', array( $this, 'force_reset_password_notice' ), 0 );
13
+ add_action( 'wpum_after_user_password_recovery', array( $this, 'force_reset_save_account_details' ) );
14
  }
15
 
16
  function force_reset_password_edit_profile_url(){
37
  delete_user_meta( $user_id, 'acui_force_reset_password' );
38
  }
39
  }
40
+ new ACUI_WP_User_Manager();
classes/export.php CHANGED
@@ -18,6 +18,7 @@ class ACUI_Exporter{
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
  }
22
 
23
  public static function admin_gui(){
@@ -71,10 +72,11 @@ class ACUI_Exporter{
71
  <span class="description"><?php _e( "Order all columns alphabetically to check easier your data. First two columns won't be affected", 'import-users-from-csv-with-meta' ); ?></span>
72
  </td>
73
  </tr>
74
- <tr id="acui_fields" valign="top">
75
- <th scope="row"><?php _e( 'Fields', 'import-users-from-csv-with-meta' ); ?></th>
76
  <td>
77
-
 
78
  </td>
79
  </tr>
80
  <tr id="acui_download_csv_wrapper" valign="top">
@@ -119,24 +121,41 @@ class ACUI_Exporter{
119
  return array_merge( $non_date_keys, $this->user_data, $this->woocommerce_default_user_meta_keys, $this->other_non_date_keys );
120
  }
121
 
122
- function maybe_order_columns_alphabetacally( $row, $order_fields_alphabetically ){
123
- if( !$order_fields_alphabetically)
124
  return $row;
125
 
126
  $first_two_columns = array_slice( $row, 0, 2 );
127
- $to_order_columns = array_slice( $row, 2 );
128
- sort( $to_order_columns );
129
 
130
- return array_merge( $first_two_columns, $to_order_columns );
131
  }
132
 
133
- function maybe_order_row_alphabetically( $row, $user, $datetime_format, $columns, $order_fields_alphabetically ){
134
- if( !$order_fields_alphabetically )
135
  return $row;
136
 
137
- return array_merge( array_flip( $columns ), $row );
 
 
 
 
 
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  static function clean_bad_characters_formulas( $value ){
141
  if( strlen( $value ) == 0 )
142
  return $value;
@@ -201,6 +220,7 @@ class ACUI_Exporter{
201
  $convert_timestamp = isset( $_POST['convert_timestamp'] ) && !empty( $_POST['convert_timestamp'] );
202
  $datetime_format = ( $convert_timestamp ) ? sanitize_text_field( $_POST['datetime_format'] ) : '';
203
  $order_fields_alphabetically = isset( $_POST['order_fields_alphabetically'] ) && !empty( $_POST['order_fields_alphabetically'] );
 
204
  $filtered_columns = ( isset( $_POST['columns'] ) && !empty( $_POST['columns'] ) ) ? $_POST['columns'] : array();
205
  $filtered_columns = $this->manage_filtered_columns( $filtered_columns );
206
 
@@ -241,7 +261,7 @@ class ACUI_Exporter{
241
  $row[] = $key;
242
  }
243
 
244
- $row = apply_filters( 'acui_export_columns', $row, $order_fields_alphabetically );
245
  $columns = $row;
246
  $data[] = $row;
247
  $row = array();
@@ -266,8 +286,7 @@ class ACUI_Exporter{
266
  if( count( $filtered_columns ) == 0 || in_array( 'user_email', $filtered_columns ) || in_array( 'user_login', $filtered_columns ) )
267
  $row = $this->maybe_fill_empty_data( $row, $user, $filtered_columns );
268
 
269
- $row = apply_filters( 'acui_export_data', $row, $user, $datetime_format, $columns, $order_fields_alphabetically );
270
-
271
  $data[] = array_values( $row );
272
  $row = array();
273
  }
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(){
72
  <span class="description"><?php _e( "Order all columns alphabetically to check easier your data. First two columns won't be affected", 'import-users-from-csv-with-meta' ); ?></span>
73
  </td>
74
  </tr>
75
+ <tr id="acui_order_fields_double_encapsulate_serialized_values" valign="top">
76
+ <th scope="row"><?php _e( 'Double encapsulate serialized values', 'import-users-from-csv-with-meta' ); ?></th>
77
  <td>
78
+ <input type="checkbox" name="double_encapsulate_serialized_values" value="1">
79
+ <span class="description"><?php _e( "Serialized values sometimes can have problems being displayed in Microsoft Excel or LibreOffice, we can double encapsulate this kind of data but you would not be able to import this data beucase instead of serialized data it would be managed as strings", 'import-users-from-csv-with-meta' ); ?></span>
80
  </td>
81
  </tr>
82
  <tr id="acui_download_csv_wrapper" valign="top">
121
  return array_merge( $non_date_keys, $this->user_data, $this->woocommerce_default_user_meta_keys, $this->other_non_date_keys );
122
  }
123
 
124
+ function maybe_order_columns_alphabetacally( $row, $args ){
125
+ if( !$args['order_fields_alphabetically'] )
126
  return $row;
127
 
128
  $first_two_columns = array_slice( $row, 0, 2 );
129
+ $to_order_columns = array_unique( array_slice( $row, 2 ) );
130
+ sort( $to_order_columns, SORT_LOCALE_STRING );
131
 
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;
138
 
139
+ $row_sorted = array();
140
+ foreach( $columns as $field ){
141
+ $row_sorted[ $field ] = $row[ $field ];
142
+ }
143
+
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;
150
+
151
+ foreach( $columns as $field ){
152
+ if( is_serialized( $row[ $field ] ) )
153
+ $row[ $field ] = '"' . $row[ $field ] . '"';
154
+ }
155
+
156
+ return $row;
157
+ }
158
+
159
  static function clean_bad_characters_formulas( $value ){
160
  if( strlen( $value ) == 0 )
161
  return $value;
220
  $convert_timestamp = isset( $_POST['convert_timestamp'] ) && !empty( $_POST['convert_timestamp'] );
221
  $datetime_format = ( $convert_timestamp ) ? sanitize_text_field( $_POST['datetime_format'] ) : '';
222
  $order_fields_alphabetically = isset( $_POST['order_fields_alphabetically'] ) && !empty( $_POST['order_fields_alphabetically'] );
223
+ $double_encapsulate_serialized_values = isset( $_POST['double_encapsulate_serialized_values'] ) && !empty( $_POST['double_encapsulate_serialized_values'] );
224
  $filtered_columns = ( isset( $_POST['columns'] ) && !empty( $_POST['columns'] ) ) ? $_POST['columns'] : array();
225
  $filtered_columns = $this->manage_filtered_columns( $filtered_columns );
226
 
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
  $columns = $row;
266
  $data[] = $row;
267
  $row = array();
286
  if( count( $filtered_columns ) == 0 || in_array( 'user_email', $filtered_columns ) || in_array( 'user_login', $filtered_columns ) )
287
  $row = $this->maybe_fill_empty_data( $row, $user, $filtered_columns );
288
 
289
+ $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 ));
 
290
  $data[] = array_values( $row );
291
  $row = array();
292
  }
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.6.3
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.7
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.2
7
- Stable tag: 1.17.6.3
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.6.3 =
107
  * Fixed bug in WP User Manager addon
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.2
7
+ Stable tag: 1.17.7
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.7 =
107
+ * New option in export to prevent problems when exporting serialized values: serialized values sometimes can have problems being displayed in Microsoft Excel or LibreOffice, we can double encapsulate this kind of data but you would not be able to import this data beucase instead of serialized data it would be managed as strings
108
+
109
  = 1.17.6.3 =
110
  * Fixed bug in WP User Manager addon
111