Version Description
- Export data can now be ordered alphabetically
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.16.3.4 |
Comparing to | |
See all releases |
Code changes from version 1.16.3.3 to 1.16.3.4
- classes/export.php +35 -7
- import-users-from-csv-with-meta.php +1 -1
- readme.txt +4 -1
classes/export.php
CHANGED
@@ -16,6 +16,8 @@ class ACUI_Exporter{
|
|
16 |
add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
|
17 |
add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
|
18 |
add_filter( 'acui_export_non_date_keys', array( $this, 'get_non_date_keys' ), 1, 1 );
|
|
|
|
|
19 |
}
|
20 |
|
21 |
public static function admin_gui(){
|
@@ -68,6 +70,13 @@ class ACUI_Exporter{
|
|
68 |
<span class="description"><a href="https://www.php.net/manual/en/datetime.formats.php"><?php _e( 'accepted formats', 'import-users-from-csv-with-meta' ); ?></a></span>
|
69 |
</td>
|
70 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
<tr id="acui_download_csv_wrapper" valign="top">
|
72 |
<th scope="row"><?php _e( 'Download CSV file with users', 'import-users-from-csv-with-meta' ); ?></th>
|
73 |
<td>
|
@@ -98,6 +107,24 @@ class ACUI_Exporter{
|
|
98 |
return array_merge( $non_date_keys, $this->user_data, $this->woocommerce_default_user_meta_keys, $this->other_non_date_keys );
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
public static function prepare( $key, $value, $datetime_format ){
|
102 |
$timestamp_keys = apply_filters( 'acui_export_timestamp_keys', array( 'wc_last_active' ) );
|
103 |
$non_date_keys = apply_filters( 'acui_export_non_date_keys', array() );
|
@@ -136,6 +163,7 @@ class ACUI_Exporter{
|
|
136 |
$delimiter = sanitize_text_field( $_POST['delimiter'] );
|
137 |
$convert_timestamp = isset( $_POST['convert_timestamp'] ) && !empty( $_POST['convert_timestamp'] );
|
138 |
$datetime_format = ( $convert_timestamp ) ? sanitize_text_field( $_POST['datetime_format'] ) : '';
|
|
|
139 |
|
140 |
switch ( $delimiter ) {
|
141 |
case 'COMMA':
|
@@ -169,8 +197,8 @@ class ACUI_Exporter{
|
|
169 |
$row[] = $key;
|
170 |
}
|
171 |
|
172 |
-
$row = apply_filters( 'acui_export_columns', $row );
|
173 |
-
|
174 |
$data[] = $row;
|
175 |
$row = array();
|
176 |
|
@@ -181,18 +209,18 @@ class ACUI_Exporter{
|
|
181 |
|
182 |
foreach ( $this->user_data as $key ) {
|
183 |
$key = apply_filters( 'acui_export_get_key_user_data', $key );
|
184 |
-
$row[] = self::prepare( $key, $userdata->data->{$key}, $datetime_format );
|
185 |
}
|
186 |
|
187 |
-
$row[] = $this->get_role( $user );
|
188 |
|
189 |
foreach ( $this->get_user_meta_keys() as $key ) {
|
190 |
-
$row[] = self::prepare( $key, get_user_meta( $user, $key, true ), $datetime_format );
|
191 |
}
|
192 |
|
193 |
-
$row = apply_filters( 'acui_export_data', $row, $user, $datetime_format );
|
194 |
|
195 |
-
$data[] = $row;
|
196 |
$row = array();
|
197 |
}
|
198 |
|
16 |
add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
|
17 |
add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
|
18 |
add_filter( 'acui_export_non_date_keys', array( $this, 'get_non_date_keys' ), 1, 1 );
|
19 |
+
add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), PHP_INT_MAX, 2 );
|
20 |
+
add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), PHP_INT_MAX, 5 );
|
21 |
}
|
22 |
|
23 |
public static function admin_gui(){
|
70 |
<span class="description"><a href="https://www.php.net/manual/en/datetime.formats.php"><?php _e( 'accepted formats', 'import-users-from-csv-with-meta' ); ?></a></span>
|
71 |
</td>
|
72 |
</tr>
|
73 |
+
<tr id="acui_order_fields_alphabetically_wrapper" valign="top">
|
74 |
+
<th scope="row"><?php _e( 'Order fields alphabetically', 'import-users-from-csv-with-meta' ); ?></th>
|
75 |
+
<td>
|
76 |
+
<input type="checkbox" name="order_fields_alphabetically" value="1">
|
77 |
+
<span class="description"><?php _e( "Order all columns alphabetically to check easier your data. First two columns won't be affected", 'import-users-from-csv-with-meta' ); ?></span>
|
78 |
+
</td>
|
79 |
+
</tr>
|
80 |
<tr id="acui_download_csv_wrapper" valign="top">
|
81 |
<th scope="row"><?php _e( 'Download CSV file with users', 'import-users-from-csv-with-meta' ); ?></th>
|
82 |
<td>
|
107 |
return array_merge( $non_date_keys, $this->user_data, $this->woocommerce_default_user_meta_keys, $this->other_non_date_keys );
|
108 |
}
|
109 |
|
110 |
+
function maybe_order_columns_alphabetacally( $row, $order_fields_alphabetically ){
|
111 |
+
if( !$order_fields_alphabetically)
|
112 |
+
return $row;
|
113 |
+
|
114 |
+
$first_two_columns = array_slice( $row, 0, 2 );
|
115 |
+
$to_order_columns = array_slice( $row, 2 );
|
116 |
+
sort( $to_order_columns );
|
117 |
+
|
118 |
+
return array_merge( $first_two_columns, $to_order_columns );
|
119 |
+
}
|
120 |
+
|
121 |
+
function maybe_order_row_alphabetically( $row, $user, $datetime_format, $columns, $order_fields_alphabetically ){
|
122 |
+
if( !$order_fields_alphabetically )
|
123 |
+
return $row;
|
124 |
+
|
125 |
+
return array_merge( array_flip( $columns ), $row );
|
126 |
+
}
|
127 |
+
|
128 |
public static function prepare( $key, $value, $datetime_format ){
|
129 |
$timestamp_keys = apply_filters( 'acui_export_timestamp_keys', array( 'wc_last_active' ) );
|
130 |
$non_date_keys = apply_filters( 'acui_export_non_date_keys', array() );
|
163 |
$delimiter = sanitize_text_field( $_POST['delimiter'] );
|
164 |
$convert_timestamp = isset( $_POST['convert_timestamp'] ) && !empty( $_POST['convert_timestamp'] );
|
165 |
$datetime_format = ( $convert_timestamp ) ? sanitize_text_field( $_POST['datetime_format'] ) : '';
|
166 |
+
$order_fields_alphabetically = isset( $_POST['order_fields_alphabetically'] ) && !empty( $_POST['order_fields_alphabetically'] );
|
167 |
|
168 |
switch ( $delimiter ) {
|
169 |
case 'COMMA':
|
197 |
$row[] = $key;
|
198 |
}
|
199 |
|
200 |
+
$row = apply_filters( 'acui_export_columns', $row, $order_fields_alphabetically );
|
201 |
+
$columns = $row;
|
202 |
$data[] = $row;
|
203 |
$row = array();
|
204 |
|
209 |
|
210 |
foreach ( $this->user_data as $key ) {
|
211 |
$key = apply_filters( 'acui_export_get_key_user_data', $key );
|
212 |
+
$row[ $key ] = self::prepare( $key, $userdata->data->{$key}, $datetime_format );
|
213 |
}
|
214 |
|
215 |
+
$row['role'] = $this->get_role( $user );
|
216 |
|
217 |
foreach ( $this->get_user_meta_keys() as $key ) {
|
218 |
+
$row[ $key ] = self::prepare( $key, get_user_meta( $user, $key, true ), $datetime_format );
|
219 |
}
|
220 |
|
221 |
+
$row = apply_filters( 'acui_export_data', $row, $user, $datetime_format, $columns, $order_fields_alphabetically );
|
222 |
|
223 |
+
$data[] = array_values( $row );
|
224 |
$row = array();
|
225 |
}
|
226 |
|
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.4
|
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.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,9 @@ Plugin will automatically detect:
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
106 |
= 1.16.3.3 =
|
107 |
* Extra profile fields now can be used also when registering a new user
|
108 |
|
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.4
|
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.4 =
|
107 |
+
* Export data can now be ordered alphabetically
|
108 |
+
|
109 |
= 1.16.3.3 =
|
110 |
* Extra profile fields now can be used also when registering a new user
|
111 |
|