Import users from CSV with meta - Version 1.15.7.3

Version Description

  • Tested up to WordPress 5.5
  • Improvements in timestamp data export
Download this release

Release Info

Developer carazo
Plugin Icon 128x128 Import users from CSV with meta
Version 1.15.7.3
Comparing to
See all releases

Code changes from version 1.15.7.2 to 1.15.7.3

classes/export.php CHANGED
@@ -10,6 +10,7 @@ class ACUI_Exporter{
10
 
11
  $this->path_csv = $upload_dir['basedir'] . "/export-users.csv";
12
  $this->user_data = array( "user_login", "user_email", "source_user_id", "user_pass", "user_nicename", "user_url", "user_registered", "display_name" );
 
13
 
14
  add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
15
  add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
@@ -87,23 +88,29 @@ class ACUI_Exporter{
87
  <?php
88
  }
89
 
 
 
 
 
90
  function prepare( $key, $value, $datetime_format ){
91
- $timestamp_keys = array( 'wc_last_active' );
92
- $non_date_keys = apply_filters( 'acui_export_non_date_keys', array_merge( $this->user_data, array( 'billing_phone' ) ) );
93
 
94
- if( is_array( $value ) )
95
  return serialize( $value );
 
96
  elseif( in_array( $key, $non_date_keys ) || empty( $datetime_format ) ){
97
  return $value;
98
  }
99
- elseif( strtotime( $value ) && !is_integer( $value ) && strlen( $value ) > 3 ){ // dates in datetime format
100
  return date( $datetime_format, strtotime( $value ) );
101
  }
102
- elseif( in_array( $key, $timestamp_keys) ){ // dates in timestamp format
103
  return date( $datetime_format, $value );
104
  }
105
- else
106
  return $value;
 
107
  }
108
 
109
  function get_role( $user_id ){
10
 
11
  $this->path_csv = $upload_dir['basedir'] . "/export-users.csv";
12
  $this->user_data = array( "user_login", "user_email", "source_user_id", "user_pass", "user_nicename", "user_url", "user_registered", "display_name" );
13
+ $this->woocommerce_default_user_meta_keys = array( 'billing_first_name', 'billing_last_name', 'billing_email', 'billing_phone', 'billing_country', 'billing_address_1', 'billing_city', 'billing_state', 'billing_postcode', 'shipping_first_name', 'shipping_last_name', 'shipping_country', 'shipping_address_1', 'shipping_address_2', 'shipping_city', 'shipping_state', 'shipping_postcode' );
14
 
15
  add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
16
  add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
88
  <?php
89
  }
90
 
91
+ function is_valid_timestamp( $timestamp ){
92
+ return ( (string) (int) $timestamp === $timestamp ) && ( $timestamp <= PHP_INT_MAX ) && ( $timestamp >= ~PHP_INT_MAX );
93
+ }
94
+
95
  function prepare( $key, $value, $datetime_format ){
96
+ $timestamp_keys = apply_filters( 'acui_export_timestamp_keys', array( 'wc_last_active' ) );
97
+ $non_date_keys = apply_filters( 'acui_export_non_date_keys', array_merge( $this->user_data, $this->woocommerce_default_user_meta_keys ) );
98
 
99
+ if( is_array( $value ) ){
100
  return serialize( $value );
101
+ }
102
  elseif( in_array( $key, $non_date_keys ) || empty( $datetime_format ) ){
103
  return $value;
104
  }
105
+ elseif( strtotime( $value ) ){ // dates in datetime format
106
  return date( $datetime_format, strtotime( $value ) );
107
  }
108
+ elseif( ( $this->is_valid_timestamp( $value ) && strlen( $value ) > 4 ) || in_array( $key, $timestamp_keys) ){ // dates in timestamp format
109
  return date( $datetime_format, $value );
110
  }
111
+ else{
112
  return $value;
113
+ }
114
  }
115
 
116
  function get_role( $user_id ){
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.15.7.2
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.15.7.3
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: carazo, hornero
3
  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.4.2
7
- Stable tag: 1.15.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,10 @@ Plugin will automatically detect:
99
 
100
  == Changelog ==
101
 
 
 
 
 
102
  = 1.15.7.2 =
103
  * UTF-8 fixed exporting users
104
 
3
  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
7
+ Stable tag: 1.15.7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 1.15.7.3 =
103
+ * Tested up to WordPress 5.5
104
+ * Improvements in timestamp data export
105
+
106
  = 1.15.7.2 =
107
  * UTF-8 fixed exporting users
108