Import users from CSV with meta - Version 1.10.8.2

Version Description

  • Thanks to @Carlos Herrera we can now import date fields from BuddyPress
Download this release

Release Info

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

Code changes from version 1.10.8.1 to 1.10.8.2

import-users-from-csv-with-meta.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Import users from CSV with meta
4
  Plugin URI: https://www.codection.com
5
  Description: This plugins allows to import users using CSV files to WP database automatically
6
- Version: 1.10.8.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
3
  Plugin Name: Import users from CSV with meta
4
  Plugin URI: https://www.codection.com
5
  Description: This plugins allows to import users using CSV files to WP database automatically
6
+ Version: 1.10.8.2
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
importer.php CHANGED
@@ -356,10 +356,35 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false
356
 
357
  continue;
358
  }
359
- elseif( in_array( $headers[ $i ], $buddypress_fields ) ){ // buddypress
360
- xprofile_set_field_data( $headers[ $i ], $user_id, $data[ $i ] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  continue;
362
- }
363
  elseif( $headers[ $i ] == 'bp_group' ){ // buddypress group
364
  $groups = explode( ',', $data[ $i ] );
365
  $groups_role = explode( ',', $data[ $positions[ 'bp_group_role' ] ] );
@@ -701,6 +726,7 @@ function acui_options(){
701
  }
702
 
703
  $buddypress_fields = array();
 
704
  $profile_groups = BP_XProfile_Group::get( array( 'fetch_fields' => true ) );
705
 
706
  if ( !empty( $profile_groups ) ) {
@@ -708,6 +734,7 @@ function acui_options(){
708
  if ( !empty( $profile_group->fields ) ) {
709
  foreach ( $profile_group->fields as $field ) {
710
  $buddypress_fields[] = $field->name;
 
711
  }
712
  }
713
  }
356
 
357
  continue;
358
  }
359
+ elseif( ( $bpf_pos = array_search( $headers[ $i ], $buddypress_fields ) ) !== false ){ // buddypress
360
+ switch( $buddypress_types[ $bpf_pos ] ){
361
+ case 'datebox':
362
+ $date = $data[$i];
363
+ switch( true ){
364
+ case is_numeric( $date ):
365
+ $UNIX_DATE = ($date - 25569) * 86400;
366
+ $datebox = gmdate("Y-m-d H:i:s", $UNIX_DATE);break;
367
+ case preg_match('/(\d{1,2})[\/-](\d{1,2})[\/-]([4567890]{1}\d{1})/',$date,$match):
368
+ $match[3]='19'.$match[3];
369
+ case preg_match('/(\d{1,2})[\/-](\d{1,2})[\/-](20[4567890]{1}\d{1})/',$date,$match):
370
+ case preg_match('/(\d{1,2})[\/-](\d{1,2})[\/-](19[4567890]{1}\d{1})/',$date,$match):
371
+ $datebox= ($match[3].'-'.$match[2].'-'.$match[1]);
372
+ break;
373
+
374
+ default:
375
+ $datebox = $date;
376
+ }
377
+
378
+ $datebox = strtotime( $datebox );
379
+ xprofile_set_field_data( $headers[$i], $user_id, date( 'Y-m-d H:i:s', $datebox ) );
380
+ unset( $datebox );
381
+ break;
382
+ default:
383
+ xprofile_set_field_data( $headers[$i], $user_id, $data[$i] );
384
+ }
385
+
386
  continue;
387
+ }
388
  elseif( $headers[ $i ] == 'bp_group' ){ // buddypress group
389
  $groups = explode( ',', $data[ $i ] );
390
  $groups_role = explode( ',', $data[ $positions[ 'bp_group_role' ] ] );
726
  }
727
 
728
  $buddypress_fields = array();
729
+ $buddypress_types=array();
730
  $profile_groups = BP_XProfile_Group::get( array( 'fetch_fields' => true ) );
731
 
732
  if ( !empty( $profile_groups ) ) {
734
  if ( !empty( $profile_group->fields ) ) {
735
  foreach ( $profile_group->fields as $field ) {
736
  $buddypress_fields[] = $field->name;
737
+ $buddypress_types[] = $field->type;
738
  }
739
  }
740
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://paypal.me/codection
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: 4.9
7
- Stable tag: 1.10.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -28,11 +28,11 @@ Clean and easy-to-use Import users plugin. It includes custom user meta to be in
28
 
29
  In Codection we have more plugins, please take a look to them.
30
 
31
- * [Clean Login a plugin to create your own register, log in, lost password and update profile forms](https://wordpress.org/plugins/clean-login/) (free)
32
  * [RedSys Gateway for WooCommerce Pro a plugin to connect your WooCommerce to RedSys](http://codection.com/producto/redsys-gateway-for-woocommerce) (premium)
33
  * [Ceca Gateway for WooCommerce Pro a plugin to connect your WooCommerce to Ceca](http://codection.com/producto/ceca-gateway-for-woocommerce-pro/) (premium)
34
  * [BBVA Bancomer for WooCommerce Pro a plugin to connect your WooCommerce to BBVA Bancomer](http://codection.com/producto/bbva-bancomer-mexico-gateway-for-woocommerce-pro/) (premium)
35
  * [RedSys Button for WordPress a plugin to receive payments using RedSys in WordPress without using WooCommerce](http://codection.com/producto/redsys-button-wordpress/) (premium)
 
36
 
37
  ## **Basics**
38
 
@@ -70,6 +70,12 @@ Plugin will automatically detect:
70
 
71
  == Changelog ==
72
 
 
 
 
 
 
 
73
  = 1.10.8 =
74
  * New system for include addons
75
  * You can now import data from WooCommerce Membership thanks to Lukas from Kousekmusic.cz
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: 4.9
7
+ Stable tag: 1.10.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
28
 
29
  In Codection we have more plugins, please take a look to them.
30
 
 
31
  * [RedSys Gateway for WooCommerce Pro a plugin to connect your WooCommerce to RedSys](http://codection.com/producto/redsys-gateway-for-woocommerce) (premium)
32
  * [Ceca Gateway for WooCommerce Pro a plugin to connect your WooCommerce to Ceca](http://codection.com/producto/ceca-gateway-for-woocommerce-pro/) (premium)
33
  * [BBVA Bancomer for WooCommerce Pro a plugin to connect your WooCommerce to BBVA Bancomer](http://codection.com/producto/bbva-bancomer-mexico-gateway-for-woocommerce-pro/) (premium)
34
  * [RedSys Button for WordPress a plugin to receive payments using RedSys in WordPress without using WooCommerce](http://codection.com/producto/redsys-button-wordpress/) (premium)
35
+ * [Clean Login a plugin to create your own register, log in, lost password and update profile forms](https://wordpress.org/plugins/clean-login/) (free)
36
 
37
  ## **Basics**
38
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.10.8.2 =
74
+ * Thanks to @Carlos Herrera we can now import date fields from BuddyPress
75
+
76
+ = 1.10.8.1 =
77
+ * Bug fixed
78
+
79
  = 1.10.8 =
80
  * New system for include addons
81
  * You can now import data from WooCommerce Membership thanks to Lukas from Kousekmusic.cz