Import users from CSV with meta - Version 1.21.2

Version Description

  • Improved compatibility with ACF, now the fields of type image or file, generate in the export a new field, with the suffix _url where to show the url of the content and not only the identifier of the attachment in the database as before that was not representative.
  • Improved user interface
Download this release

Release Info

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

Code changes from version 1.21.1 to 1.21.2

addons/advanced-custom-fields.php CHANGED
@@ -11,7 +11,9 @@ class ACUI_ACF{
11
  add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
  add_filter( 'acui_not_meta_fields', array( $this, 'restricted_fields' ), 10, 1 );
13
  add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
14
- add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
 
 
15
  }
16
 
17
  function restricted_fields( $acui_restricted_fields ){
@@ -55,13 +57,6 @@ class ACUI_ACF{
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 ][ 'type' ] == 'relationship' ){
66
  $data = explode( ',', $row[ $pos ] );
67
 
@@ -81,21 +76,30 @@ class ACUI_ACF{
81
  }
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  function get_user_fields(){
85
- $post_id = "user_new";
86
- $fields = array();
87
-
88
- $args = array(
89
- 'user_id' => 'new',
90
- 'user_form' => '#your-profile'
91
- );
92
-
93
  $field_groups = acf_get_field_groups( array( 'user_id' => 'new', 'user_form' => '#your-profile' ) );
94
 
95
  if( empty( $field_groups ) )
96
  return array();
97
 
98
- acf_form_data( array( 'post_id' => "user_new", 'nonce' => 'user' ) );
99
 
100
  foreach( $field_groups as $field_group ) {
101
  $fields[ $field_group['title'] ] = acf_get_fields( $field_group );
@@ -132,7 +136,6 @@ class ACUI_ACF{
132
  foreach ( $fields_of_group as $field ){
133
  $fields_keys[ $field['name'] ] = [
134
  'type' => $field['type'],
135
- // 'select' type has a 'multiple' key which can be 0 or 1
136
  'multiple' => !empty( $field['multiple'] ) || ( !isset( $field['multiple'] ) && in_array( $field['type'], $types_multiple ) ),
137
  ];
138
  }
@@ -140,6 +143,17 @@ class ACUI_ACF{
140
 
141
  return $fields_keys;
142
  }
 
 
 
 
 
 
 
 
 
 
 
143
  }
144
 
145
- new ACUI_ACF();
11
  add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
  add_filter( 'acui_not_meta_fields', array( $this, 'restricted_fields' ), 10, 1 );
13
  add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
14
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
15
+ add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
16
+ add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 2 );
17
  }
18
 
19
  function restricted_fields( $acui_restricted_fields ){
57
  }
58
 
59
  foreach ( $fields_positions as $pos => $key ) {
 
 
 
 
 
 
 
60
  if( $types[ $key ][ 'type' ] == 'relationship' ){
61
  $data = explode( ',', $row[ $pos ] );
62
 
76
  }
77
  }
78
 
79
+ function export_columns( $row ){
80
+ foreach( $this->get_fields_with_url() as $field ){
81
+ $row[] = $field . "_url";
82
+ }
83
+
84
+ return $row;
85
+ }
86
+
87
+ function export_data( $row, $user ){
88
+ foreach( $this->get_fields_with_url() as $field ){
89
+ $row[] = wp_get_attachment_url( get_user_meta( $user, $field, true ) );
90
+ }
91
+
92
+ return $row;
93
+ }
94
+
95
  function get_user_fields(){
96
+ $fields = array();
 
 
 
 
 
 
 
97
  $field_groups = acf_get_field_groups( array( 'user_id' => 'new', 'user_form' => '#your-profile' ) );
98
 
99
  if( empty( $field_groups ) )
100
  return array();
101
 
102
+ //acf_form_data( array( 'post_id' => "user_new", 'nonce' => 'user' ) );
103
 
104
  foreach( $field_groups as $field_group ) {
105
  $fields[ $field_group['title'] ] = acf_get_fields( $field_group );
136
  foreach ( $fields_of_group as $field ){
137
  $fields_keys[ $field['name'] ] = [
138
  'type' => $field['type'],
 
139
  'multiple' => !empty( $field['multiple'] ) || ( !isset( $field['multiple'] ) && in_array( $field['type'], $types_multiple ) ),
140
  ];
141
  }
143
 
144
  return $fields_keys;
145
  }
146
+
147
+ function get_fields_with_url(){
148
+ $fields = array();
149
+
150
+ foreach( $this->get_user_fields_types() as $key => $field ){
151
+ if( in_array( $field['type'], array( 'image', 'file', 'image_aspect_ratio_crop' ) ) )
152
+ $fields[] = $key;
153
+ }
154
+
155
+ return $fields;
156
+ }
157
  }
158
 
159
+ new ACUI_ACF();
classes/help.php CHANGED
@@ -5,6 +5,31 @@ if ( ! defined( 'ABSPATH' ) ) exit;
5
  class ACUI_Help{
6
  public static function message(){
7
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  <div class="postbox">
9
  <h3 class="hndle"><span>&nbsp;<?php _e( 'Need proffessional help with WordPress or WooCommerce?', 'import-users-from-csv-with-meta' ); ?></span></h3>
10
 
5
  class ACUI_Help{
6
  public static function message(){
7
  ?>
8
+ <div class="postbox">
9
+ <h3 class="hndle"><span>&nbsp;<?php _e( 'Do you like it?', 'import-users-from-csv-with-meta' ); ?></span></h3>
10
+
11
+ <div class="inside" style="display: block;">
12
+ <img src="<?php echo esc_url( plugins_url( 'assets/icon_coffee.png', dirname( __FILE__ ) ) ); ?>" alt="<?php _e( 'buy me a coffee', 'import-users-from-csv-with-meta' ); ?>" style=" margin: 5px; float:left;">
13
+ <p><?php _e( 'Hi! we are', 'import-users-from-csv-with-meta'); ?> <a href="https://twitter.com/fjcarazo" target="_blank" title="Javier Carazo">Javier Carazo</a> <?php _e( 'and all the team of', 'import-users-from-csv-with-meta' ); ?> <a href="http://codection.com">Codection</a>, <?php _e("developers of this plugin.", 'import-users-from-csv-with-meta' ); ?></p>
14
+ <p><?php _e( 'We have been spending many hours to develop this plugin and answering questions in the forum to give you the best support. <br>If you like and use this plugin, you can <strong>buy us a cup of coffee</strong>.', 'import-users-from-csv-with-meta' ); ?></p>
15
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
16
+ <input type="hidden" name="cmd" value="_s-xclick">
17
+ <input type="hidden" name="hosted_button_id" value="QPYVWKJG4HDGG">
18
+ <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="<?php _e('PayPal – The safer, easier way to pay online.', 'import-users-from-csv-with-meta' ); ?>">
19
+ <img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
20
+ </form>
21
+ <div style="clear:both;"></div>
22
+ </div>
23
+
24
+ <h3 class="hndle"><span>&nbsp;<?php _e( 'Or if you prefer, you can also help us becoming a Patreon:', 'import-users-from-csv-with-meta' ); ?></span></h3>
25
+
26
+ <div class="inside acui" style="display: block;">
27
+ <a class="patreon" color="primary" type="button" name="become-a-patron" data-tag="become-patron-button" href="https://www.patreon.com/carazo" role="button">
28
+ <div class="oosjif-1 jFPfxp"><span>Become a patron</span></div>
29
+ </a>
30
+ </div>
31
+ </div>
32
+
33
  <div class="postbox">
34
  <h3 class="hndle"><span>&nbsp;<?php _e( 'Need proffessional help with WordPress or WooCommerce?', 'import-users-from-csv-with-meta' ); ?></span></h3>
35
 
classes/import.php CHANGED
@@ -83,18 +83,10 @@ class ACUI_Import{
83
  ACUI_Cron::admin_gui();
84
  break;
85
 
86
- case 'donate':
87
- ACUI_Donate::message();
88
- break;
89
-
90
  case 'help':
91
  ACUI_Help::message();
92
  break;
93
 
94
- case 'new_features':
95
- ACUI_NewFeatures::message();
96
- break;
97
-
98
  default:
99
  do_action( 'acui_tab_action_' . $tab, $section );
100
  break;
@@ -106,15 +98,13 @@ class ACUI_Import{
106
  'homepage' => __( 'Import', 'import-users-from-csv-with-meta' ),
107
  'export' => __( 'Export', 'import-users-from-csv-with-meta' ),
108
  'frontend' => __( 'Frontend', 'import-users-from-csv-with-meta' ),
109
- 'cron' => __( 'Cron import', 'import-users-from-csv-with-meta' ),
 
110
  'columns' => __( 'Extra profile fields', 'import-users-from-csv-with-meta' ),
111
  'meta-keys' => __( 'Meta keys', 'import-users-from-csv-with-meta' ),
112
  'mail-options' => __( 'Mail options', 'import-users-from-csv-with-meta' ),
113
  'doc' => __( 'Documentation', 'import-users-from-csv-with-meta' ),
114
- 'donate' => __( 'Donate/Patreon', 'import-users-from-csv-with-meta' ),
115
- 'shop' => __( 'Shop', 'import-users-from-csv-with-meta' ),
116
- 'help' => __( 'Hire an expert', 'import-users-from-csv-with-meta' ),
117
- // 'new_features' => __( 'New features', 'import-users-from-csv-with-meta' )
118
  );
119
 
120
  $tabs = apply_filters( 'acui_tabs', $tabs );
@@ -122,19 +112,19 @@ class ACUI_Import{
122
  echo '<div id="icon-themes" class="icon32"><br></div>';
123
  echo '<h2 class="nav-tab-wrapper">';
124
  foreach( $tabs as $tab => $name ){
125
- $class = ( $tab == $current ) ? ' nav-tab-active' : '';
126
-
127
- if( $tab == "shop" ){
128
- $href = "https://codection.com/tienda/";
129
- $target = "_blank";
130
- }
131
- else{
132
- $href = "?page=acui&tab=$tab";
133
- $target = "_self";
 
134
  }
135
 
136
- echo "<a class='nav-tab$class' href='$href' target='$target'>$name</a>";
137
-
138
  }
139
  echo '</h2>';
140
  }
@@ -178,9 +168,7 @@ class ACUI_Import{
178
  case 'doc':
179
  case 'mail-options':
180
  case 'cron':
181
- case 'donate':
182
  case 'help':
183
- case 'new_features':
184
  return array();
185
  break;
186
 
83
  ACUI_Cron::admin_gui();
84
  break;
85
 
 
 
 
 
86
  case 'help':
87
  ACUI_Help::message();
88
  break;
89
 
 
 
 
 
90
  default:
91
  do_action( 'acui_tab_action_' . $tab, $section );
92
  break;
98
  'homepage' => __( 'Import', 'import-users-from-csv-with-meta' ),
99
  'export' => __( 'Export', 'import-users-from-csv-with-meta' ),
100
  'frontend' => __( 'Frontend', 'import-users-from-csv-with-meta' ),
101
+ 'cron' => __( 'Recurring import', 'import-users-from-csv-with-meta' ),
102
+ 'cron-export' => __( 'Recurring export', 'import-users-from-csv-with-meta' ),
103
  'columns' => __( 'Extra profile fields', 'import-users-from-csv-with-meta' ),
104
  'meta-keys' => __( 'Meta keys', 'import-users-from-csv-with-meta' ),
105
  'mail-options' => __( 'Mail options', 'import-users-from-csv-with-meta' ),
106
  'doc' => __( 'Documentation', 'import-users-from-csv-with-meta' ),
107
+ 'help' => __( 'More...', 'import-users-from-csv-with-meta' )
 
 
 
108
  );
109
 
110
  $tabs = apply_filters( 'acui_tabs', $tabs );
112
  echo '<div id="icon-themes" class="icon32"><br></div>';
113
  echo '<h2 class="nav-tab-wrapper">';
114
  foreach( $tabs as $tab => $name ){
115
+ $class = ( $tab == $current ) ? ' nav-tab-active' : '';
116
+
117
+ $class = apply_filters( 'acui_tab_class', $class, $tab );
118
+ $href = apply_filters( 'acui_tab_href', '?page=acui&tab=' . $tab, $tab );
119
+ $target = apply_filters( 'acui_tab_target', '_self', $tab );
120
+
121
+ if( !function_exists( 'acui_ec_check_active' ) && $tab == 'cron-export' ){
122
+ $name = $name .= ' (PRO)';
123
+ $href = 'https://import-wp.com/recurring-export-addon/';
124
+ $target = '_blank';
125
  }
126
 
127
+ echo "<a class='nav-tab$class' href='$href' target='$target'>$name</a>";
 
128
  }
129
  echo '</h2>';
130
  }
168
  case 'doc':
169
  case 'mail-options':
170
  case 'cron':
 
171
  case 'help':
 
172
  return array();
173
  break;
174
 
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.21.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.21.1' );
18
 
19
  class ImportExportUsersCustomers{
20
  var $file;
@@ -109,9 +110,10 @@ class ImportExportUsersCustomers{
109
  function plugin_row_meta( $links, $file ){
110
  if ( strpos( $file, basename( __FILE__ ) ) !== false ) {
111
  $new_links = array(
112
- '<a href="https://www.paypal.me/imalrod" target="_blank">' . __( 'Donate', 'import-users-from-csv-with-meta' ) . '</a>',
113
  '<a href="mailto:contacto@codection.com" target="_blank">' . __( 'Premium support', 'import-users-from-csv-with-meta' ) . '</a>',
114
- '<a href="http://codection.com/tienda" target="_blank">' . __( 'Premium plugins', 'import-users-from-csv-with-meta' ) . '</a>',
 
115
  );
116
 
117
  $links = array_merge( $links, $new_links );
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.21.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.21.2' );
19
 
20
  class ImportExportUsersCustomers{
21
  var $file;
110
  function plugin_row_meta( $links, $file ){
111
  if ( strpos( $file, basename( __FILE__ ) ) !== false ) {
112
  $new_links = array(
113
+ '<a href="https://ko-fi.com/codection" target="_blank">' . __( 'Invite us for a coffee', 'import-users-from-csv-with-meta' ) . '</a>',
114
  '<a href="mailto:contacto@codection.com" target="_blank">' . __( 'Premium support', 'import-users-from-csv-with-meta' ) . '</a>',
115
+ '<a href="https://codection.com/" target="_blank">' . __( 'RedSys and Ceca Gateways', 'import-users-from-csv-with-meta' ) . '</a>',
116
+ '<a href="https://import-wp.com/" target="_blank" style="color:#d54e21;font-weight:bold">' . __( 'Premium addons and plugins', 'import-users-from-csv-with-meta' ) . '</a>',
117
  );
118
 
119
  $links = array_merge( $links, $new_links );
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: 6.1
7
- Stable tag: 1.21.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -108,6 +108,10 @@ Plugin will automatically detect:
108
 
109
  == Changelog ==
110
 
 
 
 
 
111
  = 1.21.1 =
112
  * Fixed a problem when sending email content, which caused the password to always appear as if it had not been changed even though it really had
113
 
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: 6.1
7
+ Stable tag: 1.21.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
108
 
109
  == Changelog ==
110
 
111
+ = 1.21.2 =
112
+ * Improved compatibility with ACF, now the fields of type image or file, generate in the export a new field, with the suffix _url where to show the url of the content and not only the identifier of the attachment in the database as before that was not representative.
113
+ * Improved user interface
114
+
115
  = 1.21.1 =
116
  * Fixed a problem when sending email content, which caused the password to always appear as if it had not been changed even though it really had
117