Import users from CSV with meta - Version 1.18.2

Version Description

  • New hooks added to manage extra profile fields
  • Problem solved in BuddyPress addon
Download this release

Release Info

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

Code changes from version 1.18.1 to 1.18.2

addons/buddypress.php CHANGED
@@ -157,8 +157,8 @@ class ACUI_Buddypress{
157
  }
158
 
159
  function export_data( $row, $user ){
160
- foreach ( $this->fields as $key ) {
161
- $row[] = ACUI_Exporter::prepare( $key, xprofile_get_field_data( $key, $user, 'comma' ), $datetime_format );
162
  }
163
 
164
  $row[] = $this->get_groups( $user );
157
  }
158
 
159
  function export_data( $row, $user ){
160
+ foreach ( $this->fields as $key ) {
161
+ $row[] = xprofile_get_field_data( $key, $user, 'comma' );
162
  }
163
 
164
  $row[] = $this->get_groups( $user );
classes/columns.php CHANGED
@@ -179,7 +179,7 @@ class ACUI_Columns{
179
  ?>
180
  <tr>
181
  <th><label for="<?php echo $column; ?>"><?php echo $column; ?></label></th>
182
- <td><input type="text" name="<?php echo $column; ?>" id="<?php echo $column; ?>" value="<?php echo esc_attr( ACUI_Helper::show_meta( $user->ID, $column ) ); ?>" class="regular-text" /></td>
183
  </tr>
184
  <?php
185
  endforeach;
@@ -198,15 +198,26 @@ class ACUI_Columns{
198
  $acui_restricted_fields = $acui_helper->get_restricted_fields();
199
 
200
  if( is_array( $headers ) && count( $headers ) > 0 ):
 
 
201
  foreach ( $headers as $column ){
202
  if( in_array( $column, $acui_restricted_fields ) )
203
  continue;
204
 
205
  $column_sanitized = str_replace(" ", "_", $column );
206
 
207
- if( isset( $post_filtered[ $column_sanitized ] ) )
208
- update_user_meta( $user_id, $column, $post_filtered[$column_sanitized] );
 
 
 
 
 
 
 
209
  }
 
 
210
  endif;
211
  }
212
 
179
  ?>
180
  <tr>
181
  <th><label for="<?php echo $column; ?>"><?php echo $column; ?></label></th>
182
+ <td><input type="text" name="<?php echo $column; ?>" id="<?php echo $column; ?>" value="<?php echo esc_attr( ACUI_Helper::show_meta( $user->ID, $column ) ); ?>" class="regular-text" <?php echo apply_filters( 'acui_columns_field_extra_attributes', '', $column ); ?>/></td>
183
  </tr>
184
  <?php
185
  endforeach;
198
  $acui_restricted_fields = $acui_helper->get_restricted_fields();
199
 
200
  if( is_array( $headers ) && count( $headers ) > 0 ):
201
+ $values = array();
202
+
203
  foreach ( $headers as $column ){
204
  if( in_array( $column, $acui_restricted_fields ) )
205
  continue;
206
 
207
  $column_sanitized = str_replace(" ", "_", $column );
208
 
209
+ if( isset( $post_filtered[ $column_sanitized ] ) ){
210
+ $old_value = get_user_meta( $user_id, $column, true );
211
+
212
+ if( $old_value != $post_filtered[ $column_sanitized ] )
213
+ $values_changed[ $column ] = $post_filtered[ $column_sanitized ];
214
+
215
+ update_user_meta( $user_id, $column, $post_filtered[ $column_sanitized ] );
216
+ $values[ $column ] = $post_filtered[ $column_sanitized ];
217
+ }
218
  }
219
+
220
+ do_action( 'acui_columns_fields_saved', $values, $values_changed );
221
  endif;
222
  }
223
 
classes/export.php CHANGED
@@ -23,7 +23,7 @@ class ACUI_Exporter{
23
  }
24
 
25
  static function enqueue(){
26
- wp_enqueue_script( 'acui_export_js', plugins_url( 'assets/export.js', dirname( __FILE__ ) ), false, time(), true );
27
  wp_localize_script( 'acui_export_js', 'acui_export_js_object', array(
28
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
29
  'starting_process' => __( 'Starting process', 'import-users-from-csv-with-meta' ),
23
  }
24
 
25
  static function enqueue(){
26
+ wp_enqueue_script( 'acui_export_js', plugins_url( 'assets/export.js', dirname( __FILE__ ) ), false, ACUI_VERSION, true );
27
  wp_localize_script( 'acui_export_js', 'acui_export_js_object', array(
28
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
29
  'starting_process' => __( 'Starting process', 'import-users-from-csv-with-meta' ),
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.18.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -11,9 +11,12 @@ 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
  class ImportExportUsersCustomers{
18
  var $file;
19
 
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.18.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.18.2' );
19
+
20
  class ImportExportUsersCustomers{
21
  var $file;
22
 
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.18.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,10 @@ Plugin will automatically detect:
103
 
104
  == Changelog ==
105
 
 
 
 
 
106
  = 1.18.1 =
107
  * Fixed problem after 1.18 when exporting users
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.8
7
+ Stable tag: 1.18.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.18.2 =
107
+ * New hooks added to manage extra profile fields
108
+ * Problem solved in BuddyPress addon
109
+
110
  = 1.18.1 =
111
  * Fixed problem after 1.18 when exporting users
112