Import users from CSV with meta - Version 1.19.2.2

Version Description

  • Fixed an issue in the export function when using the BuddyPress addon and not all columns are exported.
Download this release

Release Info

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

Code changes from version 1.19.2.1 to 1.19.2.2

addons/buddypress.php CHANGED
@@ -160,13 +160,19 @@ class ACUI_Buddypress{
160
  return $row;
161
  }
162
 
163
- function export_data( $row, $user ){
164
- foreach ( $this->fields as $key ) {
165
- $row[] = xprofile_get_field_data( $key, $user, 'comma' );
 
 
 
166
  }
167
 
168
- $row[] = $this->get_groups( $user );
169
- $row[] = $this->get_member_type( $user );
 
 
 
170
 
171
  return $row;
172
  }
160
  return $row;
161
  }
162
 
163
+ function export_data( $row, $user, $args ){
164
+ if( count( $args['filtered_columns'] ) != 0 )
165
+ $fields_to_export = array_intersect( $this->fields, $args['filtered_columns'] );
166
+
167
+ foreach( $fields_to_export as $key ) {
168
+ $row[ $key ] = xprofile_get_field_data( $key, $user, 'comma' );
169
  }
170
 
171
+ if( count( $args['filtered_columns'] ) == 0 || in_array( 'bp_group_id', $args['filtered_columns'] ) )
172
+ $row['bp_group_id'] = $this->get_groups( $user );
173
+
174
+ if( count( $args['filtered_columns'] ) == 0 || in_array( 'bp_member_type', $args['filtered_columns'] ) )
175
+ $row['bp_member_type'] = $this->get_member_type( $user );
176
 
177
  return $row;
178
  }
addons/wp-private-content-plus.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  if( !is_plugin_active( 'wp-private-content-plus/wp-private-content-plus.php' ) ){
@@ -13,7 +12,7 @@ class ACUI_WP_Private_Content_Plus{
13
  function bootstrap(){
14
  add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
15
  add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
16
- add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 3 );
17
  add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
18
  }
19
 
1
  <?php
 
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
  if( !is_plugin_active( 'wp-private-content-plus/wp-private-content-plus.php' ) ){
12
  function bootstrap(){
13
  add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
14
  add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
15
+ add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 2 );
16
  add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
17
  }
18
 
addons/wp-user-avatar.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  if( !is_plugin_active( 'wp-user-avatar/wp-user-avatar.php' ) ){
@@ -19,7 +18,7 @@ class ACUI_WPUA{
19
  add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation_after_plugins_activated' ) );
20
  add_action( 'post_acui_import_single_user', array( $this, 'post_import_single_user' ), 10, 3 );
21
  add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
22
- add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 3 );
23
  }
24
 
25
  function restricted_fields( $acui_restricted_fields ){
1
  <?php
 
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
  if( !is_plugin_active( 'wp-user-avatar/wp-user-avatar.php' ) ){
18
  add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation_after_plugins_activated' ) );
19
  add_action( 'post_acui_import_single_user', array( $this, 'post_import_single_user' ), 10, 3 );
20
  add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
21
+ add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 2 );
22
  }
23
 
24
  function restricted_fields( $acui_restricted_fields ){
classes/batch_exporter.php CHANGED
@@ -35,8 +35,8 @@ class ACUI_Batch_Exporter{
35
  add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), 10, 2 );
36
  add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
37
  add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_filtered_columns_parameter' ), 11, 2 );
38
- add_filter( 'acui_export_data', array( $this, 'maybe_double_encapsulate_serialized_values' ), 9 - 1, 5 );
39
- add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), 10, 5 );
40
  add_filter( 'acui_export_data', array( $this, 'maybe_order_row_filtered_columns_parameter' ), 11, 5 );
41
 
42
  $this->user_data = array( "user_login", "user_email", "source_user_id", "user_pass", "user_nicename", "user_url", "user_registered", "display_name" );
@@ -69,19 +69,19 @@ class ACUI_Batch_Exporter{
69
  return ( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 ) ? $row : $args['filtered_columns'];
70
  }
71
 
72
- function maybe_order_row_alphabetically( $row, $user, $datetime_format, $columns, $args ){
73
  if( !$args['order_fields_alphabetically'] )
74
  return $row;
75
 
76
  $row_sorted = array();
77
- foreach( $columns as $field ){
78
  $row_sorted[ $field ] = $row[ $field ];
79
  }
80
 
81
  return $row_sorted;
82
  }
83
 
