Version Description
- Username now can be empty, in this case, we generate random usernames
- Code improvements
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.16.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.16.3.1 to 1.16.3.2
- addons/allow-multiple-accounts.php +66 -60
- addons/groups.php +82 -76
- addons/indeed-ultimate-membership-pro.php +45 -43
- addons/woocommerce-subscriptions.php +2 -3
- classes/doc.php +1 -1
- classes/import.php +11 -0
- classes/wp-importer.php +1 -1
- import-users-from-csv-with-meta.php +1 -1
- importer.php +6 -20
- readme.txt +5 -1
addons/allow-multiple-accounts.php
CHANGED
@@ -6,70 +6,76 @@ if( !is_plugin_active( 'allow-multiple-accounts/allow-multiple-accounts.php' ) )
|
|
6 |
return;
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<table class="form-table">
|
16 |
-
<tbody>
|
17 |
-
<tr class="form-field form-required">
|
18 |
-
<th scope="row"><label><?php _e( 'Repeated email in different users?', 'import-users-from-csv-with-meta' ); ?></label></th>
|
19 |
-
<td>
|
20 |
-
<select name="allow_multiple_accounts">
|
21 |
-
<option value="not_allowed"><?php _e( 'Not allowed', 'import-users-from-csv-with-meta' ); ?></option>
|
22 |
-
<option value="allowed"><?php _e( 'Allowed', 'import-users-from-csv-with-meta' ); ?></option>
|
23 |
-
</select>
|
24 |
-
<p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/allow-multiple-accounts/"><?php _e( 'Allow Multiple Accounts', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta'); ?>)</strong>. <?php _e('Allow multiple user accounts to be created having the same email address.','import-users-from-csv-with-meta' ); ?></p>
|
25 |
-
</td>
|
26 |
-
</tr>
|
27 |
-
</tbody>
|
28 |
-
</table>
|
29 |
-
<?php
|
30 |
-
}
|
31 |
-
|
32 |
-
function acui_allow_multiple_accounts_tab_cron_before_log(){
|
33 |
-
?>
|
34 |
-
<h2><?php _e( 'Allow Multiple Accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
|
35 |
-
|
36 |
-
<table class="form-table">
|
37 |
-
<tbody>
|
38 |
-
|
39 |
-
<tr class="form-field form-required">
|
40 |
-
<th scope="row"><label><?php _e( 'Repeated email in different users?', 'import-users-from-csv-with-meta' ); ?></label></th>
|
41 |
-
<td>
|
42 |
-
<input type="checkbox" name="allow_multiple_accounts" value="yes" <?php if( $allow_multiple_accounts == "allowed" ) echo "checked='checked'"; ?>/>
|
43 |
-
<p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/allow-multiple-accounts/"><?php _e( 'Allow Multiple Accounts', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta'); ?>)</strong>. <?php _e('Allow multiple user accounts to be created having the same email address.','import-users-from-csv-with-meta' ); ?></p>
|
44 |
-
</td>
|
45 |
-
</tr>
|
46 |
-
</tbody>
|
47 |
-
</table>
|
48 |
-
<?php
|
49 |
-
}
|
50 |
|
51 |
-
function
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
-
|
65 |
-
function acui_hack_restore_remapped_email_address( $user_id, $email ) {
|
66 |
-
global $wpdb;
|
67 |
-
|
68 |
-
$wpdb->update(
|
69 |
-
$wpdb->users,
|
70 |
-
array( 'user_email' => $email ),
|
71 |
-
array( 'ID' => $user_id )
|
72 |
-
);
|
73 |
-
|
74 |
-
clean_user_cache( $user_id );
|
75 |
-
}
|
6 |
return;
|
7 |
}
|
8 |
|
9 |
+
class ACUI_AllowMultipleAccounts{
|
10 |
+
function __construct(){
|
11 |
+
add_action( 'acui_tab_import_before_import_button', array( $this, 'before_import_button' ) );
|
12 |
+
add_action( 'acui_tab_cron_before_log', array( $this, 'cron_before_log' ) );
|
13 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
function before_import_button(){
|
16 |
+
?>
|
17 |
+
<h2><?php _e( 'Allow multiple accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
|
18 |
+
|
19 |
+
<table class="form-table">
|
20 |
+
<tbody>
|
21 |
+
<tr class="form-field form-required">
|
22 |
+
<th scope="row"><label><?php _e( 'Repeated email in different users?', 'import-users-from-csv-with-meta' ); ?></label></th>
|
23 |
+
<td>
|
24 |
+
<select name="allow_multiple_accounts">
|
25 |
+
<option value="not_allowed"><?php _e( 'Not allowed', 'import-users-from-csv-with-meta' ); ?></option>
|
26 |
+
<option value="allowed"><?php _e( 'Allowed', 'import-users-from-csv-with-meta' ); ?></option>
|
27 |
+
</select>
|
28 |
+
<p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/allow-multiple-accounts/"><?php _e( 'Allow Multiple Accounts', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta'); ?>)</strong>. <?php _e('Allow multiple user accounts to be created having the same email address.','import-users-from-csv-with-meta' ); ?></p>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</tbody>
|
32 |
+
</table>
|
33 |
+
<?php
|
34 |
}
|
35 |
|
36 |
+
function cron_before_log(){
|
37 |
+
?>
|
38 |
+
<h2><?php _e( 'Allow Multiple Accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
|
39 |
+
|
40 |
+
<table class="form-table">
|
41 |
+
<tbody>
|
42 |
+
|
43 |
+
<tr class="form-field form-required">
|
44 |
+
<th scope="row"><label><?php _e( 'Repeated email in different users?', 'import-users-from-csv-with-meta' ); ?></label></th>
|
45 |
+
<td>
|
46 |
+
<input type="checkbox" name="allow_multiple_accounts" value="yes" <?php if( $allow_multiple_accounts == "allowed" ) echo "checked='checked'"; ?>/>
|
47 |
+
<p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/allow-multiple-accounts/"><?php _e( 'Allow Multiple Accounts', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta'); ?>)</strong>. <?php _e('Allow multiple user accounts to be created having the same email address.','import-users-from-csv-with-meta' ); ?></p>
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
</tbody>
|
51 |
+
</table>
|
52 |
+
<?php
|
53 |
+
}
|
54 |
|
55 |
+
public static function hack_email( $email ) {
|
56 |
+
if ( ! is_email( $email ) ) {
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
$old_email = $email;
|
61 |
+
|
62 |
+
for ( $i = 0; ! $skip_remap && email_exists( $email ); $i++ ) {
|
63 |
+
$email = str_replace( '@', "+ama{$i}@", $old_email );
|
64 |
+
}
|
65 |
+
|
66 |
+
return $email;
|
67 |
}
|
68 |
|
69 |
+
public static function hack_restore_remapped_email_address( $user_id, $email ) {
|
70 |
+
global $wpdb;
|
71 |
+
|
72 |
+
$wpdb->update(
|
73 |
+
$wpdb->users,
|
74 |
+
array( 'user_email' => $email ),
|
75 |
+
array( 'ID' => $user_id )
|
76 |
+
);
|
77 |
+
|
78 |
+
clean_user_cache( $user_id );
|
79 |
+
}
|
80 |
}
|
81 |
+
new ACUI_AllowMultipleAccounts();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addons/groups.php
CHANGED
@@ -6,83 +6,89 @@ if( !is_plugin_active( 'groups/groups.php' ) ){
|
|
6 |
return;
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
add_action( '
|
13 |
-
|
14 |
-
|
15 |
-
return array_merge( $acui_restricted_fields, array( 'group_id' ) );
|
16 |
-
}
|
17 |
-
|
18 |
-
function acui_g_documentation_after_plugins_activated(){
|
19 |
-
?>
|
20 |
-
<tr valign="top">
|
21 |
-
<th scope="row"><?php _e( "Groups is activated", 'import-users-from-csv-with-meta' ); ?></th>
|
22 |
-
<td>
|
23 |
-
<?php _e( "You can import user and assign them to the users groups using the next format", 'import-users-from-csv-with-meta' ); ?>.
|
24 |
-
<ul style="list-style:disc outside none; margin-left:2em;">
|
25 |
-
<li><?php _e( "group_id as the column title", 'import-users-from-csv-with-meta' ); ?></li>
|
26 |
-
<li><?php _e( "The value of each cell will be the ID of the group that you want to assign to this user", 'import-users-from-csv-with-meta' ); ?></li>
|
27 |
-
<li><?php _e( "Another option is use group_name as the column title", 'import-users-from-csv-with-meta' ); ?></li>
|
28 |
-
<li><?php _e( "The value of each cell will be the name of the group that you want to assign to this user", 'import-users-from-csv-with-meta' ); ?></li>
|
29 |
-
<li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
|
30 |
-
</ul>
|
31 |
-
</td>
|
32 |
-
</tr>
|
33 |
-
<?php
|
34 |
-
}
|
35 |
-
|
36 |
-
function acui_g_post_import_single_user( $headers, $row, $user_id ){
|
37 |
-
$pos = array_search( 'group_id', $headers );
|
38 |
-
|
39 |
-
if( $pos === FALSE )
|
40 |
-
return;
|
41 |
-
|
42 |
-
// groups that appears in the CSV
|
43 |
-
$user_groups_csv = explode( ',', $row[ $pos ] );
|
44 |
-
$user_groups_csv = array_filter( $user_groups_csv, function( $value ){ return $value !== ''; } );
|
45 |
-
|
46 |
-
// groups that user belongs to
|
47 |
-
$groups_user = new Groups_User( $user_id );
|
48 |
-
$user_group_ids = $groups_user->group_ids;
|
49 |
-
|
50 |
-
acui_g_add_groups_user( $user_id, $user_groups_csv );
|
51 |
-
}
|
52 |
-
|
53 |
-
function acui_g_post_import_single_user_by_name( $headers, $row, $user_id ){
|
54 |
-
$pos = array_search( 'group_name', $headers );
|
55 |
-
|
56 |
-
if( $pos === FALSE )
|
57 |
-
return;
|
58 |
-
|
59 |
-
// groups that appears in the CSV
|
60 |
-
$user_groups_name_csv = explode( ',', $row[ $pos ] );
|
61 |
-
$user_groups_name_csv = array_filter( $user_groups_name_csv, function( $value ){ return $value !== ''; } );
|
62 |
-
$user_groups_csv = array();
|
63 |
-
|
64 |
-
foreach ( $user_groups_name_csv as $user_group_name_csv ) {
|
65 |
-
$group = Groups_Group::read_by_name( $user_group_name_csv );
|
66 |
-
$user_groups_csv[] = $group->group_id;
|
67 |
}
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
function acui_g_add_groups_user( $user_id, $user_groups_csv ){
|
73 |
-
// groups that user belongs to
|
74 |
-
$groups_user = new Groups_User( $user_id );
|
75 |
-
$user_group_ids = empty( $groups_user->group_ids ) ? array() : $groups_user->group_ids;
|
76 |
-
|
77 |
-
// first we look into all current user groups, if they do not appear in CSV it will be removed
|
78 |
-
foreach ( $user_group_ids as $user_group_id ) {
|
79 |
-
if( !in_array( $user_group_id, $user_groups_csv ) )
|
80 |
-
Groups_User_Group::delete( $user_id, $user_group_id );
|
81 |
}
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
return;
|
7 |
}
|
8 |
|
9 |
+
class ACUI_Groups{
|
10 |
+
function __construct(){
|
11 |
+
add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
|
12 |
+
add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
|
13 |
+
add_action( 'post_acui_import_single_user', array( $this, 'import_single_user' ), 10, 3 );
|
14 |
+
add_action( 'post_acui_import_single_user', array( $this, 'import_single_user_by_name' ), 11, 3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
|
17 |
+
function restricted_fields( $acui_restricted_fields ){
|
18 |
+
return array_merge( $acui_restricted_fields, array( 'group_id' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
+
|
21 |
+
function documentation(){
|
22 |
+
?>
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row"><?php _e( "Groups is activated", 'import-users-from-csv-with-meta' ); ?></th>
|
25 |
+
<td>
|
26 |
+
<?php _e( "You can import user and assign them to the users groups using the next format", 'import-users-from-csv-with-meta' ); ?>.
|
27 |
+
<ul style="list-style:disc outside none; margin-left:2em;">
|
28 |
+
<li><?php _e( "group_id as the column title", 'import-users-from-csv-with-meta' ); ?></li>
|
29 |
+
<li><?php _e( "The value of each cell will be the ID of the group that you want to assign to this user", 'import-users-from-csv-with-meta' ); ?></li>
|
30 |
+
<li><?php _e( "Another option is use group_name as the column title", 'import-users-from-csv-with-meta' ); ?></li>
|
31 |
+
<li><?php _e( "The value of each cell will be the name of the group that you want to assign to this user", 'import-users-from-csv-with-meta' ); ?></li>
|
32 |
+
<li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
|
33 |
+
</ul>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
<?php
|
37 |
}
|
38 |
+
|
39 |
+
function import_single_user( $headers, $row, $user_id ){
|
40 |
+
$pos = array_search( 'group_id', $headers );
|
41 |
+
|
42 |
+
if( $pos === FALSE )
|
43 |
+
return;
|
44 |
+
|
45 |
+
// groups that appears in the CSV
|
46 |
+
$user_groups_csv = explode( ',', $row[ $pos ] );
|
47 |
+
$user_groups_csv = array_filter( $user_groups_csv, function( $value ){ return $value !== ''; } );
|
48 |
+
|
49 |
+
// groups that user belongs to
|
50 |
+
$groups_user = new Groups_User( $user_id );
|
51 |
+
$user_group_ids = $groups_user->group_ids;
|
52 |
+
|
53 |
+
$this->add_groups_user( $user_id, $user_groups_csv );
|
54 |
+
}
|
55 |
+
|
56 |
+
function import_single_user_by_name( $headers, $row, $user_id ){
|
57 |
+
$pos = array_search( 'group_name', $headers );
|
58 |
+
|
59 |
+
if( $pos === FALSE )
|
60 |
+
return;
|
61 |
+
|
62 |
+
// groups that appears in the CSV
|
63 |
+
$user_groups_name_csv = explode( ',', $row[ $pos ] );
|
64 |
+
$user_groups_name_csv = array_filter( $user_groups_name_csv, function( $value ){ return $value !== ''; } );
|
65 |
+
$user_groups_csv = array();
|
66 |
+
|
67 |
+
foreach ( $user_groups_name_csv as $user_group_name_csv ) {
|
68 |
+
$group = Groups_Group::read_by_name( $user_group_name_csv );
|
69 |
+
$user_groups_csv[] = $group->group_id;
|
70 |
+
}
|
71 |
+
|
72 |
+
$this->add_groups_user( $user_id, $user_groups_csv );
|
73 |
+
}
|
74 |
+
|
75 |
+
function add_groups_user( $user_id, $user_groups_csv ){
|
76 |
+
// groups that user belongs to
|
77 |
+
$groups_user = new Groups_User( $user_id );
|
78 |
+
$user_group_ids = empty( $groups_user->group_ids ) ? array() : $groups_user->group_ids;
|
79 |
+
|
80 |
+
// first we look into all current user groups, if they do not appear in CSV it will be removed
|
81 |
+
foreach ( $user_group_ids as $user_group_id ) {
|
82 |
+
if( !in_array( $user_group_id, $user_groups_csv ) )
|
83 |
+
Groups_User_Group::delete( $user_id, $user_group_id );
|
84 |
+
}
|
85 |
+
|
86 |
+
// finally we loop into groups that are present in CSV data, if they already exists, we do nothing, if not, we add it
|
87 |
+
foreach ( $user_groups_csv as $user_group_csv ) {
|
88 |
+
if( !in_array( $user_group_csv, $user_group_ids ) )
|
89 |
+
Groups_User_Group::create( array( 'user_id' => $user_id, 'group_id' => $user_group_csv ) );
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
new ACUI_Groups();
|
addons/indeed-ultimate-membership-pro.php
CHANGED
@@ -6,51 +6,53 @@ if( !is_plugin_active( 'indeed-membership-pro/indeed-membership-pro.php' ) ){
|
|
6 |
return;
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
-
function
|
14 |
-
|
15 |
-
|
16 |
-
);
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$columns[ $key ] = $pos;
|
50 |
-
$$key = $row[ $columns[ $key ] ];
|
51 |
}
|
|
|
|
|
|
|
52 |
}
|
|
|
53 |
|
54 |
-
|
55 |
-
$level = ihc_do_complete_level_assign_from_ap( $user_id, $level );
|
56 |
-
}
|
6 |
return;
|
7 |
}
|
8 |
|
9 |
+
class ACUI_IndeedMemberShipPro{
|
10 |
+
function __construct(){
|
11 |
+
add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
|
12 |
+
add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
|
13 |
+
add_action( 'post_acui_import_single_user', array( $this, 'import_single_user' ), 10, 3 );
|
14 |
+
}
|
15 |
|
16 |
+
function fields(){
|
17 |
+
return array( "level" );
|
18 |
+
}
|
|
|
19 |
|
20 |
+
function restricted_fields( $acui_restricted_fields ){
|
21 |
+
return array_merge( $acui_restricted_fields, $this->fields() );
|
22 |
+
}
|
23 |
+
|
24 |
+
function documentation(){
|
25 |
+
?>
|
26 |
+
<tr valign="top">
|
27 |
+
<th scope="row"><?php _e( "Indeed Ultimate Membership Pro is activated", 'import-users-from-csv-with-meta' ); ?></th>
|
28 |
+
<td>
|
29 |
+
<?php _e( "You can use the columns in the CSV in order to import data from Indeed Ultimate Membership Pro.", 'import-users-from-csv-with-meta' ); ?>.
|
30 |
+
<ul style="list-style:disc outside none; margin-left:2em;">
|
31 |
+
<li>level: you have to use the level id, you can find it in "Levels" tab</li>
|
32 |
+
</ul>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<?php
|
36 |
+
}
|
37 |
+
|
38 |
+
function import_single_user( $headers, $row, $user_id ){
|
39 |
+
global $wpdb;
|
40 |
+
|
41 |
+
$keys = $this->fields();
|
42 |
+
$columns = array();
|
43 |
+
|
44 |
+
foreach ( $keys as $key ) {
|
45 |
+
$pos = array_search( $key, $headers );
|
46 |
+
|
47 |
+
if( $pos !== FALSE ){
|
48 |
+
$columns[ $key ] = $pos;
|
49 |
+
$$key = $row[ $columns[ $key ] ];
|
50 |
+
}
|
|
|
|
|
51 |
}
|
52 |
+
|
53 |
+
if( !empty( $level ) )
|
54 |
+
$level = ihc_do_complete_level_assign_from_ap( $user_id, $level );
|
55 |
}
|
56 |
+
}
|
57 |
|
58 |
+
new ACUI_IndeedMemberShipPro();
|
|
|
|
addons/woocommerce-subscriptions.php
CHANGED
@@ -5,7 +5,7 @@ if( !is_plugin_active( 'woocommerce-subscriptions/woocommerce-subscriptions.php'
|
|
5 |
return;
|
6 |
}
|
7 |
|
8 |
-
class
|
9 |
private $all_virtual;
|
10 |
|
11 |
function __construct(){
|
@@ -825,5 +825,4 @@ class ACUI_WooCommerceSubscritpions{
|
|
825 |
return $chosen_tax_rate_id;
|
826 |
}
|
827 |
}
|
828 |
-
|
829 |
-
new ACUI_WooCommerceSubscritpions();
|
5 |
return;
|
6 |
}
|
7 |
|
8 |
+
class ACUI_WooCommerceSubscriptions{
|
9 |
private $all_virtual;
|
10 |
|
11 |
function __construct(){
|
825 |
return $chosen_tax_rate_id;
|
826 |
}
|
827 |
}
|
828 |
+
new ACUI_WooCommerceSubscriptions();
|
|
classes/doc.php
CHANGED
@@ -12,7 +12,7 @@ class ACUI_Doc{
|
|
12 |
<th scope="row"><?php _e( 'Columns position', 'import-users-from-csv-with-meta' ); ?></th>
|
13 |
<td><small><em><?php _e( '(Documents should look like the one presented into screenshot. Remember you should fill the first two columns with the next values)', 'import-users-from-csv-with-meta' ); ?></em></small>
|
14 |
<ol>
|
15 |
-
<li><?php _e( 'Username', 'import-users-from-csv-with-meta' );
|
16 |
<li><?php _e( 'Email', 'import-users-from-csv-with-meta' ); ?></li>
|
17 |
</ol>
|
18 |
<small><em><?php _e( '(The next columns are totally customizable and you can use whatever you want. All rows must contains same columns)', 'import-users-from-csv-with-meta' ); ?></em></small>
|
12 |
<th scope="row"><?php _e( 'Columns position', 'import-users-from-csv-with-meta' ); ?></th>
|
13 |
<td><small><em><?php _e( '(Documents should look like the one presented into screenshot. Remember you should fill the first two columns with the next values)', 'import-users-from-csv-with-meta' ); ?></em></small>
|
14 |
<ol>
|
15 |
+
<li><?php _e( 'Username: you can leave it empty and the username will be generated randomly', 'import-users-from-csv-with-meta' ); ?> </li>
|
16 |
<li><?php _e( 'Email', 'import-users-from-csv-with-meta' ); ?></li>
|
17 |
</ol>
|
18 |
<small><em><?php _e( '(The next columns are totally customizable and you can use whatever you want. All rows must contains same columns)', 'import-users-from-csv-with-meta' ); ?></em></small>
|
classes/import.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ACUI_Import{
|
4 |
+
public static function get_random_unique_username( $prefix = '' ){
|
5 |
+
do {
|
6 |
+
$rnd_str = sprintf("%06d", mt_rand(1, 999999));
|
7 |
+
} while( username_exists( $prefix . $rnd_str ) );
|
8 |
+
|
9 |
+
return $prefix . $rnd_str;
|
10 |
+
}
|
11 |
+
}
|
classes/wp-importer.php
CHANGED
@@ -13,7 +13,7 @@ class ACUI_WP_Importer_GUI{
|
|
13 |
}
|
14 |
|
15 |
function importer(){
|
16 |
-
|
17 |
}
|
18 |
|
19 |
function exporter(){
|
13 |
}
|
14 |
|
15 |
function importer(){
|
16 |
+
echo "<script>document.location.href='" . admin_url( 'tools.php?page=acui' ) . "'</script>";
|
17 |
}
|
18 |
|
19 |
function exporter(){
|
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.
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
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
|
importer.php
CHANGED
@@ -94,9 +94,6 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
94 |
|
95 |
$manager = new SplFileObject( $file );
|
96 |
while ( $data = $manager->fgetcsv( $delimiter ) ):
|
97 |
-
if( empty($data[0]) )
|
98 |
-
continue;
|
99 |
-
|
100 |
if( count( $data ) == 1 )
|
101 |
$data = $data[0];
|
102 |
|
@@ -188,7 +185,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
188 |
do_action('pre_acui_import_single_user', $headers, $data );
|
189 |
$data = apply_filters('pre_acui_import_single_user_data', $data, $headers);
|
190 |
|
191 |
-
$username = $data[0];
|
192 |
$email = $data[1];
|
193 |
$user_id = 0;
|
194 |
$problematic_row = false;
|
@@ -197,21 +194,10 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
197 |
$role_position = $positions["role"];
|
198 |
$role = "";
|
199 |
$id_position = $positions["id"];
|
200 |
-
|
201 |
-
if ( !empty( $id_position ) )
|
202 |
-
$id = $data[ $id_position ];
|
203 |
-
else
|
204 |
-
$id = "";
|
205 |
-
|
206 |
$created = true;
|
207 |
-
|
208 |
-
|
209 |
-
$password = wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) );
|
210 |
-
}
|
211 |
-
else{
|
212 |
-
$password = $data[ $password_position ];
|
213 |
-
}
|
214 |
-
|
215 |
if( $role_position === false ){
|
216 |
$role = $role_default;
|
217 |
}
|
@@ -346,9 +332,9 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
346 |
$password = wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) );
|
347 |
}
|
348 |
|
349 |
-
$hacked_email =
|
350 |
$user_id = wp_create_user( $username, $password, $hacked_email );
|
351 |
-
|
352 |
}
|
353 |
else{
|
354 |
// if user is new, but the password in csv is empty, generate a password for this user
|
94 |
|
95 |
$manager = new SplFileObject( $file );
|
96 |
while ( $data = $manager->fgetcsv( $delimiter ) ):
|
|
|
|
|
|
|
97 |
if( count( $data ) == 1 )
|
98 |
$data = $data[0];
|
99 |
|
185 |
do_action('pre_acui_import_single_user', $headers, $data );
|
186 |
$data = apply_filters('pre_acui_import_single_user_data', $data, $headers);
|
187 |
|
188 |
+
$username = empty( $data[0] ) ? ACUI_Import::get_random_unique_username( 'user_' ) : $data[0];
|
189 |
$email = $data[1];
|
190 |
$user_id = 0;
|
191 |
$problematic_row = false;
|
194 |
$role_position = $positions["role"];
|
195 |
$role = "";
|
196 |
$id_position = $positions["id"];
|
197 |
+
$id = ( empty( $id_position ) ) ? '' : $data[ $id_position ];
|
|
|
|
|
|
|
|
|
|
|
198 |
$created = true;
|
199 |
+
$password = ( $password_position === false ) ? wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) ) : $data[ $password_position ];
|
200 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
if( $role_position === false ){
|
202 |
$role = $role_default;
|
203 |
}
|
332 |
$password = wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) );
|
333 |
}
|
334 |
|
335 |
+
$hacked_email = ACUI_AllowMultipleAccounts::hack_email( $email );
|
336 |
$user_id = wp_create_user( $username, $password, $hacked_email );
|
337 |
+
ACUI_AllowMultipleAccounts::hack_restore_remapped_email_address( $user_id, $email );
|
338 |
}
|
339 |
else{
|
340 |
// if user is new, but the password in csv is empty, generate a password for this user
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -103,6 +103,10 @@ Plugin will automatically detect:
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
106 |
= 1.16.3.1 =
|
107 |
* BuddyPress/BuddyBoss avatar can now be imported
|
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.2
|
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.2 =
|
107 |
+
* Username now can be empty, in this case, we generate random usernames
|
108 |
+
* Code improvements
|
109 |
+
|
110 |
= 1.16.3.1 =
|
111 |
* BuddyPress/BuddyBoss avatar can now be imported
|
112 |
* Code improvements
|