Import users from CSV with meta - Version 1.16.3.3

Version Description

  • Extra profile fields now can be used also when registering a new user
Download this release

Release Info

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

Code changes from version 1.16.3.2 to 1.16.3.3

classes/columns.php CHANGED
@@ -1,10 +1,18 @@
1
  <?php
2
-
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  class ACUI_Columns{
6
  function __construct(){
7
  //add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  function enqueue( $hook ) {
@@ -153,6 +161,46 @@ class ACUI_Columns{
153
  return $headers_extended;
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
  new ACUI_Columns();
1
  <?php
 
2
  if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
  class ACUI_Columns{
5
  function __construct(){
6
  //add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
7
+
8
+ if( get_option( 'acui_show_profile_fields' ) == true ){
9
+ add_action( "user_new_form", array( $this, "extra_user_profile_fields" ) );
10
+ add_action( "show_user_profile", array( $this, "extra_user_profile_fields" ) );
11
+ add_action( "edit_user_profile", array( $this, "extra_user_profile_fields" ) );
12
+ add_action( "user_register", array( $this, "save_extra_user_profile_fields" ), 10, 1 );
13
+ add_action( "personal_options_update", array( $this, "save_extra_user_profile_fields" ), 10, 1 );
14
+ add_action( "edit_user_profile_update", array( $this, "save_extra_user_profile_fields" ), 10, 1 );
15
+ }
16
  }
17
 
18
  function enqueue( $hook ) {
161
  return $headers_extended;
162
  }
163
 
164
+ function extra_user_profile_fields( $user ) {
165
+ $acui_restricted_fields = acui_get_restricted_fields();
166
+ $headers = get_option("acui_columns");
167
+
168
+ if( is_array( $headers ) && !empty( $headers ) ):
169
+ ?>
170
+ <h3>Extra profile information</h3>
171
+
172
+ <table class="form-table"><?php
173
+ foreach ( $headers as $column ):
174
+ if( in_array( $column, $acui_restricted_fields ) )
175
+ continue;
176
+ ?>
177
+ <tr>
178
+ <th><label for="<?php echo $column; ?>"><?php echo $column; ?></label></th>
179
+ <td><input type="text" name="<?php echo $column; ?>" id="<?php echo $column; ?>" value="<?php echo esc_attr(get_the_author_meta($column, $user->ID )); ?>" class="regular-text" /></td>
180
+ </tr>
181
+ <?php
182
+ endforeach;
183
+ ?>
184
+ </table><?php
185
+ endif;
186
+ }
187
+
188
+ function save_extra_user_profile_fields( $user_id ){
189
+ $headers = get_option("acui_columns");
190
+ $acui_restricted_fields = acui_get_restricted_fields();
191
+
192
+ $post_filtered = filter_input_array( INPUT_POST );
193
+
194
+ if( is_array( $headers ) && count( $headers ) > 0 ):
195
+ foreach ( $headers as $column ){
196
+ if( in_array( $column, $acui_restricted_fields ) )
197
+ continue;
198
+
199
+ $column_sanitized = str_replace(" ", "_", $column);
200
+ update_user_meta( $user_id, $column, $post_filtered[$column_sanitized] );
201
+ }
202
+ endif;
203
+ }
204
  }
205
 
206
  new ACUI_Columns();
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.3.2
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -93,13 +93,6 @@ class ImportExportUsersCustomers{
93
  require_once( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' );
94
  }
95
 
96
- if( get_option( 'acui_show_profile_fields' ) == true ){
97
- add_action( "show_user_profile", array( $this, "extra_user_profile_fields" ) );
98
- add_action( "edit_user_profile", array( $this, "extra_user_profile_fields" ) );
99
- add_action( "personal_options_update", array( $this, "save_extra_user_profile_fields" ) );
100
- add_action( "edit_user_profile_update", array( $this, "save_extra_user_profile_fields" ) );
101
- }
102
-
103
  // classes
104
  foreach ( glob( plugin_dir_path( __FILE__ ) . "classes/*.php" ) as $file ) {
105
  include_once( $file );
@@ -221,49 +214,7 @@ class ImportExportUsersCustomers{
221
  }
222
  }
223
  return $values;
224
- }
225
-
226
- function extra_user_profile_fields( $user ) {
227
- $acui_restricted_fields = acui_get_restricted_fields();
228
- $headers = get_option("acui_columns");
229
-
230
- if( is_array( $headers ) && !empty( $headers ) ):
231
- ?>
232
- <h3>Extra profile information</h3>
233
-
234
- <table class="form-table"><?php
235
- foreach ( $headers as $column ):
236
- if( in_array( $column, $acui_restricted_fields ) )
237
- continue;
238
- ?>
239
- <tr>
240
- <th><label for="<?php echo $column; ?>"><?php echo $column; ?></label></th>
241
- <td><input type="text" name="<?php echo $column; ?>" id="<?php echo $column; ?>" value="<?php echo esc_attr(get_the_author_meta($column, $user->ID )); ?>" class="regular-text" /></td>
242
- </tr>
243
- <?php
244
- endforeach;
245
- ?>
246
- </table><?php
247
- endif;
248
- }
249
-
250
- function save_extra_user_profile_fields( $user_id ){
251
- $headers = get_option("acui_columns");
252
- $acui_restricted_fields = acui_get_restricted_fields();
253
-
254
- $post_filtered = filter_input_array( INPUT_POST );
255
-
256
- if( is_array( $headers ) && count( $headers ) > 0 ):
257
- foreach ( $headers as $column ){
258
- if( in_array( $column, $acui_restricted_fields ) )
259
- continue;
260
-
261
- $column_sanitized = str_replace(" ", "_", $column);
262
- update_user_meta( $user_id, $column, $post_filtered[$column_sanitized] );
263
- }
264
- endif;
265
- }
266
-
267
  }
268
 
269
  function acui_start(){
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.3.3
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
93
  require_once( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' );
94
  }
95
 
 
 
 
 
 
 
 
96
  // classes
97
  foreach ( glob( plugin_dir_path( __FILE__ ) . "classes/*.php" ) as $file ) {
98
  include_once( $file );
214
  }
215
  }
216
  return $values;
217
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
219
 
220
  function acui_start(){
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.3
7
- Stable tag: 1.16.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,9 @@ Plugin will automatically detect:
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 1.16.3.2 =
107
  * Username now can be empty, in this case, we generate random usernames
108
  * Code improvements
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.3
7
+ Stable tag: 1.16.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.16.3.3 =
107
+ * Extra profile fields now can be used also when registering a new user
108
+
109
  = 1.16.3.2 =
110
  * Username now can be empty, in this case, we generate random usernames
111
  * Code improvements