Version Description
- You can now import User Groups (https://wordpress.org/plugins/user-groups/) and assign them to the users
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.10.13 |
Comparing to | |
See all releases |
Code changes from version 1.10.12 to 1.10.13
- addons/acui-users-group.php +56 -0
- import-users-from-csv-with-meta.php +1 -1
- readme.txt +5 -2
addons/acui-users-group.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
if( is_plugin_active( 'user-groups/user-groups.php' ) ){
|
6 |
+
add_filter( 'acui_restricted_fields', 'acui_ug_restricted_fields', 10, 1 );
|
7 |
+
add_action( 'acui_documentation_after_plugins_activated', 'acui_ug_documentation_after_plugins_activated' );
|
8 |
+
add_action( 'post_acui_import_single_user', 'acui_ug_post_import_single_user', 10, 3 );
|
9 |
+
}
|
10 |
+
|
11 |
+
function acui_ug_restricted_fields( $acui_restricted_fields ){
|
12 |
+
return array_merge( $acui_restricted_fields, array( 'user_group' ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
function acui_ug_documentation_after_plugins_activated(){
|
16 |
+
?>
|
17 |
+
<tr valign="top">
|
18 |
+
<th scope="row"><?php _e( "WP Users Group is activated", 'import-users-from-csv-with-meta' ); ?></th>
|
19 |
+
<td>
|
20 |
+
<?php _e( "You can import user groups and assign them to the users using the next format", 'import-users-from-csv-with-meta' ); ?>.
|
21 |
+
<ul style="list-style:disc outside none; margin-left:2em;">
|
22 |
+
<li><?php _e( "user_group as the column title", 'import-users-from-csv-with-meta' ); ?></li>
|
23 |
+
<li><?php _e( "The value of each cell will be the name of the user group (do not use slugs)", 'import-users-from-csv-with-meta' ); ?></li>
|
24 |
+
<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>
|
25 |
+
</ul>
|
26 |
+
</td>
|
27 |
+
</tr>
|
28 |
+
<?php
|
29 |
+
}
|
30 |
+
|
31 |
+
function acui_ug_post_import_single_user( $headers, $row, $user_id ){
|
32 |
+
$pos = array_search( 'user_group', $headers );
|
33 |
+
|
34 |
+
if( $pos === FALSE )
|
35 |
+
return;
|
36 |
+
|
37 |
+
$user_groups = explode( ',', $row[ $pos ] );
|
38 |
+
$user_groups = array_filter( $user_groups, function( $value ){ return $value !== ''; } );
|
39 |
+
|
40 |
+
$taxonomy = 'user-group';
|
41 |
+
$terms = array();
|
42 |
+
|
43 |
+
foreach ( $user_groups as $user_group ) {
|
44 |
+
$term = get_term_by( 'name', $user_group , $taxonomy );
|
45 |
+
|
46 |
+
if( $term == false ){
|
47 |
+
$term = wp_insert_term( $user_group, $taxonomy);
|
48 |
+
$terms[] = $term['term_id'];
|
49 |
+
}else{
|
50 |
+
$terms[] = $term->term_id;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
wp_set_object_terms( $user_id, $terms, $taxonomy, false );
|
55 |
+
clean_object_term_cache( $user_id, $taxonomy );
|
56 |
+
}
|
import-users-from-csv-with-meta.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Import users from CSV with meta
|
4 |
Plugin URI: https://www.codection.com
|
5 |
Description: This plugins allows to import users using CSV files to WP database automatically
|
6 |
-
Version: 1.10.
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
3 |
Plugin Name: Import users from CSV with meta
|
4 |
Plugin URI: https://www.codection.com
|
5 |
Description: This plugins allows to import users using CSV files to WP database automatically
|
6 |
+
Version: 1.10.13
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://paypal.me/codection
|
|
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: 4.9.4
|
7 |
-
Stable tag: 1.10.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -70,8 +70,11 @@ Plugin will automatically detect:
|
|
70 |
|
71 |
== Changelog ==
|
72 |
|
|
|
|
|
|
|
73 |
= 1.10.12 =
|
74 |
-
* You can now import WP User Groups and assign them to the users thanks to the support of Arturas & Luis, Lda.
|
75 |
|
76 |
= 1.10.11.1 =
|
77 |
* Debug notice shown fixed (thanks for submiting the bug @anieves (https://wordpress.org/support/topic/problem-using-wp-members-with-import-users-from-csv-2/#post-10035037)
|
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: 4.9.4
|
7 |
+
Stable tag: 1.10.13
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
70 |
|
71 |
== Changelog ==
|
72 |
|
73 |
+
= 1.10.13 =
|
74 |
+
* You can now import User Groups (https://wordpress.org/plugins/user-groups/) and assign them to the users
|
75 |
+
|
76 |
= 1.10.12 =
|
77 |
+
* You can now import WP User Groups (https://es.wordpress.org/plugins/wp-user-groups/) and assign them to the users thanks to the support of Arturas & Luis, Lda.
|
78 |
|
79 |
= 1.10.11.1 =
|
80 |
* Debug notice shown fixed (thanks for submiting the bug @anieves (https://wordpress.org/support/topic/problem-using-wp-members-with-import-users-from-csv-2/#post-10035037)
|