Version Description
- Array with string keys now can be imported using this syntax inside your CSV cell: key1=>value1::key2=>value2::key3=>value3
- Improved the way that "Extra profile information" is shown in users profiles to be able to show arrays without notices
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.17.8 |
Comparing to | |
See all releases |
Code changes from version 1.17.7 to 1.17.8
- classes/columns.php +1 -1
- classes/doc.php +6 -1
- classes/helper.php +21 -0
- classes/import.php +2 -2
- import-users-from-csv-with-meta.php +2 -2
- readme.txt +5 -1
classes/columns.php
CHANGED
@@ -179,7 +179,7 @@ class ACUI_Columns{
|
|
179 |
?>
|
180 |
<tr>
|
181 |
<th><label for="<?php echo $column; ?>"><?php echo $column; ?></label></th>
|
182 |
-
<td><input type="text" name="<?php echo $column; ?>" id="<?php echo $column; ?>" value="<?php echo esc_attr(
|
183 |
</tr>
|
184 |
<?php
|
185 |
endforeach;
|
179 |
?>
|
180 |
<tr>
|
181 |
<th><label for="<?php echo $column; ?>"><?php echo $column; ?></label></th>
|
182 |
+
<td><input type="text" name="<?php echo $column; ?>" id="<?php echo $column; ?>" value="<?php echo esc_attr( ACUI_Helper::show_meta( $user->ID, $column ) ); ?>" class="regular-text" /></td>
|
183 |
</tr>
|
184 |
<?php
|
185 |
endforeach;
|
classes/doc.php
CHANGED
@@ -56,7 +56,12 @@ class ACUI_Doc{
|
|
56 |
</tr>
|
57 |
<tr valign="top">
|
58 |
<th scope="row"><?php _e( "Lists", 'import-users-from-csv-with-meta' ); ?></th>
|
59 |
-
<td><?php _e( "Plugin can
|
|
|
|
|
|
|
|
|
|
|
60 |
</td>
|
61 |
</tr>
|
62 |
<tr valign="top">
|
56 |
</tr>
|
57 |
<tr valign="top">
|
58 |
<th scope="row"><?php _e( "Lists", 'import-users-from-csv-with-meta' ); ?></th>
|
59 |
+
<td><?php _e( "Plugin can import lists an array. Use this separator:", 'import-users-from-csv-with-meta'); ?> <strong>::</strong> <?php _e("two colons, inside the cell in order to split the string in a list of items.", 'import-users-from-csv-with-meta' ); ?>
|
60 |
+
</td>
|
61 |
+
</tr>
|
62 |
+
<tr valign="top">
|
63 |
+
<th scope="row"><?php _e( "Arrays with string keys", 'import-users-from-csv-with-meta' ); ?></th>
|
64 |
+
<td><?php _e( "Plugin can also import arrays with string keys. Use this separator:", 'import-users-from-csv-with-meta'); ?> <strong>::</strong> <?php _e("two colons, inside the cell in order to split the string in a list of items. Every item should be splitted using => to separate the key from the value. For example: ", 'import-users-from-csv-with-meta' ); ?>key1=>value1::key2=>value2::key3=>value3
|
65 |
</td>
|
66 |
</tr>
|
67 |
<tr valign="top">
|
classes/helper.php
CHANGED
@@ -274,6 +274,8 @@ class ACUI_Helper{
|
|
274 |
$element_string .= $el->get_error_message();
|
275 |
elseif( is_array( $el ) )
|
276 |
$element_string .= serialize( $el );
|
|
|
|
|
277 |
else
|
278 |
$element_string .= $el;
|
279 |
|
@@ -384,6 +386,20 @@ class ACUI_Helper{
|
|
384 |
<?php
|
385 |
}
|
386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
static function get_value_from_row( $key, $headers, $row, $user_id = 0 ){
|
388 |
$pos = array_search( $key, $headers );
|
389 |
|
@@ -393,4 +409,9 @@ class ACUI_Helper{
|
|
393 |
|
394 |
return $row[ $pos ];
|
395 |
}
|
|
|
|
|
|
|
|
|
|
|
396 |
}
|
274 |
$element_string .= $el->get_error_message();
|
275 |
elseif( is_array( $el ) )
|
276 |
$element_string .= serialize( $el );
|
277 |
+
elseif( !is_int( $it ) )
|
278 |
+
$element_string .= $it . "=>" . $el;
|
279 |
else
|
280 |
$element_string .= $el;
|
281 |
|
386 |
<?php
|
387 |
}
|
388 |
|
389 |
+
static function get_array_from_cell( $value ){
|
390 |
+
if( strpos( $value, "=>" ) === false )
|
391 |
+
return explode( "::", $value );
|
392 |
+
|
393 |
+
$array_prepared = array();
|
394 |
+
|
395 |
+
foreach( explode( "::", $value ) as $data ){
|
396 |
+
$key_value = explode( "=>", $data );
|
397 |
+
$array_prepared[ $key_value[0] ] = $key_value[1];
|
398 |
+
}
|
399 |
+
|
400 |
+
return $array_prepared;
|
401 |
+
}
|
402 |
+
|
403 |
static function get_value_from_row( $key, $headers, $row, $user_id = 0 ){
|
404 |
$pos = array_search( $key, $headers );
|
405 |
|
409 |
|
410 |
return $row[ $pos ];
|
411 |
}
|
412 |
+
|
413 |
+
static function show_meta( $user_id, $meta_key ){
|
414 |
+
$user_meta = get_user_meta( $user_id, $meta_key, true );
|
415 |
+
return is_array( $user_meta ) ? var_export( $user_meta, true ) : $user_meta;
|
416 |
+
}
|
417 |
}
|
classes/import.php
CHANGED
@@ -249,8 +249,8 @@ class ACUI_Import{
|
|
249 |
|
250 |
if( is_serialized( $data[$i] ) ) // serialized
|
251 |
$data[$i] = maybe_unserialize( $data[$i] );
|
252 |
-
elseif( strpos( $data[$i], "::" ) !== false
|
253 |
-
$data[$i] =
|
254 |
}
|
255 |
|
256 |
if( $row == 1 ):
|
249 |
|
250 |
if( is_serialized( $data[$i] ) ) // serialized
|
251 |
$data[$i] = maybe_unserialize( $data[$i] );
|
252 |
+
elseif( strpos( $data[$i], "::" ) !== false ) // list of items
|
253 |
+
$data[$i] = ACUI_Helper::get_array_from_cell( $data[$i] );
|
254 |
}
|
255 |
|
256 |
if( $row == 1 ):
|
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.17.
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
@@ -38,7 +38,7 @@ class ImportExportUsersCustomers{
|
|
38 |
}
|
39 |
|
40 |
public function loader(){
|
41 |
-
add_action(
|
42 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10, 1 );
|
43 |
add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 );
|
44 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
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.17.8
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
38 |
}
|
39 |
|
40 |
public function loader(){
|
41 |
+
add_action( 'admin_menu', array( $this, 'menu' ) );
|
42 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10, 1 );
|
43 |
add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 );
|
44 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
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.7.2
|
7 |
-
Stable tag: 1.17.
|
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.17.7 =
|
107 |
* New option in export to prevent problems when exporting serialized values: serialized values sometimes can have problems being displayed in Microsoft Excel or LibreOffice, we can double encapsulate this kind of data but you would not be able to import this data beucase instead of serialized data it would be managed as strings
|
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.7.2
|
7 |
+
Stable tag: 1.17.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 1.17.8 =
|
107 |
+
* Array with string keys now can be imported using this syntax inside your CSV cell: key1=>value1::key2=>value2::key3=>value3
|
108 |
+
+ Improved the way that "Extra profile information" is shown in users profiles to be able to show arrays without notices
|
109 |
+
|
110 |
= 1.17.7 =
|
111 |
* New option in export to prevent problems when exporting serialized values: serialized values sometimes can have problems being displayed in Microsoft Excel or LibreOffice, we can double encapsulate this kind of data but you would not be able to import this data beucase instead of serialized data it would be managed as strings
|
112 |
|