Import users from CSV with meta - Version 1.17.5.1

Version Description

  • New action class introduced to make easier to use options into the plugin
  • Path to file in homepage tab, now it is saved to prevent to rewrite it in every import
Download this release

Release Info

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

Code changes from version 1.17.5 to 1.17.5.1

classes/doc.php CHANGED
@@ -78,6 +78,11 @@ class ACUI_Doc{
78
  </td>
79
  </tr>
80
 
 
 
 
 
 
81
  <?php do_action( 'acui_documentation_after_plugins_activated' ); ?>
82
 
83
  <tr valign="top">
78
  </td>
79
  </tr>
80
 
81
+ <tr valign="top">
82
+ <th scope="row"><?php _e( 'Cron', 'import-users-from-csv-with-meta' ); ?></th>
83
+ <td><?php _e( 'Cron tab allows you to make periodical imports using the WordPress cron scheduler.','import-users-from-csv-with-meta'); ?></td>
84
+ </tr>
85
+
86
  <?php do_action( 'acui_documentation_after_plugins_activated' ); ?>
87
 
88
  <tr valign="top">
classes/homepage.php CHANGED
@@ -6,7 +6,7 @@ class ACUI_Homepage{
6
  add_action( 'acui_homepage_start', array( $this, 'maybe_remove_old_csv' ) );
7
  }
8
 
9
- public static function admin_gui(){
10
  $last_roles_used = empty( get_option( 'acui_last_roles_used' ) ) ? array( 'subscriber' ) : get_option( 'acui_last_roles_used' );
11
  ?>
12
  <div class="wrap acui">
@@ -36,7 +36,7 @@ class ACUI_Homepage{
36
  <?php _e( '<em>or you can choose directly a file from your host,', 'import-users-from-csv-with-meta' ) ?> <a href="#" class="toggle_upload_path"><?php _e( 'click here', 'import-users-from-csv-with-meta' ) ?></a>.</em>
37
  </div>
38
  <div id="introduce_path" style="display:none;">
39
- <input placeholder="<?php _e( 'You have to introduce the path to file, i.e.:' ,'import-users-from-csv-with-meta' ); ?><?php $upload_dir = wp_upload_dir(); echo $upload_dir["path"]; ?>/test.csv" type="text" name="path_to_file" id="path_to_file" value="<?php echo dirname( __FILE__ ); ?>/test.csv" style="width:70%;" />
40
  <em><?php _e( 'or you can upload it directly from your PC', 'import-users-from-csv-with-meta' ); ?>, <a href="#" class="toggle_upload_path"><?php _e( 'click here', 'import-users-from-csv-with-meta' ); ?></a>.</em>
41
  </div>
42
  </td>
6
  add_action( 'acui_homepage_start', array( $this, 'maybe_remove_old_csv' ) );
7
  }
8
 
9
+ static function admin_gui(){
10
  $last_roles_used = empty( get_option( 'acui_last_roles_used' ) ) ? array( 'subscriber' ) : get_option( 'acui_last_roles_used' );
11
  ?>
12
  <div class="wrap acui">
36
  <?php _e( '<em>or you can choose directly a file from your host,', 'import-users-from-csv-with-meta' ) ?> <a href="#" class="toggle_upload_path"><?php _e( 'click here', 'import-users-from-csv-with-meta' ) ?></a>.</em>
37
  </div>
38
  <div id="introduce_path" style="display:none;">
39
+ <input placeholder="<?php _e( 'You have to introduce the path to file, i.e.:' ,'import-users-from-csv-with-meta' ); ?><?php $upload_dir = wp_upload_dir(); echo $upload_dir["path"]; ?>/test.csv" type="text" name="path_to_file" id="path_to_file" value="<?php echo ACUI_Options::get( 'path_to_file' ); ?>" style="width:70%;" />
40
  <em><?php _e( 'or you can upload it directly from your PC', 'import-users-from-csv-with-meta' ); ?>, <a href="#" class="toggle_upload_path"><?php _e( 'click here', 'import-users-from-csv-with-meta' ); ?></a>.</em>
41
  </div>
42
  </td>
classes/import.php CHANGED
@@ -15,9 +15,10 @@ class ACUI_Import{
15
 
16
  switch ( $tab ){
17
  case 'homepage':
18
- update_option( 'acui_last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
19
- $this->fileupload_process( $_POST, false );
20
- return;
 
21
  break;
22
 
23
  case 'frontend':
@@ -129,7 +130,7 @@ class ACUI_Import{
129
  echo '</h2>';
130
  }
131
 
132
- public function fileupload_process( $form_data, $is_cron = false, $is_frontend = false ) {
133
  if ( !defined( 'DOING_CRON' ) && ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) ){
134
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
135
  }
15
 
16
  switch ( $tab ){
17
  case 'homepage':
18
+ ACUI_Options::update( 'last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
19
+ ACUI_Options::update( 'path_to_file', sanitize_text_field( $_POST['path_to_file'] ) );
20
+ $this->fileupload_process( $_POST, false );
21
+ return;
22
  break;
23
 
24
  case 'frontend':
130
  echo '</h2>';
131
  }
132
 
133
+ function fileupload_process( $form_data, $is_cron = false, $is_frontend = false ) {
134
  if ( !defined( 'DOING_CRON' ) && ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) ){
135
  wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
136
  }
classes/options.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ACUI_Options{
4
+ static $prefix = 'acui_';
5
+
6
+ static function get_default_list(){
7
+ return array(
8
+ self::$prefix . 'columns' => array(),
9
+ // homepage
10
+ self::$prefix . 'last_roles_used' => array(),
11
+ self::$prefix . 'path_to_file' => dirname( __FILE__ ) . '/test.csv',
12
+ // emails
13
+ self::$prefix . 'mail_subject' => __('Welcome to', 'import-users-from-csv-with-meta') . ' ' . get_bloginfo("name"),
14
+ self::$prefix . 'mail_body' => __('Welcome,', 'import-users-from-csv-with-meta') . '<br/>' . __('Your data to login in this site is:', 'import-users-from-csv-with-meta') . '<br/><ul><li>' . __('URL to login', 'import-users-from-csv-with-meta') . ': **loginurl**</li><li>' . __( 'Username', 'import-users-from-csv-with-meta') . '= **username**</li><li>Password = **password**</li></ul>',
15
+ self::$prefix . 'mail_template_id' => 0,
16
+ self::$prefix . 'mail_attachment_id' => 0,
17
+ self::$prefix . 'enable_email_templates' => false,
18
+ self::$prefix . 'mail_disable_wp_editor' => false,
19
+ // cron
20
+ self::$prefix . 'cron_activated' => false,
21
+ self::$prefix . 'cron_send_mail' => false,
22
+ self::$prefix . 'cron_send_mail_updated' => false,
23
+ self::$prefix . 'cron_delete_users' => false,
24
+ self::$prefix . 'cron_delete_users_assign_posts' => 0,
25
+ self::$prefix . 'cron_change_role_not_present' => false,
26
+ self::$prefix . 'cron_change_role_not_present_role' => 0,
27
+ self::$prefix . 'cron_path_to_file' => '',
28
+ self::$prefix . 'cron_path_to_move' => '',
29
+ self::$prefix . 'cron_path_to_move_auto_rename' => false,
30
+ self::$prefix . 'cron_period' => '',
31
+ self::$prefix . 'cron_role' => '',
32
+ self::$prefix . 'cron_update_roles_existing_users' => '',
33
+ self::$prefix . 'cron_log' => '',
34
+ self::$prefix . 'cron_allow_multiple_accounts' => 'not_allowed',
35
+ // frontend
36
+ self::$prefix . 'frontend_send_mail'=> false,
37
+ self::$prefix . 'frontend_send_mail_updated' => false,
38
+ self::$prefix . 'frontend_mail_admin' => false,
39
+ self::$prefix . 'frontend_send_mail_admin_address_list' => '',
40
+ self::$prefix . 'frontend_delete_users' => false,
41
+ self::$prefix . 'frontend_delete_users_assign_posts' => 0,
42
+ self::$prefix . 'frontend_change_role_not_present' => false,
43
+ self::$prefix . 'frontend_change_role_not_present_role' => 0,
44
+ self::$prefix . 'frontend_role' => '',
45
+ self::$prefix . 'frontend_update_existing_users' => false,
46
+ self::$prefix . 'frontend_update_roles_existing_users' => false,
47
+ // emials
48
+ self::$prefix . 'manually_send_mail' => false,
49
+ self::$prefix . 'manually_send_mail_updated' => false,
50
+ self::$prefix . 'automatic_wordpress_email' => false,
51
+ self::$prefix . 'automatic_created_edited_wordpress_email' => false,
52
+ // profile fields
53
+ self::$prefix . 'show_profile_fields' => false
54
+ );
55
+ }
56
+
57
+ static function get_default( $key ){
58
+ $defaults = self::get_default_list();
59
+ return ( isset( $defaults[$key] ) ) ? $defaults[$key] : '';
60
+ }
61
+
62
+ static function prepare_key( $key, $class = '' ){
63
+ return ( empty( $class ) ) ? self::$prefix . $key : self::$prefix . $class . $key;
64
+ }
65
+
66
+ static function get( $key, $class = '' ){
67
+ $key = self::prepare_key( $key, $class );
68
+ $value = get_option( $key );
69
+
70
+ return ( !empty( $value ) ) ? $value : self::get_default( $key );
71
+ }
72
+
73
+ static function update( $key, $value, $class = '' ){
74
+ $key = self::prepare_key( $key, $class );
75
+ return update_option( $key, $value );
76
+ }
77
+ }
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.5
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -21,55 +21,7 @@ class ImportExportUsersCustomers{
21
  function __construct(){
22
  }
23
 
24
- public static function get_default_options_list(){
25
- return array(
26
- 'acui_columns' => array(),
27
- // emails
28
- 'acui_mail_subject' => __('Welcome to', 'import-users-from-csv-with-meta') . ' ' . get_bloginfo("name"),
29
- 'acui_mail_body' => __('Welcome,', 'import-users-from-csv-with-meta') . '<br/>' . __('Your data to login in this site is:', 'import-users-from-csv-with-meta') . '<br/><ul><li>' . __('URL to login', 'import-users-from-csv-with-meta') . ': **loginurl**</li><li>' . __( 'Username', 'import-users-from-csv-with-meta') . '= **username**</li><li>Password = **password**</li></ul>',
30
- 'acui_mail_template_id' => 0,
31
- 'acui_mail_attachment_id' => 0,
32
- 'acui_enable_email_templates' => false,
33
- 'acui_mail_disable_wp_editor' => false,
34
- // cron
35
- 'acui_cron_activated' => false,
36
- 'acui_cron_send_mail' => false,
37
- 'acui_cron_send_mail_updated' => false,
38
- 'acui_cron_delete_users' => false,
39
- 'acui_cron_delete_users_assign_posts' => 0,
40
- 'acui_cron_change_role_not_present' => false,
41
- 'acui_cron_change_role_not_present_role' => 0,
42
- 'acui_cron_path_to_file' => '',
43
- 'acui_cron_path_to_move' => '',
44
- 'acui_cron_path_to_move_auto_rename' => false,
45
- 'acui_cron_period' => '',
46
- 'acui_cron_role' => '',
47
- 'acui_cron_update_roles_existing_users' => '',
48
- 'acui_cron_log' => '',
49
- 'acui_cron_allow_multiple_accounts' => 'not_allowed',
50
- // frontend
51
- 'acui_frontend_send_mail'=> false,
52
- 'acui_frontend_send_mail_updated' => false,
53
- 'acui_frontend_mail_admin' => false,
54
- 'acui_frontend_send_mail_admin_address_list' => '',
55
- 'acui_frontend_delete_users' => false,
56
- 'acui_frontend_delete_users_assign_posts' => 0,
57
- 'acui_frontend_change_role_not_present' => false,
58
- 'acui_frontend_change_role_not_present_role' => 0,
59
- 'acui_frontend_role' => '',
60
- 'acui_frontend_update_existing_users' => false,
61
- 'acui_frontend_update_roles_existing_users' => false,
62
- // emials
63
- 'acui_manually_send_mail' => false,
64
- 'acui_manually_send_mail_updated' => false,
65
- 'acui_automatic_wordpress_email' => false,
66
- 'acui_automatic_created_edited_wordpress_email' => false,
67
- // profile fields
68
- 'acui_show_profile_fields' => false
69
- );
70
- }
71
-
72
- public function on_init(){
73
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
74
 
75
  if( is_plugin_active( 'buddypress/bp-loader.php' ) || function_exists( 'bp_is_active' ) ){
@@ -114,15 +66,16 @@ class ImportExportUsersCustomers{
114
  }
115
  }
116
 
117
- public static function activate(){
118
- $acui_default_options_list = self::get_default_options_list();
 
119
 
120
  foreach ( $acui_default_options_list as $key => $value) {
121
  add_option( $key, $value, '', false );
122
  }
123
  }
124
 
125
- public static function deactivate(){
126
  wp_clear_scheduled_hook( 'acui_cron' );
127
  }
128
 
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.5.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
21
  function __construct(){
22
  }
23
 
24
+ function on_init(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
26
 
27
  if( is_plugin_active( 'buddypress/bp-loader.php' ) || function_exists( 'bp_is_active' ) ){
66
  }
67
  }
68
 
69
+ static function activate(){
70
+ include_once( 'classes/options.php' );
71
+ $acui_default_options_list = ACUI_Options::get_default_list();
72
 
73
  foreach ( $acui_default_options_list as $key => $value) {
74
  add_option( $key, $value, '', false );
75
  }
76
  }
77
 
78
+ static function deactivate(){
79
  wp_clear_scheduled_hook( 'acui_cron' );
80
  }
81
 
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.1
7
- Stable tag: 1.17.5
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.5 =
107
  * Fixed problems importing avatar from WP User Avatar
108
  * Avatars using WP User Avatar can now be exported
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.1
7
+ Stable tag: 1.17.5.1
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.5.1 =
107
+ * New action class introduced to make easier to use options into the plugin
108
+ * Path to file in homepage tab, now it is saved to prevent to rewrite it in every import
109
+
110
  = 1.17.5 =
111
  * Fixed problems importing avatar from WP User Avatar
112
  * Avatars using WP User Avatar can now be exported