Import users from CSV with meta - Version 1.19.1.8

Version Description

  • Fixed warnings in "Meta keys" tab
Download this release

Release Info

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

Code changes from version 1.19.1.7 to 1.19.1.8

classes/meta-keys.php CHANGED
@@ -8,7 +8,7 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
8
 
9
  class ACUI_MetaKeys{
10
  public static function admin_gui(){
11
- $customers_obj = new Customers_List();
12
  ?>
13
  <style type="text/css">
14
  .tablenav.top{
@@ -22,8 +22,8 @@ class ACUI_MetaKeys{
22
  <div class="meta-box-sortables ui-sortable">
23
  <form method="post">
24
  <?php
25
- $customers_obj->prepare_items();
26
- $customers_obj->display(); ?>
27
  </form>
28
  </div>
29
  </div>
@@ -34,7 +34,7 @@ class ACUI_MetaKeys{
34
  }
35
  }
36
 
37
- class Customers_List extends WP_List_Table {
38
  public function __construct() {
39
  parent::__construct( [
40
  'singular' => 'Meta key',
@@ -53,7 +53,7 @@ class Customers_List extends WP_List_Table {
53
  return $columns;
54
  }
55
 
56
- public static function get_meta_keys() {
57
  global $wpdb;
58
 
59
  $meta_keys = array();
@@ -73,7 +73,7 @@ class Customers_List extends WP_List_Table {
73
  return $meta_keys;
74
  }
75
 
76
- public static function record_count() {
77
  global $wpdb;
78
 
79
  $select = "SELECT distinct $wpdb->usermeta.meta_key FROM $wpdb->usermeta";
@@ -82,11 +82,11 @@ class Customers_List extends WP_List_Table {
82
  return count( $usermeta );
83
  }
84
 
85
- public function no_items() {
86
  _e( 'No meta keys availale.', 'sp' );
87
  }
88
 
89
- public function column_default( $item, $column_name ) {
90
  switch ( $column_name ) {
91
  case 'meta_key':
92
  return $item['meta_key'];
@@ -99,25 +99,32 @@ class Customers_List extends WP_List_Table {
99
  }
100
  }
101
 
102
- public function get_example( $meta_key ){
103
  global $wpdb;
104
  $select = $wpdb->prepare( "SELECT $wpdb->usermeta.meta_value FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value IS NOT NULL AND meta_value <> '' LIMIT 1", $meta_key );
105
  $usermeta = $wpdb->get_results( $select, ARRAY_A);
106
 
 
 
 
107
  $usermeta = reset( $usermeta );
108
 
109
  return $usermeta['meta_value'];
110
  }
111
 
112
- public function get_type( $meta_key ){
113
- return is_serialized( $this->get_example( $meta_key ) ) ? 'Serialized' : 'Non serialized';
 
 
 
 
114
  }
115
 
116
  function column_name( $item ) {
117
  return '<strong>' . $item['name'] . '</strong>';
118
  }
119
 
120
- public function prepare_items() {
121
  $columns = $this->get_columns();
122
  $this->_column_headers = array( $columns, array(), array() );
123
 
8
 
9
  class ACUI_MetaKeys{
10
  public static function admin_gui(){
11
+ $meta_keys_obj = new ACUI_MetaKeys_Table();
12
  ?>
13
  <style type="text/css">
14
  .tablenav.top{
22
  <div class="meta-box-sortables ui-sortable">
23
  <form method="post">
24
  <?php
25
+ $meta_keys_obj->prepare_items();
26
+ $meta_keys_obj->display(); ?>
27
  </form>
28
  </div>
29
  </div>
34
  }
35
  }
36
 
37
+ class ACUI_MetaKeys_Table extends WP_List_Table {
38
  public function __construct() {
39
  parent::__construct( [
40
  'singular' => 'Meta key',
53
  return $columns;
54
  }
55
 
56
+ static function get_meta_keys() {
57
  global $wpdb;
58
 
59
  $meta_keys = array();
73
  return $meta_keys;
74
  }
75
 
76
+ static function record_count() {
77
  global $wpdb;
78
 
79
  $select = "SELECT distinct $wpdb->usermeta.meta_key FROM $wpdb->usermeta";
82
  return count( $usermeta );
83
  }
84
 
85
+ function no_items() {
86
  _e( 'No meta keys availale.', 'sp' );
87
  }
88
 
89
+ function column_default( $item, $column_name ) {
90
  switch ( $column_name ) {
91
  case 'meta_key':
92
  return $item['meta_key'];
99
  }
100
  }
101
 
102
+ function get_example( $meta_key ){
103
  global $wpdb;
104
  $select = $wpdb->prepare( "SELECT $wpdb->usermeta.meta_value FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value IS NOT NULL AND meta_value <> '' LIMIT 1", $meta_key );
105
  $usermeta = $wpdb->get_results( $select, ARRAY_A);
106
 
107
+ if( count( $usermeta ) == 0 )
108
+ return '';
109
+
110
  $usermeta = reset( $usermeta );
111
 
112
  return $usermeta['meta_value'];
113
  }
114
 
115
+ function get_type( $meta_key ){
116
+ $example = $this->get_example( $meta_key );
117
+ if( empty( $example ) )
118
+ return '';
119
+
120
+ return is_serialized( $example ) ? 'Serialized' : 'Non serialized';
121
  }
122
 
123
  function column_name( $item ) {
124
  return '<strong>' . $item['name'] . '</strong>';
125
  }
126
 
127
+ function prepare_items() {
128
  $columns = $this->get_columns();
129
  $this->_column_headers = array( $columns, array(), array() );
130
 
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.19.1.7
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -14,7 +14,7 @@ Domain Path: /languages
14
  if ( ! defined( 'ABSPATH' ) )
15
  exit;
16
 
17
- define( 'ACUI_VERSION', '1.19.1.7' );
18
 
19
  class ImportExportUsersCustomers{
20
  var $file;
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.19.1.8
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
14
  if ( ! defined( 'ABSPATH' ) )
15
  exit;
16
 
17
+ define( 'ACUI_VERSION', '1.19.1.8' );
18
 
19
  class ImportExportUsersCustomers{
20
  var $file;
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.9
7
- Stable tag: 1.19.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -105,6 +105,9 @@ Plugin will automatically detect:
105
 
106
  == Changelog ==
107
 
 
 
 
108
  = 1.19.1.7 =
109
  * New hooks added to homepage tab to include more options using addons
110
 
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.9
7
+ Stable tag: 1.19.1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
105
 
106
  == Changelog ==
107
 
108
+ = 1.19.1.8 =
109
+ * Fixed warnings in "Meta keys" tab
110
+
111
  = 1.19.1.7 =
112
  * New hooks added to homepage tab to include more options using addons
113