Import users from CSV with meta - Version 1.15.3

Version Description

  • Multisite compatiility improved now you can assign users to blogs after import
Download this release

Release Info

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

Code changes from version 1.15.2.3 to 1.15.3

addons/allow-multiple-accounts.php CHANGED
@@ -2,11 +2,13 @@
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
- if( is_plugin_active( 'allow-multiple-accounts/allow-multiple-accounts.php' ) ){
6
- add_action( 'acui_tab_import_before_import_button', 'acui_allow_multiple_accounts_tab_import_before_import_button' );
7
- add_action( 'acui_tab_cron_before_log', 'acui_allow_multiple_accounts_tab_cron_before_log' );
8
  }
9
 
 
 
 
10
  function acui_allow_multiple_accounts_tab_import_before_import_button(){
11
  ?>
12
  <h2><?php _e( 'Allow multiple accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
+ if( !is_plugin_active( 'allow-multiple-accounts/allow-multiple-accounts.php' ) ){
6
+ return;
 
7
  }
8
 
9
+ add_action( 'acui_tab_import_before_import_button', 'acui_allow_multiple_accounts_tab_import_before_import_button' );
10
+ add_action( 'acui_tab_cron_before_log', 'acui_allow_multiple_accounts_tab_cron_before_log' );
11
+
12
  function acui_allow_multiple_accounts_tab_import_before_import_button(){
13
  ?>
14
  <h2><?php _e( 'Allow multiple accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
addons/buddypress.php CHANGED
@@ -2,10 +2,13 @@
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
- if( is_plugin_active( 'buddypress/bp-loader.php' ) ){
6
- add_action( 'acui_tab_import_before_import_button', 'acui_buddypress_tab_import_before_import_button' );
7
  }
8
 
 
 
 
9
  function acui_buddypress_tab_import_before_import_button(){
10
  if( !class_exists( "BP_XProfile_Group" ) ){
11
  require_once( WP_PLUGIN_DIR . "/buddypress/bp-xprofile/classes/class-bp-xprofile-group.php" );
@@ -44,4 +47,22 @@ function acui_buddypress_tab_import_before_import_button(){
44
  </tbody>
45
  </table>
46
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
+ if( !is_plugin_active( 'buddypress/bp-loader.php' ) ){
6
+ return;
7
  }
8
 
9
+ add_action( 'acui_tab_import_before_import_button', 'acui_buddypress_tab_import_before_import_button' );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_buddypress_documentation_after_plugins_activated' );
11
+
12
  function acui_buddypress_tab_import_before_import_button(){
13
  if( !class_exists( "BP_XProfile_Group" ) ){
14
  require_once( WP_PLUGIN_DIR . "/buddypress/bp-xprofile/classes/class-bp-xprofile-group.php" );
47
  </tbody>
48
  </table>
49
  <?php
50
+ }
51
+
52
+ function acui_buddypress_documentation_after_plugins_activated(){
53
+ ?>
54
+ <tr valign="top">
55
+ <th scope="row"><?php _e( "BuddyPress is activated", 'import-users-from-csv-with-meta' ); ?></th>
56
+ <td><?php _e( "You can use the <strong>profile fields</strong> you have created and also you can set one or more groups for each user. For example:", 'import-users-from-csv-with-meta' ); ?>
57
+ <ul style="list-style:disc outside none; margin-left:2em;">
58
+ <li><?php _e( "If you want to assign an user to a group you have to create a column 'bp_group' and a column 'bp_group_role'", 'import-users-from-csv-with-meta' ); ?></li>
59
+ <li><?php _e( "Then in each cell you have to fill with the BuddyPress <strong>group slug</strong>", 'import-users-from-csv-with-meta' ); ?></li>
60
+ <li><?php _e( "And the role assigned in this group: <em>Administrator, Moderator or Member</em>", 'import-users-from-csv-with-meta' ); ?></li>
61
+ <li><?php _e( "You can do it with multiple groups at the same time using commas to separate different groups, in bp_group column, i.e.: <em>group_1, group_2, group_3</em>", 'import-users-from-csv-with-meta' ); ?></li>
62
+ <li><?php _e( "But you will have to assign a role for each group: <em>Moderator,Moderator,Member,Member</em>", 'import-users-from-csv-with-meta' ); ?></li>
63
+ <li><?php _e( "If you get some error of this kind:", 'import-users-from-csv-with-meta' ); ?> <code>Fatal error: Class 'BP_XProfile_Group'</code> <?php _e( "please enable Buddypress Extended Profile then import the csv file. You can then disable this afterwards", 'import-users-from-csv-with-meta' ); ?></li>
64
+ </ul>
65
+ </td>
66
+ </tr>
67
+ <?php
68
  }
addons/groups.php CHANGED
@@ -2,12 +2,14 @@
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
- if( is_plugin_active( 'groups/groups.php' ) ){
6
- add_filter( 'acui_restricted_fields', 'acui_g_restricted_fields', 10, 1 );
7
- add_action( 'acui_documentation_after_plugins_activated', 'acui_g_documentation_after_plugins_activated' );
8
- add_action( 'post_acui_import_single_user', 'acui_g_post_import_single_user', 10, 3 );
9
  }
10
 
 
 
 
 
11
  function acui_g_restricted_fields( $acui_restricted_fields ){
12
  return array_merge( $acui_restricted_fields, array( 'group_id' ) );
13
  }
2
 
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
+ if( !is_plugin_active( 'groups/groups.php' ) ){
6
+ return;
 
 
7
  }
8
 
9
+ add_filter( 'acui_restricted_fields', 'acui_g_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_g_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_g_post_import_single_user', 10, 3 );
12
+
13
  function acui_g_restricted_fields( $acui_restricted_fields ){
14
  return array_merge( $acui_restricted_fields, array( 'group_id' ) );
15
  }
classes/doc.php CHANGED
@@ -109,24 +109,6 @@ class ACUI_Doc{
109
  </tr>
110
  <?php endif; ?>
111
 
112
- <?php if( is_plugin_active( 'buddypress/bp-loader.php' ) ): ?>
113
-
114
- <tr valign="top">
115
- <th scope="row"><?php _e( "BuddyPress is activated", 'import-users-from-csv-with-meta' ); ?></th>
116
- <td><?php _e( "You can use the <strong>profile fields</strong> you have created and also you can set one or more groups for each user. For example:", 'import-users-from-csv-with-meta' ); ?>
117
- <ul style="list-style:disc outside none; margin-left:2em;">
118
- <li><?php _e( "If you want to assign an user to a group you have to create a column 'bp_group' and a column 'bp_group_role'", 'import-users-from-csv-with-meta' ); ?></li>
119
- <li><?php _e( "Then in each cell you have to fill with the BuddyPress <strong>group slug</strong>", 'import-users-from-csv-with-meta' ); ?></li>
120
- <li><?php _e( "And the role assigned in this group: <em>Administrator, Moderator or Member</em>", 'import-users-from-csv-with-meta' ); ?></li>
121
- <li><?php _e( "You can do it with multiple groups at the same time using commas to separate different groups, in bp_group column, i.e.: <em>group_1, group_2, group_3</em>", 'import-users-from-csv-with-meta' ); ?></li>
122
- <li><?php _e( "But you will have to assign a role for each group: <em>Moderator,Moderator,Member,Member</em>", 'import-users-from-csv-with-meta' ); ?></li>
123
- <li><?php _e( "If you get some error of this kind:", 'import-users-from-csv-with-meta' ); ?> <code>Fatal error: Class 'BP_XProfile_Group'</code> <?php _e( "please enable Buddypress Extended Profile then import the csv file. You can then disable this afterwards", 'import-users-from-csv-with-meta' ); ?></li>
124
- </ul>
125
- </td>
126
- </tr>
127
-
128
- <?php endif; ?>
129
-
130
  <?php do_action( 'acui_documentation_after_plugins_activated' ); ?>
131
 
132
  <tr valign="top">
109
  </tr>
110
  <?php endif; ?>
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  <?php do_action( 'acui_documentation_after_plugins_activated' ); ?>
113
 
114
  <tr valign="top">
classes/multisite.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ if( !is_multisite() )
5
+ return;
6
+
7
+ class ACUI_Multisite{
8
+ function __construct(){
9
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
11
+ add_action( 'post_acui_import_single_user', array( $this, 'assign' ), 10, 4 );
12
+ }
13
+
14
+ function restricted_fields( $acui_restricted_fields ){
15
+ return array_merge( $acui_restricted_fields, array( 'blogs' ) );
16
+ }
17
+
18
+ function documentation(){
19
+ ?>
20
+ <tr valign="top">
21
+ <th scope="row"><?php _e( "Multisite is activated", 'import-users-from-csv-with-meta' ); ?></th>
22
+ <td><?php _e( "Plugin can assing users to blogs after importing them roles. This is how it works:", 'import-users-from-csv-with-meta' ); ?>
23
+ <ul style="list-style:disc outside none; margin-left:2em;">
24
+ <li><?php _e( "You have to <strong>create a column called 'blogs'</strong>: if cell is empty, it won't assign users to any blog; if cell has a value, it will be used. You have to fill it with blog_id", 'import-users-from-csv-with-meta' ); ?></li>
25
+ <li><?php _e( "Multiple blogs can be assigned creating <strong>a list of blog ids</strong> using commas to separate values.", 'import-users-from-csv-with-meta' ); ?></li>
26
+ </ul>
27
+ </td>
28
+ </tr>
29
+ <?php
30
+ }
31
+
32
+ function assign( $headers, $row, $user_id, $role ){
33
+ $pos = array_search( 'blogs', $headers );
34
+
35
+ if( $pos === FALSE )
36
+ return;
37
+
38
+ if( is_array( $role) )
39
+ $role = reset( $role );
40
+
41
+ // blogs that appears in the CSV
42
+ $user_blogs_csv = explode( ',', $row[ $pos ] );
43
+ $user_blogs_csv = array_filter( $user_blogs_csv, function( $value ){ return $value !== ''; } );
44
+
45
+ foreach ( $user_blogs_csv as $blog_id ) {
46
+ add_user_to_blog( $blog_id, $user_id, $role );
47
+ }
48
+ }
49
+ }
50
+ new ACUI_Multisite();
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.15.2.3
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -21,19 +21,6 @@ $acui_restricted_fields = array_merge( $wp_users_fields, $wp_min_fields, $acui_f
21
 
22
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
23
 
24
- require_once( "classes/email-templates.php" );
25
- require_once( "classes/homepage.php" );
26
- require_once( "classes/export.php" );
27
- require_once( "classes/columns.php" );
28
- require_once( "classes/meta-keys.php" );
29
- require_once( "classes/frontend.php" );
30
- require_once( "classes/doc.php" );
31
- require_once( "classes/email-options.php" );
32
- require_once( "classes/cron.php" );
33
- require_once( "classes/donate.php" );
34
- require_once( "classes/help.php" );
35
- require_once( "classes/new_features.php" );
36
-
37
  if( is_plugin_active( 'buddypress/bp-loader.php' ) ){
38
  if ( defined( 'BP_VERSION' ) )
39
  acui_loader();
@@ -67,6 +54,11 @@ function acui_loader(){
67
  add_action( "edit_user_profile_update", "acui_save_extra_user_profile_fields" );
68
  }
69
 
 
 
 
 
 
70
  // includes
71
  foreach ( glob( plugin_dir_path( __FILE__ ) . "include/*.php" ) as $file ) {
72
  include_once( $file );
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.15.3
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
21
 
22
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  if( is_plugin_active( 'buddypress/bp-loader.php' ) ){
25
  if ( defined( 'BP_VERSION' ) )
26
  acui_loader();
54
  add_action( "edit_user_profile_update", "acui_save_extra_user_profile_fields" );
55
  }
56
 
57
+ // classes
58
+ foreach ( glob( plugin_dir_path( __FILE__ ) . "classes/*.php" ) as $file ) {
59
+ include_once( $file );
60
+ }
61
+
62
  // includes
63
  foreach ( glob( plugin_dir_path( __FILE__ ) . "include/*.php" ) as $file ) {
64
  include_once( $file );
importer.php CHANGED
@@ -515,7 +515,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
515
  endfor;
516
  }
517
 
518
- do_action('post_acui_import_single_user', $headers, $data, $user_id );
519
 
520
  $styles = "";
521
  if( $problematic_row )
515
  endfor;
516
  }
517
 
518
+ do_action('post_acui_import_single_user', $headers, $data, $user_id, $role );
519
 
520
  $styles = "";
521
  if( $problematic_row )
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.3.2
7
- Stable tag: 1.15.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -97,6 +97,9 @@ Plugin will automatically detect:
97
 
98
  == Changelog ==
99
 
 
 
 
100
  = 1.15.2.3 =
101
  * Fixes some issues exporting date and time values
102
 
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.3.2
7
+ Stable tag: 1.15.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 1.15.3 =
101
+ * Multisite compatiility improved now you can assign users to blogs after import
102
+
103
  = 1.15.2.3 =
104
  * Fixes some issues exporting date and time values
105