84
- function maybe_order_row_filtered_columns_parameter( $row, $user, $datetime_format, $columns, $args ){
85
  if( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 )
86
  return $row;
87
 
@@ -93,11 +93,11 @@ class ACUI_Batch_Exporter{
93
  return $row_sorted;
94
  }
95
 
96
- function maybe_double_encapsulate_serialized_values( $row, $user, $datetime_format, $columns, $args ){
97
  if( !$args['double_encapsulate_serialized_values'] )
98
  return $row;
99
 
100
- foreach( $columns as $field ){
101
  if( is_serialized( $row[ $field ] ) )
102
  $row[ $field ] = '"' . $row[ $field ] . '"';
103
  }
@@ -592,14 +592,14 @@ class ACUI_Batch_Exporter{
592
  if( count( $this->get_filtered_columns() ) == 0 || in_array( 'role', $this->get_filtered_columns() ) )
593
  $row['role'] = implode( ',', $acui_helper->get_roles_by_user_id( $user ) );
594
 
595
- foreach ( $this->get_user_meta_keys( $this->get_filtered_columns() ) as $key ) {
596
  $row[ $key ] = $this->prepare( $key, get_user_meta( $user, $key, true ), $this->get_datetime_format(), $user );
597
  }
598
 
599
  if( count( $this->get_filtered_columns() ) == 0 || in_array( 'user_email', $this->get_filtered_columns() ) || in_array( 'user_login', $this->get_filtered_columns() ) )
600
  $row = $this->maybe_fill_empty_data( $row, $user, $this->get_filtered_columns() );
601
 
602
- $row = apply_filters( 'acui_export_data', $row, $user, $this->get_datetime_format(), $this->get_columns_to_export(), 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() ));
603
 
604
  $this->row_data[] = array_values( $row );
605
  }
35
  add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), 10, 2 );
36
  add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
37
  add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_filtered_columns_parameter' ), 11, 2 );
38
+ add_filter( 'acui_export_data', array( $this, 'maybe_double_encapsulate_serialized_values' ), 8, 3 );
39
+ add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), 10, 3 );
40
  add_filter( 'acui_export_data', array( $this, 'maybe_order_row_filtered_columns_parameter' ), 11, 5 );
41
 
42
  $this->user_data = array( "user_login", "user_email", "source_user_id", "user_pass", "user_nicename", "user_url", "user_registered", "display_name" );
69
  return ( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 ) ? $row : $args['filtered_columns'];
70
  }
71
 
72
+ function maybe_order_row_alphabetically( $row, $user,$args ){
73
  if( !$args['order_fields_alphabetically'] )
74
  return $row;
75
 
76
  $row_sorted = array();
77
+ foreach( $args['columns'] as $field ){
78
  $row_sorted[ $field ] = $row[ $field ];
79
  }
80
 
81
  return $row_sorted;
82
  }
83
 
84
+ function maybe_order_row_filtered_columns_parameter( $row, $user, $args ){
85
  if( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 )
86
  return $row;
87
 
93
  return $row_sorted;
94
  }
95
 
96
+ function maybe_double_encapsulate_serialized_values( $row, $user, $args ){
97
  if( !$args['double_encapsulate_serialized_values'] )
98
  return $row;
99
 
100
+ foreach( $args['columns'] as $field ){
101
  if( is_serialized( $row[ $field ] ) )
102
  $row[ $field ] = '"' . $row[ $field ] . '"';
103
  }
592
  if( count( $this->get_filtered_columns() ) == 0 || in_array( 'role', $this->get_filtered_columns() ) )
593
  $row['role'] = implode( ',', $acui_helper->get_roles_by_user_id( $user ) );
594
 
595
+ foreach ( $this->get_user_meta_keys() as $key ) {
596
  $row[ $key ] = $this->prepare( $key, get_user_meta( $user, $key, true ), $this->get_datetime_format(), $user );
597
  }
598
 
599
  if( count( $this->get_filtered_columns() ) == 0 || in_array( 'user_email', $this->get_filtered_columns() ) || in_array( 'user_login', $this->get_filtered_columns() ) )
600
  $row = $this->maybe_fill_empty_data( $row, $user, $this->get_filtered_columns() );
601
 
602
+ $row = apply_filters( 'acui_export_data', $row, $user, array( 'columns' => $this->get_columns_to_export(), 'datetime_format' => $this->get_datetime_format(), 'order_fields_alphabetically' => $this->get_order_fields_alphabetically(), 'double_encapsulate_serialized_values' => $this->get_double_encapsulate_serialized_values(), 'filtered_columns' => $this->get_filtered_columns() ));
603
 
604
  $this->row_data[] = array_values( $row );
605
  }
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.2.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -11,10 +11,11 @@ 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
 
17
- define( 'ACUI_VERSION', '1.19.2.1' );
18
 
19
  class ImportExportUsersCustomers{
20
  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.2.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
 
18
+ define( 'ACUI_VERSION', '1.19.2.2' );
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.9.3
7
- Stable tag: 1.19.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -107,6 +107,9 @@ Plugin will automatically detect:
107
 
108
  == Changelog ==
109
 
 
 
 
110
  = 1.19.2.1 =
111
  * Escaped all exists to prevent any XSS execution after CSV import
112
 
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.9.3
7
+ Stable tag: 1.19.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.19.2.2 =
111
+ * Fixed an issue in the export function when using the BuddyPress addon and not all columns are exported.
112
+
113
  = 1.19.2.1 =
114
  * Escaped all exists to prevent any XSS execution after CSV import
115