Import users from CSV with meta - Version 1.16.1.5

Version Description

  • Fixed problem importing ACF textarea and other type fields
Download this release

Release Info

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

Code changes from version 1.16.1.4 to 1.16.1.5

addons/advanced-custom-fields.php CHANGED
@@ -43,6 +43,7 @@ class ACUI_ACF{
43
  function import( $headers, $row, $user_id ){
44
  $fields_positions = array();
45
  $types = $this->get_user_fields_types();
 
46
 
47
  foreach ( $types as $key => $type ) {
48
  $pos = array_search( $key, $headers );
@@ -54,22 +55,27 @@ class ACUI_ACF{
54
  }
55
 
56
  foreach ( $fields_positions as $pos => $key ) {
57
- $data = explode( ',', $row[ $pos ] );
 
 
 
 
58
 
59
  // slugs in relationship
60
  if( $types[ $key ] == 'relationship' && (string)(int)$data[0] != $data[0] ){
 
 
61
  foreach ( $data as $it => $slug ) {
62
  $data[ $it ] = $this->get_post_id_by_slug( $slug );
63
  }
64
  }
65
-
66
- $preexisting_values = get_field( $key, "user_" . $user_id );
67
- if( !empty( $preexisting_values ) ){
68
- $data = array_unique( array_merge( $preexisting_values, $data ) );
69
- $data = array_filter( $data, function( $value ) { return !is_null( $value ) && $value !== '' && $value != 0; } );
 
70
  }
71
-
72
- $data = ( sizeof( $data ) > 1 ) ? array_filter( $data, function( $value ){ return $value !== ''; } ) : $data[0];
73
 
74
  update_field( $key, $data, "user_" . $user_id );
75
  }
43
  function import( $headers, $row, $user_id ){
44
  $fields_positions = array();
45
  $types = $this->get_user_fields_types();
46
+ $types_multiple = array( 'select', 'checkbox', 'radio', 'button_group' );
47
 
48
  foreach ( $types as $key => $type ) {
49
  $pos = array_search( $key, $headers );
55
  }
56
 
57
  foreach ( $fields_positions as $pos => $key ) {
58
+ /*$preexisting_values = get_field( $key, "user_" . $user_id );
59
+ if( !empty( $preexisting_values ) ){
60
+ $data = array_unique( array_merge( $preexisting_values, $data ) );
61
+ $data = array_filter( $data, function( $value ) { return !is_null( $value ) && $value !== '' && $value != 0; } );
62
+ }*/
63
 
64
  // slugs in relationship
65
  if( $types[ $key ] == 'relationship' && (string)(int)$data[0] != $data[0] ){
66
+ $data = explode( ',', $row[ $pos ] );
67
+
68
  foreach ( $data as $it => $slug ) {
69
  $data[ $it ] = $this->get_post_id_by_slug( $slug );
70
  }
71
  }
72
+ elseif( in_array( $types[ $key ], $types_multiple ) ){
73
+ $data = explode( ',', $row[ $pos ] );
74
+ array_filter( $data, function( $value ){ return $value !== ''; } );
75
+ }
76
+ else{
77
+ $data = $row[ $pos ];
78
  }
 
 
79
 
80
  update_field( $key, $data, "user_" . $user_id );
81
  }
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.16.1.4
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -11,7 +11,6 @@ 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
-
15
  if ( ! defined( 'ABSPATH' ) )
16
  exit;
17
 
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.16.1.5
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
  if ( ! defined( 'ABSPATH' ) )
15
  exit;
16
 
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.5.1
7
- Stable tag: 1.16.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,9 @@ Plugin will automatically detect:
99
 
100
  == Changelog ==
101
 
 
 
 
102
  = 1.16.1.4 =
103
  * Fixed problem importing ACF text fields
104
 
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.5.1
7
+ Stable tag: 1.16.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 1.16.1.5 =
103
+ * Fixed problem importing ACF textarea and other type fields
104
+
105
  = 1.16.1.4 =
106
  * Fixed problem importing ACF text fields
107