Version Description
- You can now filter users that are being exported by role and user registered date
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.15.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.15.1 to 1.15.1.1
- classes/export.php +65 -16
- import-users-from-csv-with-meta.php +1 -1
- readme.txt +4 -1
classes/export.php
CHANGED
@@ -15,22 +15,49 @@ class ACUI_Exporter{
|
|
15 |
}
|
16 |
|
17 |
public static function admin_gui(){
|
|
|
18 |
?>
|
19 |
<h3><?php _e( 'Export users', 'import-users-from-csv-with-meta' ); ?></h3>
|
20 |
-
<
|
21 |
-
<
|
22 |
-
<
|
23 |
-
<
|
24 |
-
|
25 |
-
<
|
26 |
-
<
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
<input class="button-primary" type="submit" value="<?php _e( 'Download', 'import-users-from-csv-with-meta'); ?>"/>
|
29 |
-
</
|
30 |
-
</
|
31 |
-
</
|
32 |
-
</
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<?php
|
35 |
}
|
36 |
|
@@ -40,6 +67,10 @@ class ACUI_Exporter{
|
|
40 |
if( !current_user_can( 'create_users' ) )
|
41 |
wp_die( __( 'Only users who are able to create users can export them.', 'import-users-from-csv-with-meta' ) );
|
42 |
|
|
|
|
|
|
|
|
|
43 |
$data = array();
|
44 |
$row = array();
|
45 |
|
@@ -56,7 +87,7 @@ class ACUI_Exporter{
|
|
56 |
$row = array();
|
57 |
|
58 |
// data
|
59 |
-
$users = $this->get_user_id_list();
|
60 |
foreach ( $users as $user ) {
|
61 |
$userdata = get_userdata( $user );
|
62 |
|
@@ -120,8 +151,26 @@ class ACUI_Exporter{
|
|
120 |
return $meta_keys;
|
121 |
}
|
122 |
|
123 |
-
function get_user_id_list(){
|
124 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
$list = array();
|
126 |
|
127 |
foreach ( $users as $user ) {
|
15 |
}
|
16 |
|
17 |
public static function admin_gui(){
|
18 |
+
$roles = acui_get_editable_roles();
|
19 |
?>
|
20 |
<h3><?php _e( 'Export users', 'import-users-from-csv-with-meta' ); ?></h3>
|
21 |
+
<form method="POST" target="_blank" enctype="multipart/form-data" action="<?php echo admin_url( 'admin-ajax.php' ); ?>">
|
22 |
+
<table class="form-table">
|
23 |
+
<tbody>
|
24 |
+
<tr valign="top">
|
25 |
+
<th scope="row"><?php _e( 'Role', 'import-users-from-csv-with-meta' ); ?></th>
|
26 |
+
<td>
|
27 |
+
<select name="role">
|
28 |
+
<option value=''><?php _e( 'All roles', 'import-users-from-csv-with-meta' ); ?></option>
|
29 |
+
<?php foreach ( $roles as $key => $value ): ?>
|
30 |
+
<option value='<?php echo $key; ?>'><?php echo $value; ?></option>
|
31 |
+
<?php endforeach; ?>
|
32 |
+
</select>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<tr valign="top">
|
36 |
+
<th scope="row"><?php _e( 'User created', 'import-users-from-csv-with-meta' ); ?></th>
|
37 |
+
<td>
|
38 |
+
<label>from <input name="from" type="date" value=""/></label>
|
39 |
+
<label>to <input name="to" type="date" value=""/></label>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
+
<tr valign="top">
|
43 |
+
<th scope="row"><?php _e( 'Download CSV file with users', 'import-users-from-csv-with-meta' ); ?></th>
|
44 |
+
<td>
|
45 |
<input class="button-primary" type="submit" value="<?php _e( 'Download', 'import-users-from-csv-with-meta'); ?>"/>
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</tbody>
|
49 |
+
</table>
|
50 |
+
<input type="hidden" name="action" value="acui_export_users_csv"/>
|
51 |
+
<?php wp_nonce_field( 'codection-security', 'security' ); ?>
|
52 |
+
</form>
|
53 |
+
|
54 |
+
<script type="text/javascript">
|
55 |
+
jQuery( document ).ready( function( $ ){
|
56 |
+
$( "input[name='from']" ).change( function() {
|
57 |
+
$( "input[name='to']" ).attr( 'min', $( this ).val() );
|
58 |
+
})
|
59 |
+
} )
|
60 |
+
</script>
|
61 |
<?php
|
62 |
}
|
63 |
|
67 |
if( !current_user_can( 'create_users' ) )
|
68 |
wp_die( __( 'Only users who are able to create users can export them.', 'import-users-from-csv-with-meta' ) );
|
69 |
|
70 |
+
$role = sanitize_text_field( $_POST['role'] );
|
71 |
+
$from = sanitize_text_field( $_POST['from'] );
|
72 |
+
$to = sanitize_text_field( $_POST['to'] );
|
73 |
+
|
74 |
$data = array();
|
75 |
$row = array();
|
76 |
|
87 |
$row = array();
|
88 |
|
89 |
// data
|
90 |
+
$users = $this->get_user_id_list( $role, $from, $to );
|
91 |
foreach ( $users as $user ) {
|
92 |
$userdata = get_userdata( $user );
|
93 |
|
151 |
return $meta_keys;
|
152 |
}
|
153 |
|
154 |
+
function get_user_id_list( $role, $from, $to ){
|
155 |
+
$args = array( 'fields' => array( 'ID' ) );
|
156 |
+
|
157 |
+
if( !empty( $role ) )
|
158 |
+
$args['role'] = $role;
|
159 |
+
|
160 |
+
$date_query = array();
|
161 |
+
|
162 |
+
if( !empty( $from ) )
|
163 |
+
$date_query[] = array( 'after' => $from );
|
164 |
+
|
165 |
+
if( !empty( $to ) )
|
166 |
+
$date_query[] = array( 'before' => $to );
|
167 |
+
|
168 |
+
if( !empty( $date_query ) ){
|
169 |
+
$date_query['inclusive'] = true;
|
170 |
+
$args['date_query'] = $date_query;
|
171 |
+
}
|
172 |
+
|
173 |
+
$users = get_users( $args );
|
174 |
$list = array();
|
175 |
|
176 |
foreach ( $users as $user ) {
|
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.15.1
|
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.15.1.1
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
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.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -91,6 +91,9 @@ Plugin will automatically detect:
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
94 |
= 1.15.1 =
|
95 |
* New tab with a list of all meta keys found in the database, with the type of it and an example to be able to use it in your imports
|
96 |
|
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.1.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 1.15.1.1 =
|
95 |
+
* You can now filter users that are being exported by role and user registered date
|
96 |
+
|
97 |
= 1.15.1 =
|
98 |
* New tab with a list of all meta keys found in the database, with the type of it and an example to be able to use it in your imports
|
99 |
|