Import users from CSV with meta - Version 1.19.2

Version Description

  • New hooks added to override the button text in both shortcodes import and export
Download this release

Release Info

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

Code changes from version 1.19.1.9 to 1.19.2

Files changed (74) hide show
  1. classes/batch_exporter.php +3 -0
  2. classes/frontend.php +2 -2
  3. import-users-from-csv-with-meta.php +3 -3
  4. readme.txt +10 -2
  5. trunk/addons/advanced-custom-fields.php +145 -0
  6. trunk/addons/allow-multiple-accounts.php +81 -0
  7. trunk/addons/buddypress.php +316 -0
  8. trunk/addons/customer-area.php +72 -0
  9. trunk/addons/groups.php +94 -0
  10. trunk/addons/indeed-ultimate-membership-pro.php +58 -0
  11. trunk/addons/learndash.php +37 -0
  12. trunk/addons/mailpoet.php +52 -0
  13. trunk/addons/new-user-approve.php +41 -0
  14. trunk/addons/paid-member-subscriptions.php +75 -0
  15. trunk/addons/pmpro.php +144 -0
  16. trunk/addons/users-group.php +58 -0
  17. trunk/addons/woocommerce-custom-fields.php +91 -0
  18. trunk/addons/woocommerce-membership-rightpress.php +38 -0
  19. trunk/addons/woocommerce-membership.php +142 -0
  20. trunk/addons/woocommerce-subscriptions.php +828 -0
  21. trunk/addons/woocommerce.php +156 -0
  22. trunk/addons/wp-access-area.php +59 -0
  23. trunk/addons/wp-lms-course.php +50 -0
  24. trunk/addons/wp-members.php +62 -0
  25. trunk/addons/wp-private-content-plus.php +70 -0
  26. trunk/addons/wp-user-avatar.php +68 -0
  27. trunk/addons/wp-user-manager.php +49 -0
  28. trunk/addons/wp-users-group.php +58 -0
  29. trunk/addons/wpml.php +65 -0
  30. trunk/addons/wpum-groups.php +33 -0
  31. trunk/assets/codection-inmotion.png +0 -0
  32. trunk/assets/email-options.js +30 -0
  33. trunk/assets/email-template-attachment-admin.js +67 -0
  34. trunk/assets/export.js +96 -0
  35. trunk/assets/icon_coffee.png +0 -0
  36. trunk/assets/iontics_logo.svg +29 -0
  37. trunk/assets/style.css +187 -0
  38. trunk/assets/webempresa_logo.png +0 -0
  39. trunk/classes/actions.php +95 -0
  40. trunk/classes/batch_exporter.php +695 -0
  41. trunk/classes/columns.php +238 -0
  42. trunk/classes/cron.php +426 -0
  43. trunk/classes/doc.php +120 -0
  44. trunk/classes/donate.php +33 -0
  45. trunk/classes/email-options.php +315 -0
  46. trunk/classes/email-templates.php +158 -0
  47. trunk/classes/export.php +250 -0
  48. trunk/classes/force-reset-password.php +65 -0
  49. trunk/classes/frontend.php +492 -0
  50. trunk/classes/help.php +19 -0
  51. trunk/classes/helper.php +467 -0
  52. trunk/classes/homepage.php +502 -0
  53. trunk/classes/html.php +344 -0
  54. trunk/classes/import-filters.php +19 -0
  55. trunk/classes/import.php +827 -0
  56. trunk/classes/meta-keys.php +133 -0
  57. trunk/classes/multisite.php +52 -0
  58. trunk/classes/new_features.php +28 -0
  59. trunk/classes/options.php +107 -0
  60. trunk/classes/rest-api.php +27 -0
  61. trunk/classes/settings.php +15 -0
  62. trunk/classes/wp-importer.php +25 -0
  63. trunk/csv_example.png +0 -0
  64. trunk/icon_coffee.png +0 -0
  65. trunk/import-users-from-csv-with-meta.php +153 -0
  66. trunk/languages/import-users-from-csv-with-meta-de_DE.mo +0 -0
  67. trunk/languages/import-users-from-csv-with-meta-de_DE.po +1151 -0
  68. trunk/languages/import-users-from-csv-with-meta-fr_FR.mo +0 -0
  69. trunk/languages/import-users-from-csv-with-meta-fr_FR.po +1188 -0
  70. trunk/languages/import-users-from-csv-with-meta.pot +1067 -0
  71. trunk/readme.txt +1399 -0
  72. trunk/samples/wcs-import-sample.csv +10 -0
  73. trunk/test.csv +3 -0
  74. trunk/wpml-config.xml +9 -0
classes/batch_exporter.php CHANGED
@@ -453,6 +453,9 @@ class ACUI_Batch_Exporter{
453
  function export() {
454
  $this->send_headers();
455
  $this->send_content( $this->get_headers_row_file() . $this->get_file() );
 
 
 
456
  @unlink( $this->get_file_path() );
457
  @unlink( $this->get_headers_row_file_path() );
458
  die();
453
  function export() {
454
  $this->send_headers();
455
  $this->send_content( $this->get_headers_row_file() . $this->get_file() );
456
+
457
+ do_action( 'acui_export_before_delete_file', $this->get_file_path() );
458
+
459
  @unlink( $this->get_file_path() );
460
  @unlink( $this->get_headers_row_file_path() );
461
  die();
classes/frontend.php CHANGED
@@ -430,7 +430,7 @@ class ACUI_Frontend{
430
 
431
  <?php do_action( 'acui_frontend_import_after_input_file' ); ?>
432
 
433
- <input class="acui_frontend_submit" type="submit" value="<?php _e( 'Upload and process', 'import-users-from-csv-with-meta' ); ?>"/>
434
 
435
  <?php do_action( 'acui_frontend_import_after_submit' ); ?>
436
 
@@ -475,7 +475,7 @@ class ACUI_Frontend{
475
  <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
476
  <?php endforeach; ?>
477
 
478
- <input class="acui_frontend_submit" type="submit" value="<?php _e( 'Export', 'import-users-from-csv-with-meta' ); ?>"/>
479
 
480
  <?php wp_nonce_field( 'codection-security', 'security' ); ?>
481
 
430
 
431
  <?php do_action( 'acui_frontend_import_after_input_file' ); ?>
432
 
433
+ <input class="acui_frontend_submit" type="submit" value="<?php apply_filters( 'acui_import_shortcode_button_text', _e( 'Upload and process', 'import-users-from-csv-with-meta' ) ); ?>"/>
434
 
435
  <?php do_action( 'acui_frontend_import_after_submit' ); ?>
436
 
475
  <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
476
  <?php endforeach; ?>
477
 
478
+ <input class="acui_frontend_submit" type="submit" value="<?php apply_filters( 'acui_export_shortcode_button_text', _e( 'Export', 'import-users-from-csv-with-meta' ) ); ?>"/>
479
 
480
  <?php wp_nonce_field( 'codection-security', 'security' ); ?>
481
 
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.9
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.9' );
18
 
19
  class ImportExportUsersCustomers{
20
  var $file;
@@ -38,7 +38,7 @@ class ImportExportUsersCustomers{
38
  load_plugin_textdomain( 'import-users-from-csv-with-meta', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
39
  }
40
 
41
- public function loader(){
42
  add_action( 'admin_menu', array( $this, 'menu' ) );
43
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10, 1 );
44
  add_filter( 'plugin_action_links', array( $this, 'action_links' ), 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.19.2
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.2' );
18
 
19
  class ImportExportUsersCustomers{
20
  var $file;
38
  load_plugin_textdomain( 'import-users-from-csv-with-meta', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
39
  }
40
 
41
+ function loader(){
42
  add_action( 'admin_menu', array( $this, 'menu' ) );
43
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10, 1 );
44
  add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 );
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.9
7
- Stable tag: 1.19.1.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -27,6 +27,7 @@ Clean and easy-to-use import and export users and customer plugin, for WordPress
27
  * Create a cron task to import users periodically
28
  * Edit the metadata (you will be able to edit the metadata imported using metakeys directly in the profile of each user)
29
  * Extend the plugin using the hooks we provide
 
30
 
31
  Moreover this plugin is compatible with many other plugins to be able to import and include them data, subscriptions, memberships, etc. Take a look:
32
 
@@ -46,6 +47,7 @@ Moreover this plugin is compatible with many other plugins to be able to import
46
  * WP Members: to import memberships
47
  * WP Users Group: to assign users to groups while importing
48
  * WooCommerce Membership by RightPress: to create memberships while users are being imported
 
49
 
50
  If you have some problem or doubt:
51
 
@@ -105,6 +107,12 @@ Plugin will automatically detect:
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
108
  = 1.19.1.9 =
109
  * Improved some labels to avoid misunderstandings with email options, thanks to @blakemiller
110
 
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.9.2
7
+ Stable tag: 1.19.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
27
  * Create a cron task to import users periodically
28
  * Edit the metadata (you will be able to edit the metadata imported using metakeys directly in the profile of each user)
29
  * Extend the plugin using the hooks we provide
30
+ * Compatible with WPML [read the documentation](https://wpml.org/documentation/plugins-compatibility/import-users-from-csv-with-meta-and-wpml/) to see how you can translate the front-end import and export users page and send translated email notifications to users
31
 
32
  Moreover this plugin is compatible with many other plugins to be able to import and include them data, subscriptions, memberships, etc. Take a look:
33
 
47
  * WP Members: to import memberships
48
  * WP Users Group: to assign users to groups while importing
49
  * WooCommerce Membership by RightPress: to create memberships while users are being imported
50
+ * WP Private Content Plus: To import and export the groups to which users are assigned
51
 
52
  If you have some problem or doubt:
53
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.19.2 =
111
+ * New hooks added to override the button text in both shortcodes import and export
112
+
113
+ = 1.19.1.10 =
114
+ * New hook added in export before deleting the file from the server
115
+
116
  = 1.19.1.9 =
117
  * Improved some labels to avoid misunderstandings with email options, thanks to @blakemiller
118
 
trunk/addons/advanced-custom-fields.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) && !is_plugin_active( 'advanced-custom-fields/acf.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_ACF{
10
+ function __construct(){
11
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
+ add_filter( 'acui_not_meta_fields', array( $this, 'restricted_fields' ), 10, 1 );
13
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
14
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
15
+ }
16
+
17
+ function restricted_fields( $acui_restricted_fields ){
18
+ return array_merge( $acui_restricted_fields, $this->get_user_fields_keys() );
19
+ }
20
+
21
+ function documentation(){
22
+ $fields = $this->get_user_fields();
23
+ ?>
24
+ <tr valign="top">
25
+ <th scope="row"><?php _e( "Advaced Custom Fields is activated", 'import-users-from-csv-with-meta' ); ?></th>
26
+ <td>
27
+ <?php _e( "You can import those fields, look at every group which fields you can import using the column names shown below.", 'import-users-from-csv-with-meta' ); ?>.
28
+ <ul style="list-style:disc outside none; margin-left:2em;">
29
+ <?php foreach ( $this->get_user_fields() as $group => $fields ): ?>
30
+ <li><?php _e( "Group name", 'import-users-from-csv-with-meta' ); ?>: <em><?php echo $group; ?></em></li>
31
+ <ul style="list-style:square inside none; margin-left:2em;">
32
+ <?php foreach ( $fields as $field ): ?>
33
+ <li><?php echo $field['label']; ?> <em>(type: <?php echo $field['type']; ?>)</em> - Column name in the CSV: <strong><?php echo $field['name']; ?></strong></li>
34
+ <?php endforeach; ?>
35
+ </ul>
36
+ <?php endforeach; ?>
37
+ </ul>
38
+ <p class="description">In fields of type relationships, you can use post slug or post ID in the list of posts related.</p>
39
+ </td>
40
+ </tr>
41
+ <?php
42
+ }
43
+
44
+ function import( $headers, $row, $user_id ){
45
+ $fields_positions = array();
46
+ $types = $this->get_user_fields_types();
47
+
48
+ foreach ( $types as $key => $type ) {
49
+ $pos = array_search( $key, $headers );
50
+
51
+ if( $pos === FALSE )
52
+ continue;
53
+
54
+ $fields_positions[ $pos ] = $key;
55
+ }
56
+
57
+ foreach ( $fields_positions as $pos => $key ) {
58
+ /*$preexisting_values = get_field( $key, "user_" . $user_id );
59
+ if( !empty( $preexisting_values ) ){
60
+ $data = array_unique( array_merge( $preexisting_values, $data ) );
61
+ $data = array_filter( $data, function( $value ) { return !is_null( $value ) && $value !== '' && $value != 0; } );
62
+ }*/
63
+
64
+ // slugs in relationship
65
+ if( $types[ $key ][ 'type' ] == 'relationship' ){
66
+ $data = explode( ',', $row[ $pos ] );
67
+
68
+ foreach ( $data as $it => $value ) {
69
+ $data[ $it ] = is_numeric( $value ) ? $value : ACUI_Helper::get_post_id_by_slug( $value );
70
+ }
71
+ }
72
+ elseif( $types[ $key ][ 'multiple' ] ){
73
+ $data = explode( ',', $row[ $pos ] );
74
+ array_filter( $data, function( $value ){ return $value !== ''; } );
75
+ }
76
+ else{
77
+ $data = $row[ $pos ];
78
+ }
79
+
80
+ update_field( $key, $data, "user_" . $user_id );
81
+ }
82
+ }
83
+
84
+ function get_user_fields(){
85
+ $post_id = "user_new";
86
+ $fields = array();
87
+
88
+ $args = array(
89
+ 'user_id' => 'new',
90
+ 'user_form' => '#your-profile'
91
+ );
92
+
93
+ $field_groups = acf_get_field_groups( array( 'user_id' => 'new', 'user_form' => '#your-profile' ) );
94
+
95
+ if( empty( $field_groups ) )
96
+ return array();
97
+
98
+ acf_form_data( array( 'post_id' => "user_new", 'nonce' => 'user' ) );
99
+
100
+ foreach( $field_groups as $field_group ) {
101
+ $fields[ $field_group['title'] ] = acf_get_fields( $field_group );
102
+ }
103
+
104
+ return $fields;
105
+ }
106
+
107
+ function get_user_fields_keys(){
108
+ $fields = $this->get_user_fields();
109
+ $fields_keys = array();
110
+
111
+ if( empty( $fields ) )
112
+ return array();
113
+
114
+ foreach ( $fields as $group => $fields_of_group ){
115
+ foreach ( $fields_of_group as $field ){
116
+ $fields_keys[] = $field['name'];
117
+ }
118
+ }
119
+
120
+ return $fields_keys;
121
+ }
122
+
123
+ function get_user_fields_types(){
124
+ $fields = $this->get_user_fields();
125
+ $fields_keys = array();
126
+ $types_multiple = array( 'select', 'checkbox', 'radio', 'button_group' );
127
+
128
+ if( empty( $fields ) )
129
+ return array();
130
+
131
+ foreach ( $fields as $group => $fields_of_group ){
132
+ foreach ( $fields_of_group as $field ){
133
+ $fields_keys[ $field['name'] ] = [
134
+ 'type' => $field['type'],
135
+ // 'select' type has a 'multiple' key which can be 0 or 1
136
+ 'multiple' => !empty( $field['multiple'] ) || ( !isset( $field['multiple'] ) && in_array( $field['type'], $types_multiple ) ),
137
+ ];
138
+ }
139
+ }
140
+
141
+ return $fields_keys;
142
+ }
143
+ }
144
+
145
+ new ACUI_ACF();
trunk/addons/allow-multiple-accounts.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'allow-multiple-accounts/allow-multiple-accounts.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_AllowMultipleAccounts{
10
+ function __construct(){
11
+ add_action( 'acui_tab_import_before_import_button', array( $this, 'before_import_button' ) );
12
+ add_action( 'acui_tab_cron_before_log', array( $this, 'cron_before_log' ) );
13
+ }
14
+
15
+ function before_import_button(){
16
+ ?>
17
+ <h2><?php _e( 'Allow multiple accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
18
+
19
+ <table class="form-table">
20
+ <tbody>
21
+ <tr class="form-field form-required">
22
+ <th scope="row"><label><?php _e( 'Repeated email in different users?', 'import-users-from-csv-with-meta' ); ?></label></th>
23
+ <td>
24
+ <select name="allow_multiple_accounts">
25
+ <option value="not_allowed"><?php _e( 'Not allowed', 'import-users-from-csv-with-meta' ); ?></option>
26
+ <option value="allowed"><?php _e( 'Allowed', 'import-users-from-csv-with-meta' ); ?></option>
27
+ </select>
28
+ <p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/allow-multiple-accounts/"><?php _e( 'Allow Multiple Accounts', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta'); ?>)</strong>. <?php _e('Allow multiple user accounts to be created having the same email address.','import-users-from-csv-with-meta' ); ?></p>
29
+ </td>
30
+ </tr>
31
+ </tbody>
32
+ </table>
33
+ <?php
34
+ }
35
+
36
+ function cron_before_log(){
37
+ ?>
38
+ <h2><?php _e( 'Allow Multiple Accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
39
+
40
+ <table class="form-table">
41
+ <tbody>
42
+
43
+ <tr class="form-field form-required">
44
+ <th scope="row"><label><?php _e( 'Repeated email in different users?', 'import-users-from-csv-with-meta' ); ?></label></th>
45
+ <td>
46
+ <input type="checkbox" name="allow_multiple_accounts" value="yes" <?php if( $allow_multiple_accounts == "allowed" ) echo "checked='checked'"; ?>/>
47
+ <p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/allow-multiple-accounts/"><?php _e( 'Allow Multiple Accounts', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta'); ?>)</strong>. <?php _e('Allow multiple user accounts to be created having the same email address.','import-users-from-csv-with-meta' ); ?></p>
48
+ </td>
49
+ </tr>
50
+ </tbody>
51
+ </table>
52
+ <?php
53
+ }
54
+
55
+ public static function hack_email( $email ) {
56
+ if ( ! is_email( $email ) ) {
57
+ return;
58
+ }
59
+
60
+ $old_email = $email;
61
+
62
+ for ( $i = 0; ! $skip_remap && email_exists( $email ); $i++ ) {
63
+ $email = str_replace( '@', "+ama{$i}@", $old_email );
64
+ }
65
+
66
+ return $email;
67
+ }
68
+
69
+ public static function hack_restore_remapped_email_address( $user_id, $email ) {
70
+ global $wpdb;
71
+
72
+ $wpdb->update(
73
+ $wpdb->users,
74
+ array( 'user_email' => $email ),
75
+ array( 'ID' => $user_id )
76
+ );
77
+
78
+ clean_user_cache( $user_id );
79
+ }
80
+ }
81
+ new ACUI_AllowMultipleAccounts();
trunk/addons/buddypress.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'buddypress/bp-loader.php' ) && !function_exists( 'bp_is_active' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_Buddypress{
10
+ var $fields;
11
+ var $profile_groups;
12
+
13
+ function __construct(){
14
+ if( !class_exists( 'BP_XProfile_Group' ) ){
15
+ if( is_plugin_active( 'buddypress/bp-loader.php' ) )
16
+ require_once( WP_PLUGIN_DIR . "/buddypress/bp-xprofile/classes/class-bp-xprofile-group.php" );
17
+ elseif( is_plugin_active( 'buddyboss-platform/bp-loader.php' ) )
18
+ require_once( WP_PLUGIN_DIR . "/buddyboss-platform/bp-xprofile/classes/class-bp-xprofile-group.php" );
19
+ }
20
+
21
+ $this->profile_groups = $this->get_profile_groups();
22
+ $this->fields = $this->get_fields();
23
+ }
24
+
25
+ function hooks(){
26
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
27
+ add_action( 'acui_tab_import_before_import_button', array( $this, 'show_compatibility' ) );
28
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
29
+ add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
30
+ add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 3 );
31
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 6 );
32
+ add_action( 'post_acui_import_single_user', array( $this, 'import_avatar' ), 10, 3 );
33
+ }
34
+
35
+ function restricted_fields( $acui_restricted_fields ){
36
+ return array_merge( $acui_restricted_fields, array( 'bp_group', 'bp_group_role', 'bp_avatar' ), $this->fields );
37
+ }
38
+
39
+ function get_profile_groups(){
40
+ return BP_XProfile_Group::get( array( 'fetch_fields' => true ) );
41
+ }
42
+
43
+ public function get_fields(){
44
+ $buddypress_fields = array();
45
+
46
+ if ( !empty( $this->profile_groups ) ) {
47
+ foreach ( $this->profile_groups as $profile_group ) {
48
+ if ( !empty( $profile_group->fields ) ) {
49
+ foreach ( $profile_group->fields as $field ) {
50
+ $buddypress_fields[] = $field->name;
51
+ }
52
+ }
53
+ }
54
+ }
55
+
56
+ return $buddypress_fields;
57
+ }
58
+
59
+ function get_field_type( $field_name ){
60
+ if ( !empty( $this->profile_groups ) ) {
61
+ foreach ( $this->profile_groups as $profile_group ) {
62
+ if ( !empty( $profile_group->fields ) ) {
63
+ foreach ( $profile_group->fields as $field ) {
64
+ if( $field_name == $field->name )
65
+ return $field->type;
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+
72
+ function get_type_import_help( $type ){
73
+ switch( $type ){
74
+ case 'datebox':
75
+ $help = __( sprintf( 'Format should be like this: %s-01-01 00:00:00', date( 'Y' ) ), 'import-users-from-csv-with-meta' );
76
+ break;
77
+
78
+ case 'checkbox':
79
+ $help = __( 'If you use more than one value, please use commas to separate each item', 'import-users-from-csv-with-meta' );
80
+ break;
81
+ }
82
+
83
+ return empty( $help ) ? '' : " <em>($help)</em>";
84
+ }
85
+
86
+ function get_groups( $user_id ){
87
+ if( !class_exists( "BP_Groups_Member" ) ){
88
+ require_once( WP_PLUGIN_DIR . "/buddypress/bp-groups/classes/class-bp-groups-member.php" );
89
+ }
90
+
91
+ $groups = BP_Groups_Member::get_group_ids( $user_id );
92
+ return implode( ",", $groups['groups'] );
93
+ }
94
+
95
+ function get_member_type( $user_id ){
96
+ $member_types = bp_get_member_type( $user_id, false );
97
+ return ( is_array( $member_types ) ) ? implode( ",", $member_types ) : $member_types;
98
+ }
99
+
100
+ function show_compatibility(){
101
+ ?>
102
+ <h2><?php _e( 'BuddyPress & BuddyBoss compatibility', 'import-users-from-csv-with-meta'); ?></h2>
103
+
104
+ <table class="form-table">
105
+ <tbody>
106
+ <tr class="form-field form-required">
107
+ <th scope="row"><label><?php _e( 'BuddyPress/BuddyBoss users', 'import-users-from-csv-with-meta' ); ?></label></th>
108
+ <td><?php _e( 'You can insert any profile from BuddyPress using his name as header. Plugin will check, before import, which fields are defined in BuddyPress and will assign it in the update. You can use this fields:', 'import-users-from-csv-with-meta' ); ?>
109
+ <ul style="list-style:disc outside none;margin-left:2em;">
110
+ <?php foreach ( $this->get_fields() as $buddypress_field ):
111
+ $type = $this->get_field_type( $buddypress_field );
112
+ ?>
113
+ <li><?php echo $buddypress_field; ?> - <?php echo $type . $this->get_type_import_help( $type ); ?></li>
114
+ <?php endforeach; ?>
115
+ </ul>
116
+ </td>
117
+ </tr>
118
+ </tbody>
119
+ </table>
120
+ <?php
121
+ }
122
+
123
+ function documentation(){
124
+ ?>
125
+ <tr valign="top">
126
+ <th scope="row"><?php _e( 'BuddyPress/BuddyBoss avatar', 'import-users-from-csv-with-meta' ); ?></th>
127
+ <td><?php _e( 'You can import users avatars using a column called <strong>bp_avatar</strong>, in this field you can place:', 'import-users-from-csv-with-meta' ); ?>
128
+ <ul style="list-style:disc outside none;margin-left:2em;">
129
+ <li>An integer which identify the ID of an attachment uploaded to your media library</li>
130
+ <li>A string that contain a path or an URL to the image</li>
131
+ </ul>
132
+ </td>
133
+ </tr>
134
+ <tr valign="top">
135
+ <th scope="row"><?php _e( "BuddyPress or BuddyBoss is activated", 'import-users-from-csv-with-meta' ); ?></th>
136
+ <td><?php _e( "You can use the <strong>profile fields</strong> you have created and also you can set one or more groups for each user. For example:", 'import-users-from-csv-with-meta' ); ?>
137
+ <ul style="list-style:disc outside none; margin-left:2em;">
138
+ <li><?php _e( "If you want to assign an user to a group you have to create a column 'bp_group' and a column 'bp_group_role'", 'import-users-from-csv-with-meta' ); ?></li>
139
+ <li><?php _e( "Then in each cell you have to fill with the BuddyPress <strong>group slug</strong>", 'import-users-from-csv-with-meta' ); ?></li>
140
+ <li><?php _e( "And the role assigned in this group:", 'import-users-from-csv-with-meta' ); ?> <em>Administrator, Moderator or Member</em></li>
141
+ <li><?php _e( "You can also use group ids if you know it using a column 'bp_group_id' instead of 'bp_group'", 'import-users-from-csv-with-meta' ); ?></li>
142
+ <li><?php _e( "You can do it with multiple groups at the same time using commas to separate different groups, in bp_group column, i.e.: <em>group_1, group_2, group_3</em>", 'import-users-from-csv-with-meta' ); ?></li>
143
+ <li><?php _e( "But you will have to assign a role for each group:", 'import-users-from-csv-with-meta' ); ?> <em>Moderator,Moderator,Member,Member</em></li>
144
+ <li><?php _e( "If you choose to update roles and group role is empty, user will be removed from the group", 'import-users-from-csv-with-meta' ); ?></li>
145
+ <li><?php _e( "If you get some error of this kind:", 'import-users-from-csv-with-meta' ); ?> <code>Fatal error: Class 'BP_XProfile_Group'</code> <?php _e( "please enable Buddypress Extended Profile then import the csv file. You can then disable this afterwards", 'import-users-from-csv-with-meta' ); ?></li>
146
+ </ul>
147
+ </td>
148
+ </tr>
149
+ <?php
150
+ }
151
+
152
+ function export_columns( $row ){
153
+ foreach ( $this->fields as $key ) {
154
+ $row[] = $key;
155
+ }
156
+
157
+ $row[] = 'bp_group_id';
158
+ $row[] = 'bp_member_type';
159
+
160
+ return $row;
161
+ }
162
+
163
+ function export_data( $row, $user ){
164
+ foreach ( $this->fields as $key ) {
165
+ $row[] = xprofile_get_field_data( $key, $user, 'comma' );
166
+ }
167
+
168
+ $row[] = $this->get_groups( $user );
169
+ $row[] = $this->get_member_type( $user );
170
+
171
+ return $row;
172
+ }
173
+
174
+ function import( $headers, $row, $user_id, $role, $positions, $form_data ){
175
+ $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
176
+
177
+ foreach( $this->fields as $field ){
178
+ $pos = array_search( $field, $headers );
179
+
180
+ if( $pos === FALSE )
181
+ continue;
182
+
183
+ switch( $this->get_field_type( $field ) ){
184
+ case 'datebox':
185
+ $date = $row[$pos];
186
+ switch( true ){
187
+ case is_numeric( $date ):
188
+ $UNIX_DATE = ($date - 25569) * 86400;
189
+ $datebox = gmdate("Y-m-d H:i:s", $UNIX_DATE);break;
190
+ case preg_match('/(\d{1,2})[\/-](\d{1,2})[\/-]([4567890]{1}\d{1})/',$date,$match):
191
+ $match[3]='19'.$match[3];
192
+ case preg_match('/(\d{1,2})[\/-](\d{1,2})[\/-](20[4567890]{1}\d{1})/',$date,$match):
193
+ case preg_match('/(\d{1,2})[\/-](\d{1,2})[\/-](19[4567890]{1}\d{1})/',$date,$match):
194
+ $datebox= ($match[3].'-'.$match[2].'-'.$match[1]);
195
+ break;
196
+
197
+ default:
198
+ $datebox = $date;
199
+ }
200
+
201
+ $datebox = strtotime( $datebox );
202
+ xprofile_set_field_data( $field, $user_id, date( 'Y-m-d H:i:s', $datebox ) );
203
+ unset( $datebox );
204
+ break;
205
+
206
+ case 'checkbox':
207
+ xprofile_set_field_data( $field, $user_id, explode( ',', $row[ $pos ] ) );
208
+ break;
209
+
210
+ default:
211
+ xprofile_set_field_data( $field, $user_id, $row[$pos] );
212
+ }
213
+ }
214
+
215
+ $pos_bp_group = array_search( 'bp_group', $headers );
216
+ $pos_bp_group_id = array_search( 'bp_group_id', $headers );
217
+ $pos_bp_group_role = array_search( 'bp_group_role', $headers );
218
+
219
+ if( $pos_bp_group !== FALSE ){
220
+ $groups = explode( ',', $row[ $pos_bp_group ] );
221
+ $groups_role = explode( ',', $row[ $pos_bp_group_role ] );
222
+
223
+ for( $j = 0; $j < count( $groups ); $j++ ){
224
+ $group_id = BP_Groups_Group::group_exists( $groups[ $j ] );
225
+
226
+ if( !empty( $group_id ) ){
227
+ $this->add_user_group( $user_id, $group_id, $groups_role[ $j ], $update_roles_existing_users );
228
+ }
229
+ }
230
+ }
231
+
232
+ if( $pos_bp_group_id !== FALSE ){
233
+ $groups_id = explode( ',', $row[ $pos_bp_group_id ] );
234
+ $groups_role = explode( ',', $row[ $pos_bp_group_role ] );
235
+
236
+ for( $j = 0; $j < count( $groups_id ); $j++ ){
237
+ $group_id = intval( $groups_id[ $j ] );
238
+
239
+ if( !empty( $group_id ) ){
240
+ $this->add_user_group( $user_id, $group_id, $groups_role[ $j ], $update_roles_existing_users );
241
+ }
242
+ }
243
+ }
244
+
245
+ $pos_member_type = array_search( 'bp_member_type', $headers );
246
+ if( $pos_member_type !== FALSE ){
247
+ bp_set_member_type( $user_id, $row[$pos_member_type] );
248
+ }
249
+ }
250
+
251
+ function add_user_group( $user_id, $group_id, $group_role, $update_roles_existing_users ){
252
+ if( $update_roles_existing_users == 'yes' || $update_roles_existing_users == 'yes_no_override' ){
253
+ $member = new BP_Groups_Member( $user_id, $group_id );
254
+ $member->remove();
255
+ }
256
+
257
+ if( ( $update_roles_existing_users == 'yes' || $update_roles_existing_users == 'yes_no_override' ) && empty( $group_role ) )
258
+ return;
259
+
260
+ groups_join_group( $group_id, $user_id );
261
+
262
+ if( $group_role == 'Moderator' ){
263
+ groups_promote_member( $user_id, $group_id, 'mod' );
264
+ }
265
+ elseif( $group_role == 'Administrator' ){
266
+ groups_promote_member( $user_id, $group_id, 'admin' );
267
+ }
268
+ }
269
+
270
+ function import_avatar( $headers, $row, $user_id ){
271
+ $pos = array_search( 'bp_avatar', $headers );
272
+
273
+ if( $pos === FALSE )
274
+ return;
275
+
276
+ $this->import_avatar_raw( $user_id, $row[ $pos ] );
277
+ }
278
+
279
+ function import_avatar_raw( $user_id, $source ){
280
+ $avatar_dir = bp_core_avatar_upload_path() . '/avatars';
281
+
282
+ if ( ! file_exists( $avatar_dir ) ) {
283
+ if ( ! wp_mkdir_p( $avatar_dir ) ) {
284
+ return false;
285
+ }
286
+ }
287
+
288
+ $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', $avatar_dir . '/' . $user_id, $user_id, 'user', 'avatars' );
289
+
290
+ if ( ! is_dir( $avatar_folder_dir ) ) {
291
+ if ( ! wp_mkdir_p( $avatar_folder_dir ) ) {
292
+ return false;
293
+ }
294
+ }
295
+
296
+ $original_file = $avatar_folder_dir . '/import-export-users-customers-bp-avatar-' . $user_id . '.png';
297
+ $data = ( (string)(int)$source == $source ) ? file_get_contents( get_attached_file( $source ) ) : file_get_contents( $source );
298
+
299
+ if ( file_put_contents( $original_file, $data ) ) {
300
+ $avatar_to_crop = str_replace( bp_core_avatar_upload_path(), '', $original_file );
301
+
302
+ $crop_args = array(
303
+ 'item_id' => $user_id,
304
+ 'original_file' => $avatar_to_crop,
305
+ 'crop_x' => 0,
306
+ 'crop_y' => 0,
307
+ );
308
+
309
+ return bp_core_avatar_handle_crop( $crop_args );
310
+ } else {
311
+ return false;
312
+ }
313
+ }
314
+ }
315
+ $acui_buddypress = new ACUI_Buddypress();
316
+ $acui_buddypress->hooks();
trunk/addons/customer-area.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'customer-area/customer-area.php' ) || !is_plugin_active( 'customer-area-managed-groups/customer-area-managed-groups.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_CustomerArea{
10
+ function __construct(){
11
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'after_plugins_activated' ) );
13
+ add_action( 'post_acui_import_single_user', array( $this, 'post_import_single_user' ), 10, 3 );
14
+ }
15
+
16
+ function restricted_fields( $acui_restricted_fields ){
17
+ return array_merge( $acui_restricted_fields, array( 'customer_area_groups' ) );
18
+ }
19
+
20
+ function after_plugins_activated(){
21
+ ?>
22
+ <tr valign="top">
23
+ <th scope="row"><?php _e( "WP Customer Area Managed Groups is activated", 'import-users-from-csv-with-meta' ); ?></th>
24
+ <td>
25
+ <?php _e( "You can import user groups and assign them to the users using the next format", 'import-users-from-csv-with-meta' ); ?>.
26
+ <ul style="list-style:disc outside none; margin-left:2em;">
27
+ <li><?php _e( "customer_area_groups as the column title", 'import-users-from-csv-with-meta' ); ?></li>
28
+ <li><?php _e( "The value of each cell will be the slug of the group", 'import-users-from-csv-with-meta' ); ?></li>
29
+ <li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
30
+ </ul>
31
+ </td>
32
+ </tr>
33
+ <?php
34
+ }
35
+
36
+ function post_import_single_user( $headers, $row, $user_id ){
37
+ $pos = array_search( 'customer_area_groups', $headers );
38
+
39
+ if( $pos === FALSE )
40
+ return;
41
+
42
+ $user_groups = explode( ',', $row[ $pos ] );
43
+ $user_groups = array_filter( $user_groups, function( $value ){ return $value !== ''; } );
44
+ $new_group_ids = array();
45
+
46
+ foreach ( $user_groups as $user_group ) {
47
+ $group = get_page_by_path( $user_group, OBJECT, 'cuar_user_group' );
48
+
49
+ if( is_object( $group ) )
50
+ $new_group_ids[] = $group->ID;
51
+ else{
52
+ echo "$group is not a name of a group in Customer Area<br/>";
53
+ return;
54
+ }
55
+ }
56
+
57
+ $object_addon = new CUAR_UserGroupAddOn();
58
+ $user_groups = $object_addon->get_groups_of_user( $user_id );
59
+
60
+ // Remove from current groups that are not selected anymore
61
+ foreach ( $user_groups as $group ) {
62
+ if ( !in_array( $group->ID, $new_group_ids ) ) {
63
+ $object_addon->remove_user_from_group( $user_id, $group->ID );
64
+ }
65
+ }
66
+
67
+ // Add to all groups
68
+ foreach ( $new_group_ids as $new_group_id ) {
69
+ $object_addon->add_user_to_group( $user_id, $new_group_id );
70
+ }
71
+ }
72
+ }
trunk/addons/groups.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'groups/groups.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_Groups{
10
+ function __construct(){
11
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
13
+ add_action( 'post_acui_import_single_user', array( $this, 'import_single_user' ), 10, 3 );
14
+ add_action( 'post_acui_import_single_user', array( $this, 'import_single_user_by_name' ), 11, 3 );
15
+ }
16
+
17
+ function restricted_fields( $acui_restricted_fields ){
18
+ return array_merge( $acui_restricted_fields, array( 'group_id' ) );
19
+ }
20
+
21
+ function documentation(){
22
+ ?>
23
+ <tr valign="top">
24
+ <th scope="row"><?php _e( "Groups is activated", 'import-users-from-csv-with-meta' ); ?></th>
25
+ <td>
26
+ <?php _e( "You can import user and assign them to the users groups using the next format", 'import-users-from-csv-with-meta' ); ?>.
27
+ <ul style="list-style:disc outside none; margin-left:2em;">
28
+ <li><?php _e( "group_id as the column title", 'import-users-from-csv-with-meta' ); ?></li>
29
+ <li><?php _e( "The value of each cell will be the ID of the group that you want to assign to this user", 'import-users-from-csv-with-meta' ); ?></li>
30
+ <li><?php _e( "Another option is use group_name as the column title", 'import-users-from-csv-with-meta' ); ?></li>
31
+ <li><?php _e( "The value of each cell will be the name of the group that you want to assign to this user", 'import-users-from-csv-with-meta' ); ?></li>
32
+ <li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
33
+ </ul>
34
+ </td>
35
+ </tr>
36
+ <?php
37
+ }
38
+
39
+ function import_single_user( $headers, $row, $user_id ){
40
+ $pos = array_search( 'group_id', $headers );
41
+
42
+ if( $pos === FALSE )
43
+ return;
44
+
45
+ // groups that appears in the CSV
46
+ $user_groups_csv = explode( ',', $row[ $pos ] );
47
+ $user_groups_csv = array_filter( $user_groups_csv, function( $value ){ return $value !== ''; } );
48
+
49
+ // groups that user belongs to
50
+ $groups_user = new Groups_User( $user_id );
51
+ $user_group_ids = $groups_user->group_ids;
52
+
53
+ $this->add_groups_user( $user_id, $user_groups_csv );
54
+ }
55
+
56
+ function import_single_user_by_name( $headers, $row, $user_id ){
57
+ $pos = array_search( 'group_name', $headers );
58
+
59
+ if( $pos === FALSE )
60
+ return;
61
+
62
+ // groups that appears in the CSV
63
+ $user_groups_name_csv = explode( ',', $row[ $pos ] );
64
+ $user_groups_name_csv = array_filter( $user_groups_name_csv, function( $value ){ return $value !== ''; } );
65
+ $user_groups_csv = array();
66
+
67
+ foreach ( $user_groups_name_csv as $user_group_name_csv ) {
68
+ $group = Groups_Group::read_by_name( $user_group_name_csv );
69
+ $user_groups_csv[] = $group->group_id;
70
+ }
71
+
72
+ $this->add_groups_user( $user_id, $user_groups_csv );
73
+ }
74
+
75
+ function add_groups_user( $user_id, $user_groups_csv ){
76
+ // groups that user belongs to
77
+ $groups_user = new Groups_User( $user_id );
78
+ $user_group_ids = empty( $groups_user->group_ids ) ? array() : $groups_user->group_ids;
79
+
80
+ // first we look into all current user groups, if they do not appear in CSV it will be removed
81
+ foreach ( $user_group_ids as $user_group_id ) {
82
+ if( !in_array( $user_group_id, $user_groups_csv ) )
83
+ Groups_User_Group::delete( $user_id, $user_group_id );
84
+ }
85
+
86
+ // finally we loop into groups that are present in CSV data, if they already exists, we do nothing, if not, we add it
87
+ foreach ( $user_groups_csv as $user_group_csv ) {
88
+ if( !in_array( $user_group_csv, $user_group_ids ) )
89
+ Groups_User_Group::create( array( 'user_id' => $user_id, 'group_id' => $user_group_csv ) );
90
+ }
91
+ }
92
+ }
93
+
94
+ new ACUI_Groups();
trunk/addons/indeed-ultimate-membership-pro.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'indeed-membership-pro/indeed-membership-pro.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_IndeedMemberShipPro{
10
+ function __construct(){
11
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
13
+ add_action( 'post_acui_import_single_user', array( $this, 'import_single_user' ), 10, 3 );
14
+ }
15
+
16
+ function fields(){
17
+ return array( "level" );
18
+ }
19
+
20
+ function restricted_fields( $acui_restricted_fields ){
21
+ return array_merge( $acui_restricted_fields, $this->fields() );
22
+ }
23
+
24
+ function documentation(){
25
+ ?>
26
+ <tr valign="top">
27
+ <th scope="row"><?php _e( "Indeed Ultimate Membership Pro is activated", 'import-users-from-csv-with-meta' ); ?></th>
28
+ <td>
29
+ <?php _e( "You can use the columns in the CSV in order to import data from Indeed Ultimate Membership Pro.", 'import-users-from-csv-with-meta' ); ?>.
30
+ <ul style="list-style:disc outside none; margin-left:2em;">
31
+ <li>level: you have to use the level id, you can find it in "Levels" tab</li>
32
+ </ul>
33
+ </td>
34
+ </tr>
35
+ <?php
36
+ }
37
+
38
+ function import_single_user( $headers, $row, $user_id ){
39
+ global $wpdb;
40
+
41
+ $keys = $this->fields();
42
+ $columns = array();
43
+
44
+ foreach ( $keys as $key ) {
45
+ $pos = array_search( $key, $headers );
46
+
47
+ if( $pos !== FALSE ){
48
+ $columns[ $key ] = $pos;
49
+ $$key = $row[ $columns[ $key ] ];
50
+ }
51
+ }
52
+
53
+ if( !empty( $level ) )
54
+ $level = ihc_do_complete_level_assign_from_ap( $user_id, $level );
55
+ }
56
+ }
57
+
58
+ new ACUI_IndeedMemberShipPro();
trunk/addons/learndash.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !class_exists( 'SFWD_LMS' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_LearnDash{
10
+ function __construct(){
11
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
13
+ }
14
+
15
+ function restricted_fields( $acui_restricted_fields ){
16
+ return array_merge( $acui_restricted_fields, array( 'lms_courses' ) );
17
+ }
18
+
19
+ function documentation(){
20
+ ?>
21
+ <tr valign="top">
22
+ <th scope="row"><?php _e( "LearnDash is activated", 'import-users-from-csv-with-meta' ); ?></th>
23
+ <td>
24
+ <?php _e( "This plugin lets you bulk import users into Learndash courses:", 'import-users-from-csv-with-meta' ); ?>.
25
+ <ul style="list-style:disc outside none; margin-left:2em;">
26
+ <li><?php _e( "Column ", 'import-users-from-csv-with-meta' ); ?> lms_courses: <?php _e( "You have to specify the course IDs you want to enrol a specific user into", 'import-users-from-csv-with-meta' ); ?></li>
27
+ <li><?php _e( "You also need to create, for each course, the respective ", 'import-users-from-csv-with-meta' ); ?> course_courseID_access_from <?php _e( "where courseID needs to be replaced (as column header) with the same id you used in lms_courses, and the column cells populated with a string such as the one you will find in the metakey section of the plugin looking for that particular metakey (course_courseID_access_from).
28
+ This is because Learndash needs to know when a user was enrolled to which course.", 'import-users-from-csv-with-meta' ); ?></li>
29
+ </ul>
30
+ <span class="description"><?php _e( "Thanks to @prangesco who explain us how to do it", 'import-users-from-csv-with-meta' ); ?></span>
31
+ </td>
32
+ </tr>
33
+ <?php
34
+ }
35
+ }
36
+
37
+ new ACUI_LearnDash();
trunk/addons/mailpoet.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'mailpoet/mailpoet.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_filter( 'acui_restricted_fields', 'acui_mp_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_mp_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_mp_post_import_single_user', 10, 3 );
12
+
13
+ function acui_mp_restricted_fields( $acui_restricted_fields ){
14
+ return array_merge( $acui_restricted_fields, array( 'mailpoet_list_ids' ) );
15
+ }
16
+
17
+ function acui_mp_documentation_after_plugins_activated(){
18
+ ?>
19
+ <tr valign="top">
20
+ <th scope="row"><?php _e( "MailPoet is activated", 'import-users-from-csv-with-meta' ); ?></th>
21
+ <td>
22
+ <ol>
23
+ <li><strong><?php _e( "Subscribe users to MailPoet lists", 'import-users-from-csv-with-meta' ); ?></strong>: <?php _e( "In this case you will only have to use <strong>mailpoet_list_ids</strong> column in order to associate a user to their users list, you can use a ID or a list of IDs separated by commas", 'import-users-from-csv-with-meta' ); ?>.</li>
24
+ </ol>
25
+ </td>
26
+ </tr>
27
+ <?php
28
+ }
29
+
30
+ function acui_mp_post_import_single_user( $headers, $row, $user_id ){
31
+ if ( !class_exists(\MailPoet\API\API::class) ) {
32
+ return;
33
+ }
34
+
35
+ $mailpoet_api = \MailPoet\API\API::MP('v1');
36
+ $pos = array_search( 'mailpoet_list_ids', $headers );
37
+
38
+ if( $pos === FALSE )
39
+ return;
40
+
41
+ $mailpoet_list_ids = explode( ',', $row[ $pos ] );
42
+ $mailpoet_list_ids = array_filter( $mailpoet_list_ids, function( $value ){ return $value !== ''; } );
43
+
44
+ $user = get_userdata( $user_id );
45
+
46
+ if( !$user )
47
+ return;
48
+
49
+ try {
50
+ $resultado = $mailpoet_api->subscribeToLists( $user->user_email, $mailpoet_list_ids );
51
+ } catch (Exception $e) { }
52
+ }
trunk/addons/new-user-approve.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'new-user-approve/new-user-approve.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_action( 'acui_tab_import_before_import_button', 'acui_new_user_approve_tab_import_before_import_button' );
10
+ function acui_new_user_approve_tab_import_before_import_button(){
11
+ ?>
12
+ <h2><?php _e( 'New User Approve compatibility', 'import-users-from-csv-with-meta'); ?></h2>
13
+
14
+ <table class="form-table">
15
+ <tbody>
16
+ <tr class="form-field form-required">
17
+ <th scope="row"><label><?php _e( 'Approve users at the same time is being created', 'import-users-from-csv-with-meta' ); ?></label></th>
18
+ <td>
19
+ <select name="approve_users_new_user_appove">
20
+ <option value="no_approve"><?php _e( 'Do not approve users', 'import-users-from-csv-with-meta' ); ?></option>
21
+ <option value="approve"><?php _e( 'Approve users when they are being imported', 'import-users-from-csv-with-meta' ); ?></option>
22
+ </select>
23
+
24
+ <p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://es.wordpress.org/plugins/new-user-approve/"><?php _e( 'New User Approve', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta' ); ?></strong>.</p>
25
+ </td>
26
+ </tr>
27
+ </tbody>
28
+ </table>
29
+ <?php
30
+ }
31
+
32
+ add_action( 'post_acui_import_single_user', 'acui_new_user_post_acui_import_single_user', 10, 6 );
33
+ function acui_new_user_post_acui_import_single_user( $headers, $data, $user_id, $role, $positions, $form_data ){
34
+ $approve_users_new_user_approve = ( empty( $form_data["approve_users_new_user_appove"] ) ) ? "no_approve" : sanitize_text_field( $form_data["approve_users_new_user_appove"] );
35
+ if( $approve_users_new_user_approve == "approve" ){
36
+ update_user_meta( $user_id, "pw_user_status", "approved" );
37
+ }
38
+ else{
39
+ update_user_meta( $user_id, "pending", true );
40
+ }
41
+ }
trunk/addons/paid-member-subscriptions.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ if( !is_plugin_active( 'paid-member-subscriptions/index.php' ) ){
5
+ return;
6
+ }
7
+
8
+ class ACUI_PaidMemberSubscriptions{
9
+ function __construct(){
10
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
11
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
12
+ add_action( 'post_acui_import_single_user', array( $this, 'assign' ), 10, 4 );
13
+ }
14
+
15
+ function get_fields(){
16
+ return array( 'subscription_plan_id', 'start_date', 'expiration_date', 'status' );
17
+ }
18
+
19
+ function restricted_fields( $acui_restricted_fields ){
20
+ return array_merge( $acui_restricted_fields, $this->get_fields() );
21
+ }
22
+
23
+ function documentation(){
24
+ ?>
25
+ <tr valign="top">
26
+ <th scope="row"><?php _e( "Paid Member Subscriptions is activated", 'import-users-from-csv-with-meta' ); ?></th>
27
+ <td><?php _e( "Plugin can create member subscriptions while this is importing. You will need to use those columns:", 'import-users-from-csv-with-meta' ); ?>
28
+ <ul style="list-style:disc outside none; margin-left:2em;">
29
+ <li><?php _e( "<strong>subscription_plan_id</strong>: you can find it in Paid Member Subscriptions, Subscriptions Plans ", 'import-users-from-csv-with-meta' ); ?></li>
30
+ <li><?php _e( "<strong>start_date <em>(optional)</em></strong>: if you leave empty, current moment will be used, format is Y-m-d H:i:s", 'import-users-from-csv-with-meta' ); ?></li>
31
+ <li><?php _e( "<strong>expiration_date (optional)</strong>: if you leave it empty, no expired date will be defined", 'import-users-from-csv-with-meta' ); ?></li>
32
+ <li><?php _e( "<strong>status <em>(optional)</em></strong>: if you do not fill it, active will be used", 'import-users-from-csv-with-meta' ); ?></li>
33
+ </ul>
34
+ </td>
35
+ </tr>
36
+ <?php
37
+ }
38
+
39
+ function assign( $headers, $row, $user_id, $role ){
40
+ if( !class_exists( 'PMS_Member_Subscription' ) )
41
+ return;
42
+
43
+ $keys = $this->get_fields();
44
+ $columns = array();
45
+
46
+ $status = 'active';
47
+ $start_date = date('Y-m-d H:i:s');
48
+
49
+ foreach ( $keys as $key ) {
50
+ $pos = array_search( $key, $headers );
51
+
52
+ if( $pos !== FALSE ){
53
+ $columns[ $key ] = $pos;
54
+ $$key = $row[ $columns[ $key ] ];
55
+ }
56
+ }
57
+
58
+ if( !isset( $subscription_plan_id ) || empty( $subscription_plan_id ) )
59
+ return;
60
+
61
+ $subscription_data = array(
62
+ 'user_id' => $user_id,
63
+ 'subscription_plan_id' => $subscription_plan_id,
64
+ 'start_date' => $start_date,
65
+ 'status' => $status,
66
+ );
67
+
68
+ if( isset( $expiration_date ) && !empty( $expiration_date ) )
69
+ $subscription_data['expiration_date'] =$expiration_date;
70
+
71
+ $subscription = new PMS_Member_Subscription();
72
+ $subscription->insert( $subscription_data );
73
+ }
74
+ }
75
+ new ACUI_PaidMemberSubscriptions();
trunk/addons/pmpro.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'paid-memberships-pro/paid-memberships-pro.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_filter( 'acui_restricted_fields', 'acui_pmpro_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_pmpro_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_pmpro_post_import_single_user', 10, 3 );
12
+
13
+ function acui_pmpro_fields() {
14
+ $pmpro_fields = array(
15
+ "membership_id",
16
+ "membership_code_id",
17
+ "membership_discount_code",
18
+ "membership_initial_payment",
19
+ "membership_billing_amount",
20
+ "membership_cycle_number",
21
+ "membership_cycle_period",
22
+ "membership_billing_limit",
23
+ "membership_trial_amount",
24
+ "membership_trial_limit",
25
+ "membership_status",
26
+ "membership_startdate",
27
+ "membership_enddate",
28
+ "membership_subscription_transaction_id",
29
+ "membership_payment_transaction_id",
30
+ "membership_gateway",
31
+ "membership_affiliate_id",
32
+ "membership_timestamp"
33
+ );
34
+
35
+ return $pmpro_fields;
36
+ }
37
+
38
+ function acui_pmpro_restricted_fields( $acui_restricted_fields ){
39
+ return array_merge( $acui_restricted_fields, acui_pmpro_fields() );
40
+ }
41
+
42
+ function acui_pmpro_documentation_after_plugins_activated(){
43
+ ?>
44
+ <tr valign="top">
45
+ <th scope="row"><?php _e( "Paid Mebership Pro is activated", 'import-users-from-csv-with-meta' ); ?></th>
46
+ <td>
47
+ <?php _e( "You can use the columns in the CSV in order to import data from Paid Membership Pro plugin.", 'import-users-from-csv-with-meta' ); ?>.
48
+ <ul style="list-style:disc outside none; margin-left:2em;">
49
+ <?php foreach ( acui_pmpro_fields() as $key => $value): ?>
50
+ <li><?php echo $value; ?></li>
51
+ <?php endforeach; ?>
52
+ </ul>
53
+ </td>
54
+ </tr>
55
+ <?php
56
+ }
57
+
58
+ function acui_pmpro_post_import_single_user( $headers, $row, $user_id ){
59
+ global $wpdb;
60
+
61
+ $keys = acui_pmpro_fields();
62
+ $columns = array();
63
+
64
+ foreach ( $keys as $key ) {
65
+ $pos = array_search( $key, $headers );
66
+
67
+ if( $pos !== FALSE ){
68
+ $columns[ $key ] = $pos;
69
+ $$key = $row[ $columns[ $key ] ];
70
+ }
71
+ }
72
+
73
+ if( !empty( $membership_startdate ) )
74
+ $membership_startdate = date( "Y-m-d", strtotime( $membership_startdate, current_time( 'timestamp' ) ) );
75
+
76
+ if( !empty( $membership_enddate ) )
77
+ $membership_enddate = date( "Y-m-d", strtotime( $membership_enddate, current_time( 'timestamp' ) ) );
78
+ else
79
+ $membership_enddate = "NULL";
80
+
81
+ if( !empty( $membership_timestamp ) )
82
+ $membership_timestamp = date( "Y-m-d", strtotime( $membership_timestamp, current_time( 'timestamp' ) ) );
83
+
84
+ if( !empty( $membership_discount_code ) && empty( $membership_code_id ) )
85
+ $membership_code_id = $wpdb->get_var( "SELECT id FROM $wpdb->pmpro_discount_codes WHERE `code` = '" . esc_sql( $membership_discount_code ) . "' LIMIT 1" );
86
+
87
+ //change membership level
88
+ if( !empty( $membership_id ) )
89
+ {
90
+ $custom_level = array(
91
+ 'user_id' => $user_id,
92
+ 'membership_id' => $membership_id,
93
+ 'code_id' => $membership_code_id,
94
+ 'initial_payment' => $membership_initial_payment,
95
+ 'billing_amount' => $membership_billing_amount,
96
+ 'cycle_number' => $membership_cycle_number,
97
+ 'cycle_period' => $membership_cycle_period,
98
+ 'billing_limit' => $membership_billing_limit,
99
+ 'trial_amount' => $membership_trial_amount,
100
+ 'trial_limit' => $membership_trial_limit,
101
+ 'status' => $membership_status,
102
+ 'startdate' => $membership_startdate,
103
+ 'enddate' => $membership_enddate
104
+ );
105
+
106
+ pmpro_changeMembershipLevel( $custom_level, $user_id );
107
+
108
+ //if membership was in the past make it inactive
109
+ if( $membership_status === "inactive" || ( !empty( $membership_enddate ) && $membership_enddate !== "NULL" && strtotime( $membership_enddate, current_time('timestamp') ) < current_time('timestamp') ) ){
110
+ $sqlQuery = "UPDATE $wpdb->pmpro_memberships_users SET status = 'inactive' WHERE user_id = '" . $user_id . "' AND membership_id = '" . $membership_id . "'";
111
+ $wpdb->query( $sqlQuery );
112
+ $membership_in_the_past = true;
113
+ }
114
+
115
+ if( $membership_status === "active" && ( empty( $membership_enddate ) || $membership_enddate === "NULL" || strtotime( $membership_enddate, current_time('timestamp') ) >= current_time('timestamp') ) ){
116
+ $sqlQuery = $wpdb->prepare( "UPDATE {$wpdb->pmpro_memberships_users} SET status = 'active' WHERE user_id = %d AND membership_id = %d", $user_id, $membership_id );
117
+ $wpdb->query( $sqlQuery );
118
+ }
119
+ }
120
+
121
+ if( !empty( $membership_subscription_transaction_id ) && !empty( $membership_gateway ) || !empty( $membership_timestamp ) || !empty( $membership_code_id ) ){
122
+ $order = new MemberOrder();
123
+ $order->user_id = $user_id;
124
+ $order->membership_id = $membership_id;
125
+ $order->InitialPayment = $membership_initial_payment;
126
+ $order->payment_transaction_id = $membership_payment_transaction_id;
127
+ $order->subscription_transaction_id = $membership_subscription_transaction_id;
128
+ $order->affiliate_id = $membership_affiliate_id;
129
+ $order->gateway = $membership_gateway;
130
+
131
+ if( !empty( $membership_in_the_past ) )
132
+ $order->status = "cancelled";
133
+
134
+ $order->saveOrder();
135
+
136
+ if( !empty( $membership_timestamp ) ){
137
+ $timestamp = strtotime( $membership_timestamp, current_time('timestamp') );
138
+ $order->updateTimeStamp( date( "Y", $timestamp ), date( "m", $timestamp ), date( "d", $timestamp ), date( "H:i:s", $timestamp ) );
139
+ }
140
+ }
141
+
142
+ if( !empty( $membership_code_id ) && !empty( $order ) && !empty( $order->id ) )
143
+ $wpdb->query( "INSERT INTO $wpdb->pmpro_discount_codes_uses (code_id, user_id, order_id, timestamp) VALUES('" . esc_sql( $membership_code_id ) . "', '" . esc_sql( $user_id ) . "', '" . intval( $order->id ) . "', now())" );
144
+ }
trunk/addons/users-group.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'user-groups/user-groups.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_filter( 'acui_restricted_fields', 'acui_ug_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_ug_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_ug_post_import_single_user', 10, 3 );
12
+
13
+ function acui_ug_restricted_fields( $acui_restricted_fields ){
14
+ return array_merge( $acui_restricted_fields, array( 'user_group' ) );
15
+ }
16
+
17
+ function acui_ug_documentation_after_plugins_activated(){
18
+ ?>
19
+ <tr valign="top">
20
+ <th scope="row"><?php _e( "WP Users Group is activated", 'import-users-from-csv-with-meta' ); ?></th>
21
+ <td>
22
+ <?php _e( "You can import user groups and assign them to the users using the next format", 'import-users-from-csv-with-meta' ); ?>.
23
+ <ul style="list-style:disc outside none; margin-left:2em;">
24
+ <li><?php _e( "user_group as the column title", 'import-users-from-csv-with-meta' ); ?></li>
25
+ <li><?php _e( "The value of each cell will be the name of the user group (do not use slugs)", 'import-users-from-csv-with-meta' ); ?></li>
26
+ <li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
27
+ </ul>
28
+ </td>
29
+ </tr>
30
+ <?php
31
+ }
32
+
33
+ function acui_ug_post_import_single_user( $headers, $row, $user_id ){
34
+ $pos = array_search( 'user_group', $headers );
35
+
36
+ if( $pos === FALSE )
37
+ return;
38
+
39
+ $user_groups = explode( ',', $row[ $pos ] );
40
+ $user_groups = array_filter( $user_groups, function( $value ){ return $value !== ''; } );
41
+
42
+ $taxonomy = 'user-group';
43
+ $terms = array();
44
+
45
+ foreach ( $user_groups as $user_group ) {
46
+ $term = get_term_by( 'name', $user_group , $taxonomy );
47
+
48
+ if( $term == false ){
49
+ $term = wp_insert_term( $user_group, $taxonomy);
50
+ $terms[] = $term['term_id'];
51
+ }else{
52
+ $terms[] = $term->term_id;
53
+ }
54
+ }
55
+
56
+ wp_set_object_terms( $user_id, $terms, $taxonomy, false );
57
+ clean_object_term_cache( $user_id, $taxonomy );
58
+ }
trunk/addons/woocommerce-custom-fields.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'woocommerce-custom-fields/woocommerce-custom-fields.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_WCF{
10
+ function __construct(){
11
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
12
+ add_filter( 'acui_not_meta_fields', array( $this, 'restricted_fields' ), 10, 1 );
13
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
14
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
15
+ }
16
+
17
+ function get_fields(){
18
+ $customer_fields = get_posts( array(
19
+ 'post_type' => 'wccf_user_field',
20
+ 'posts_per_page' => -1,
21
+ ) );
22
+
23
+ $result = array();
24
+
25
+ foreach ( $customer_fields as $custom_field ) {
26
+ $result[ $custom_field->ID ] = get_post_meta( $custom_field->ID, 'key', true );
27
+ }
28
+
29
+ return $result;
30
+ }
31
+
32
+ function documentation(){
33
+ ?>
34
+ <tr valign="top">
35
+ <th scope="row"><?php _e( "WooCommerce Custom Fields is activated", 'import-users-from-csv-with-meta' ); ?></th>
36
+ <td>
37
+ <?php _e( "You can import those fields, look at fields you can import using the column names shown below.", 'import-users-from-csv-with-meta' ); ?>.
38
+ <ul style="list-style:square inside none; margin-left:2em;">
39
+ <?php foreach ( $this->get_fields() as $field => $field_id): ?>
40
+ <li><?php echo $field; ?></li>
41
+ <?php endforeach; ?>
42
+ </ul>
43
+ </td>
44
+ </tr>
45
+ <?php
46
+ }
47
+
48
+ function restricted_fields( $acui_restricted_fields ){
49
+ return array_merge( $acui_restricted_fields, array_keys( $this->get_fields() ) );
50
+ }
51
+
52
+ function import( $headers, $row, $user_id ){
53
+ $context = 'user_field';
54
+ $columns = array();
55
+ $data = array();
56
+
57
+ foreach ( $this->get_fields() as $key => $value ) {
58
+ $pos = array_search( $value, $headers );
59
+
60
+ if( $pos !== FALSE ){
61
+ $columns[ $value ] = $pos;
62
+ $data[ $value ] = $row[ $columns[ $value ] ];
63
+ }
64
+ }
65
+
66
+ $values = array();
67
+ foreach ( $this->get_fields() as $key => $value ) {
68
+ $values[ $key ] = array( 'value' => $data[ $value ], 'data' => array(), 'files' => array() );
69
+ }
70
+
71
+ $item = RightPress_Help::wc_get_customer( $user_id );
72
+
73
+ if( empty( $values ) || !is_array( $values ) ){
74
+ return;
75
+ }
76
+
77
+ foreach( $values as $field_id => $field_value ) {
78
+ $field = WCCF_Field_Controller::get( $field_id, 'wccf_' . $context );
79
+
80
+ if ( !$field ) {
81
+ continue;
82
+ }
83
+
84
+ $field->store_value( $item, $field_value );
85
+ }
86
+
87
+ $item->save();
88
+ }
89
+ }
90
+
91
+ new ACUI_WCF();
trunk/addons/woocommerce-membership-rightpress.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'woocommerce-membership/woocommerce-membership.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_filter( 'acui_restricted_fields', 'acui_wmr_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_wmr_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_wmr_post_import_single_user', 10, 3 );
12
+
13
+ function acui_wmr_restricted_fields( $acui_restricted_fields ){
14
+ return array_merge( $acui_restricted_fields, array( 'plan_id' ) );
15
+ }
16
+
17
+ function acui_wmr_documentation_after_plugins_activated(){
18
+ ?>
19
+ <tr valign="top">
20
+ <th scope="row"><?php _e( "WooCommerce Membership by RightPress is activated", 'import-users-from-csv-with-meta' ); ?></th>
21
+ <td>
22
+ <ol>
23
+ <li><strong><?php _e( "Add users to membership plans", 'import-users-from-csv-with-meta' ); ?></strong>: <?php _e( "In this case you will only have to use <strong>plan_id</strong> column in order to associate a user to their membership plan", 'import-users-from-csv-with-meta' ); ?>.</li>
24
+ </ol>
25
+ </td>
26
+ </tr>
27
+ <?php
28
+ }
29
+
30
+ function acui_wmr_post_import_single_user( $headers, $row, $user_id ){
31
+ $pos = array_search( 'plan_id', $headers );
32
+
33
+ if( $pos === FALSE )
34
+ return;
35
+
36
+ $plan_id = absint( $row[ $pos ] );
37
+ $resultado = WooCommerce_Membership_Plan::add_member( $plan_id, $user_id );
38
+ }
trunk/addons/woocommerce-membership.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'woocommerce-memberships/woocommerce-memberships.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_filter( 'acui_restricted_fields', 'acui_wm_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_wm_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_wm_post_import_single_user', 10, 3 );
12
+
13
+ function acui_wm_restricted_fields( $acui_restricted_fields ){
14
+ return array_merge( $acui_restricted_fields, array( 'member_first_name', 'member_last_name', 'member_email', 'membership_plan_id', 'membership_plan_slug', 'membership_plan', 'membership_status', 'member_since', 'membership_expiration' ) );
15
+ }
16
+
17
+ function acui_wm_documentation_after_plugins_activated(){
18
+ ?>
19
+ <tr valign="top">
20
+ <th scope="row"><?php _e( "WooCommerce Memberships is activated", 'import-users-from-csv-with-meta' ); ?></th>
21
+ <td>
22
+ <ol>
23
+ <li><strong><?php _e( "Import all membership information", 'import-users-from-csv-with-meta' ); ?></strong>: <?php _e( "You can use the <strong>columns in the CSV format created by WooCommercer Membership</strong> in order to import data from this plugin.", 'import-users-from-csv-with-meta' ); ?>. <a href="https://docs.woocommerce.com/document/woocommerce-memberships-import-and-export/"><?php _e( "Read more about columns and formats", 'import-users-from-csv-with-meta' ); ?></a>.</li>
24
+ <li><strong><?php _e( "Add users to membership plans", 'import-users-from-csv-with-meta' ); ?></strong>: <?php _e( "In this case you will only have to use <strong>membership_plan_id</strong> column in order to associate a user to their membership plan", 'import-users-from-csv-with-meta' ); ?>.</li>
25
+ </ol>
26
+ </td>
27
+ </tr>
28
+ <?php
29
+ }
30
+
31
+ function acui_wm_post_import_single_user( $headers, $row, $user_id ){
32
+ $pos = array_search( 'membership_plan_id', $headers );
33
+
34
+ if( $pos === FALSE )
35
+ return;
36
+
37
+ $pos_member_last_name = array_search( 'member_last_name', $headers ); // we search if there is only membership_plan_id or if there are more data
38
+ $full_membership_import = ( $pos_member_last_name !== FALSE );
39
+
40
+ if( $full_membership_import ){
41
+ $keys = array( 'member_first_name', 'member_last_name', 'member_email', 'membership_plan_id', 'membership_plan_slug', 'membership_plan', 'membership_status', 'member_since', 'membership_expiration' );
42
+ $columns = array();
43
+
44
+ foreach ( $keys as $key ) {
45
+ $columns[ $key ] = array_search( $key, $headers );
46
+ }
47
+
48
+ $membership_plan_id = isset( $columns['membership_plan_id'] ) && ! empty( $row[ $columns['membership_plan_id'] ] ) ? (int) $row[ $columns['membership_plan_id'] ] : null;
49
+ $membership_plan_slug = isset( $columns['membership_plan_slug'] ) && ! empty( $row[ $columns['membership_plan_slug'] ] ) ? $row[ $columns['membership_plan_slug'] ] : null;
50
+ $membership_plan = null;
51
+
52
+ if ( is_int( $membership_plan_id ) ) {
53
+ $membership_plan = wc_memberships_get_membership_plan( $membership_plan_id );
54
+ }
55
+
56
+ if ( ! $membership_plan && ! empty( $membership_plan_slug ) ) {
57
+ $membership_plan = wc_memberships_get_membership_plan( $membership_plan_slug );
58
+ }
59
+
60
+ // try to get an existing user membership from an id
61
+ $user_membership_id = isset( $columns['user_membership_id'] ) && ! empty( $row[ $columns['user_membership_id'] ] ) ? (int) $row[ $columns['user_membership_id'] ] : null;
62
+ $existing_user_membership = is_int( $user_membership_id ) ? wc_memberships_get_user_membership( $user_membership_id ) : null;
63
+
64
+ if ( ! $membership_plan && ! $existing_user_membership ) {
65
+ return;
66
+ } elseif ( ! $existing_user_membership && false ) {
67
+ return;
68
+ }
69
+
70
+ $import_data = array();
71
+
72
+ $import_data['membership_plan_id'] = $membership_plan_id;
73
+ $import_data['membership_plan_slug'] = $membership_plan_slug;
74
+ $import_data['membership_plan_name'] = isset( $columns['membership_plan'] ) && ! empty( $row[ $columns['membership_plan'] ] ) ? $row[ $columns['membership_plan'] ] : null;
75
+ $import_data['membership_plan'] = $membership_plan;
76
+ $import_data['user_membership_id'] = $user_membership_id;
77
+ $import_data['user_membership'] = $existing_user_membership;
78
+ $import_data['user_id'] = $user_id;
79
+ $import_data['user_name'] = isset( $columns['user_name'] ) && ! empty( $row[ $columns['user_name'] ] ) ? $row[ $columns['user_name'] ] : null;
80
+ $import_data['product_id'] = isset( $columns['product_id'] ) && ! empty( $row[ $columns['product_id'] ] ) ? $row[ $columns['product_id'] ] : null;
81
+ $import_data['order_id'] = isset( $columns['order_id'] ) && ! empty( $row[ $columns['order_id'] ] ) ? $row[ $columns['order_id'] ] : null;
82
+ $import_data['member_email'] = isset( $columns['member_email'] ) && ! empty( $row[ $columns['member_email'] ] ) ? $row[ $columns['member_email'] ] : null;
83
+ $import_data['member_first_name'] = isset( $columns['member_first_name'] ) && ! empty( $row[ $columns['member_first_name'] ] ) ? $row[ $columns['member_first_name'] ] : null;
84
+ $import_data['member_last_name'] = isset( $columns['member_last_name'] ) && ! empty( $row[ $columns['member_last_name'] ] ) ? $row[ $columns['member_last_name'] ] : null;
85
+ $import_data['membership_status'] = isset( $columns['membership_status'] ) && ! empty( $row[ $columns['membership_status'] ] ) ? $row[ $columns['membership_status'] ] : null;
86
+ $import_data['member_since'] = isset( $columns['member_since'] ) && ! empty( $row[ $columns['member_since'] ] ) ? $row[ $columns['member_since'] ] : null;
87
+ $import_data['membership_expiration'] = isset( $columns['membership_expiration'] ) && isset( $row[ $columns['membership_expiration'] ] ) ? $row[ $columns['membership_expiration'] ] : null;
88
+
89
+ $action = 'create';
90
+ $import_data = (array) apply_filters( 'wc_memberships_csv_import_user_memberships_data', $import_data, $action, $columns, $row );
91
+
92
+ $user_membership = null;
93
+
94
+ if ( isset( $import_data['membership_plan'] ) && $import_data['membership_plan'] instanceof WC_Memberships_Membership_Plan ) {
95
+ if ( wc_memberships_is_user_member( $user_id, $import_data['membership_plan'] ) ) {
96
+ return false;
97
+ }
98
+
99
+ $user_membership = wc_memberships_create_user_membership( array(
100
+ 'user_membership_id' => 0,
101
+ 'plan_id' => $import_data['membership_plan']->get_id(),
102
+ 'user_id' => $user_id,
103
+ 'product_id' => ! empty( $import_data['product_id'] ) ? (int) $import_data['product_id'] : 0,
104
+ 'order_id' => ! empty( $import_data['order_id'] ) ? (int) $import_data['order_id'] : 0,
105
+ ), 'create' );
106
+ }
107
+
108
+ acui_vm_update_user_membership_meta( $user_membership, $action, $import_data );
109
+
110
+ do_action( 'wc_memberships_csv_import_user_membership', $user_membership, $action, $import_data, new StdClass() );
111
+ }
112
+ else{
113
+ $membership_plan_id = absint( $row[ $pos ] );
114
+ $args = array(
115
+ 'plan_id' => $membership_plan_id,
116
+ 'user_id' => $user_id,
117
+ );
118
+ wc_memberships_create_user_membership( $args );
119
+ }
120
+ }
121
+
122
+ function acui_vm_update_user_membership_meta( WC_Memberships_User_Membership $user_membership, $action, array $data ) {
123
+ if( !empty( $data['product_id'] ) ) {
124
+ $user_membership->set_product_id( trim( $data['product_id'] ) );
125
+ }
126
+
127
+ if( !empty( $data['order_id'] ) ) {
128
+ $user_membership->set_order_id( trim( $data['order_id'] ) );
129
+ }
130
+
131
+ if( !empty( $data['member_since'] ) ) {
132
+ $user_membership->set_start_date( trim( $data['member_since'] ) );
133
+ }
134
+
135
+ if( !empty( $data['membership_status'] ) ){
136
+ $user_membership->update_status( trim( $data['membership_status'] ) );
137
+ }
138
+
139
+ if( !empty( $data['membership_expiration'] ) ){
140
+ $user_membership->set_end_date( trim( $data['membership_expiration'] ) );
141
+ }
142
+ }
trunk/addons/woocommerce-subscriptions.php ADDED
@@ -0,0 +1,828 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ if( !is_plugin_active( 'woocommerce-subscriptions/woocommerce-subscriptions.php' ) ){
5
+ return;
6
+ }
7
+
8
+ class ACUI_WooCommerceSubscriptions{
9
+ private $all_virtual;
10
+
11
+ function __construct(){
12
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
13
+ add_action( 'acui_header_table_extra_rows', array( $this, 'header_table_extra_rows' ) );
14
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
15
+ add_action( 'after_acui_import_users', array( $this, 'end' ) );
16
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
17
+
18
+ $this->all_virtual = true;
19
+ }
20
+
21
+ function header_table_extra_rows(){
22
+ ?>
23
+ <th><?php _e( "WooCommerce Subscriptions import warnings", 'import-users-from-csv-with-meta' ); ?></th>
24
+ <th><?php _e( "WooCommerce Subscriptions import errors", 'import-users-from-csv-with-meta' ); ?></th>
25
+ <?php
26
+ }
27
+
28
+ function restricted_fields( $acui_restricted_fields ){
29
+ return array_merge( $acui_restricted_fields, $this->fields() );
30
+ }
31
+
32
+ function fields(){
33
+ return array_merge( $this->order_totals_fields(), array( 'subscription_status', 'start_date', 'trial_end_date', 'next_payment_date', 'end_date', 'billing_period', 'billing_interval', 'order_items', 'coupon_items', 'fee_items', 'tax_items', 'order_currency', 'shipping_method', 'download_permissions', 'order_notes', 'payment_method', 'payment_method_title', 'payment_method_post_meta', 'payment_method_user_meta', 'customer_note', 'custom_post_meta', 'custom_user_post_meta' ) );
34
+ }
35
+
36
+ function order_totals_fields(){
37
+ return array(
38
+ 'order_shipping',
39
+ 'order_shipping_tax',
40
+ 'cart_discount',
41
+ 'cart_discount_tax',
42
+ 'order_total',
43
+ 'order_tax',
44
+ );
45
+ }
46
+
47
+ function user_meta_fields(){
48
+ return array(
49
+ 'billing_first_name', // Billing Address Info
50
+ 'billing_last_name',
51
+ 'billing_company',
52
+ 'billing_address_1',
53
+ 'billing_address_2',
54
+ 'billing_city',
55
+ 'billing_state',
56
+ 'billing_postcode',
57
+ 'billing_country',
58
+ 'billing_email',
59
+ 'billing_phone',
60
+
61
+ 'shipping_first_name', // Shipping Address Info
62
+ 'shipping_last_name',
63
+ 'shipping_company',
64
+ 'shipping_address_1',
65
+ 'shipping_address_2',
66
+ 'shipping_city',
67
+ 'shipping_state',
68
+ 'shipping_postcode',
69
+ 'shipping_country',
70
+ );
71
+ }
72
+
73
+ function documentation(){
74
+ ?>
75
+ <tr valign="top">
76
+ <th scope="row"><?php _e( "WooCommerce Subscriptions is activated", 'import-users-from-csv-with-meta' ); ?></th>
77
+ <td>
78
+ <ol>
79
+ <li><?php _e( 'You can import subscriptions with their info', 'import-users-from-csv-with-meta' ); ?>.</li>
80
+ <li><?php printf( __( 'Data format: use the column names <a href="%s">described here</a>, except the ones that are not used because we have the own ones:', 'import-users-from-csv-with-meta' ), "https://github.com/woocommerce/woocommerce-subscriptions-importer-exporter#csv-columns" ); ?> customer_id, customer_email and customer_username.</li>
81
+ <li><?php printf( __( 'Download <a href="%s">this sample file</a> to see how it works', 'import-users-from-csv-with-meta' ), esc_url( plugins_url( 'samples/wcs-import-sample.csv', dirname( __FILE__ ) ) ) ); ?>.</li>
82
+ <li><?php printf( __( 'This subscription importer is based in the official <a href="%S">WooCommerce Subscription Importer Exporter</a>.', 'import-users-from-csv-with-meta' ), "https://github.com/woocommerce/woocommerce-subscriptions-importer-exporter" ); ?></li>
83
+ </ol>
84
+ </td>
85
+ </tr>
86
+ <?php
87
+ }
88
+
89
+ function end(){
90
+ $this->add_order_key_post_meta_if_missing();
91
+ }
92
+
93
+ function add_order_key_post_meta_if_missing() {
94
+ global $wpdb;
95
+
96
+ // Get the post_ids of the subscriptions whose order_key post meta is NULL or empty or missing
97
+ $subscription_ids_needing_order_key = $wpdb->get_results( "
98
+ SELECT ID FROM {$wpdb->prefix}posts WHERE
99
+ post_type = 'shop_subscription'
100
+ AND
101
+ ID NOT IN (
102
+ SELECT post_id FROM {$wpdb->prefix}postmeta WHERE
103
+ meta_key = '_order_key'
104
+ AND
105
+ meta_value IS NOT NULL
106
+ AND
107
+ meta_value <> ''
108
+ )
109
+ AND
110
+ post_status IN ( '" . implode( "','", array_keys( wcs_get_subscription_statuses() ) ) . "' )"
111
+ );
112
+
113
+ //Set the order_key post meta for each of them
114
+ foreach( $subscription_ids_needing_order_key as $key => $post ) {
115
+ update_post_meta( $post->ID, '_order_key', uniqid( 'order_' ) );
116
+ }
117
+ }
118
+
119
+ function import( $headers, $row, $user_id ){
120
+ foreach ( $this->fields() as $key ) {
121
+ $pos = array_search( $key, $headers );
122
+
123
+ if( $pos !== FALSE ){
124
+ $columns[ $key ] = $pos;
125
+ $data[ $key ] = $row[ $columns[ $key ] ];
126
+ }
127
+ }
128
+
129
+ global $wpdb;
130
+
131
+ $set_manual = $requires_manual_renewal = false;
132
+ $post_meta = $order_items = array();
133
+ $result = array(
134
+ 'warning' => array(),
135
+ 'error' => array(),
136
+ 'items' => '',
137
+ );
138
+
139
+ $missing_shipping_addresses = $missing_billing_addresses = array();
140
+
141
+ foreach ( array_merge( $this->order_totals_fields(), $this->user_meta_fields(), array( 'payment_method' ) ) as $column ) {
142
+ switch ( $column ) {
143
+ case 'cart_discount':
144
+ case 'cart_discount_tax':
145
+ case 'order_shipping':
146
+ case 'order_shipping_tax':
147
+ case 'order_total':
148
+ $value = ( ! empty( $data[ $column ] ) ) ? $data[ $column ] : 0;
149
+ $post_meta[] = array( 'key' => '_' . $column, 'value' => $value );
150
+ break;
151
+
152
+ case 'payment_method':
153
+ $payment_method = ( ! empty( $data[ $column ] ) ) ? strtolower( $data[ $column ] ) : '';
154
+ $title = ( ! empty( $data[ 'payment_method_title' ] ) ) ? $data[ 'payment_method_title' ] : $payment_method;
155
+
156
+ if ( ! empty( $payment_method ) && 'manual' != $payment_method ) {
157
+ $post_meta[] = array( 'key' => '_' . $column, 'value' => $payment_method );
158
+ $post_meta[] = array( 'key' => '_payment_method_title', 'value' => $title );
159
+ } else {
160
+ $set_manual = true;
161
+ }
162
+
163
+ if ( ! empty( $data[ 'requires_manual_renewal'] ) && 'true' == $data[ 'requires_manual_renewal'] ) {
164
+ $requires_manual_renewal = true;
165
+ }
166
+ break;
167
+
168
+ case 'shipping_address_1':
169
+ case 'shipping_city':
170
+ case 'shipping_postcode':
171
+ case 'shipping_state':
172
+ case 'shipping_country':
173
+ case 'billing_address_1':
174
+ case 'billing_city':
175
+ case 'billing_postcode':
176
+ case 'billing_state':
177
+ case 'billing_country':
178
+ case 'billing_phone':
179
+ case 'billing_company':
180
+ case 'billing_email':
181
+ $value = ( ! empty( $data[ $column ] ) ) ? $data[ $column ] : '';
182
+
183
+ if ( empty( $value ) ) {
184
+ $metadata = get_user_meta( $user_id, $column );
185
+ $value = ( ! empty( $metadata[0] ) ) ? $metadata[0] : '';
186
+ }
187
+
188
+ if ( empty( $value ) && 'billing_email' == $column ) {
189
+ $value = ( ! empty( $data[ 'customer_email'] ) ) ? $data[ 'customer_email'] : get_userdata( $user_id )->user_email;
190
+ }
191
+
192
+ if ( empty( $value ) ) {
193
+ if ( 0 === strpos( $column, 'billing_' ) ) {
194
+ $missing_billing_addresses[] = $column;
195
+ } else {
196
+ $missing_shipping_addresses[] = $column;
197
+ }
198
+ }
199
+
200
+ $post_meta[] = array( 'key' => '_' . $column, 'value' => $value );
201
+ break;
202
+
203
+ default:
204
+ $value = ( ! empty( $data[ $column ] ) ) ? $data[ $column ] : '';
205
+ $post_meta[] = array( 'key' => '_' . $column, 'value' => $value );
206
+ }
207
+ }
208
+
209
+ if ( empty( $data[ 'subscription_status'] ) ) {
210
+ $status = 'pending';
211
+ $result['warning'][] = esc_html__( 'No subscription status was specified. The subscription will be created with the status "pending". ', 'import-users-from-csv-with-meta' );
212
+ } else {
213
+ $status = ( 'wc-' === substr( $data[ 'subscription_status'], 0, 3 ) ) ? substr( $data[ 'subscription_status'], 3 ) : $data[ 'subscription_status'];
214
+ }
215
+
216
+ $dates_to_update = array( 'start' => ( ! empty( $data[ 'start_date'] ) ) ? gmdate( 'Y-m-d H:i:s', strtotime( $data[ 'start_date'] ) ) : gmdate( 'Y-m-d H:i:s', time() - 1 ) );
217
+
218
+ foreach ( array( 'trial_end_date', 'next_payment_date', 'end_date', 'last_payment_date' ) as $date_type ) {
219
+ $dates_to_update[ $date_type ] = ( ! empty( $data[ $date_type ] ) ) ? gmdate( 'Y-m-d H:i:s', strtotime( $data[ $date_type ] ) ) : '';
220
+ }
221
+
222
+ foreach ( $dates_to_update as $date_type => $datetime ) {
223
+
224
+ if ( empty( $datetime ) ) {
225
+ continue;
226
+ }
227
+
228
+ switch ( $date_type ) {
229
+ case 'end_date' :
230
+ if ( ! empty( $dates_to_update['next_payment_date'] ) && strtotime( $datetime ) <= strtotime( $dates_to_update['next_payment_date'] ) ) {
231
+ $result['error'][] = sprintf( __( 'The %s date must occur after the next payment date.', 'import-users-from-csv-with-meta' ), $date_type );
232
+ }
233
+ case 'next_payment_date' :
234
+ if ( ! empty( $dates_to_update['trial_end_date'] ) && strtotime( $datetime ) < strtotime( $dates_to_update['trial_end_date'] ) ) {
235
+ $result['error'][] = sprintf( __( 'The %s date must occur after the trial end date.', 'import-users-from-csv-with-meta' ), $date_type );
236
+ }
237
+ case 'trial_end_date' :
238
+ if ( strtotime( $datetime ) <= strtotime( $dates_to_update['start'] ) ) {
239
+ $result['error'][] = sprintf( __( 'The %s must occur after the start date.', 'import-users-from-csv-with-meta' ), $date_type );
240
+ }
241
+ }
242
+ }
243
+
244
+ // make the sure end of prepaid term exists for subscription that are about to be set to pending-cancellation - continue to use the next payment date if that exists
245
+ if ( 'pending-cancel' == $status && ( empty( $dates_to_update['next_payment_date'] ) || strtotime( $dates_to_update['next_payment_date'] ) < current_time( 'timestamp', true ) ) ) {
246
+ if ( ! empty( $dates_to_update['end_date'] ) && strtotime( $dates_to_update['end_date'] ) > current_time( 'timestamp', true ) ) {
247
+ $dates_to_update['next_payment_date'] = $dates_to_update['end_date'];
248
+ unset( $dates_to_update['end_date'] );
249
+ } else {
250
+ $result['error'][] = __( 'Importing a pending cancelled subscription requires an end date in the future.', 'import-users-from-csv-with-meta' );
251
+ }
252
+ }
253
+
254
+ if ( empty( $result['error'] ) ) {
255
+ try {
256
+ $wpdb->query( 'START TRANSACTION' );
257
+
258
+ if( !function_exists( 'wcs_create_subscription' ) ){
259
+ require_once( WP_PLUGIN_DIR . '/woocommerce-subscriptions/wcs-functions.php' );
260
+ }
261
+
262
+ $subscription = wcs_create_subscription( array(
263
+ 'customer_id' => $user_id,
264
+ 'start_date' => $dates_to_update['start'],
265
+ 'billing_interval' => ( ! empty( $data[ 'billing_interval'] ) ) ? $data[ 'billing_interval'] : 1,
266
+ 'billing_period' => ( ! empty( $data[ 'billing_period'] ) ) ? $data[ 'billing_period'] : '',
267
+ 'created_via' => 'importer',
268
+ 'customer_note' => ( ! empty( $data[ 'customer_note'] ) ) ? $data[ 'customer_note'] : '',
269
+ 'currency' => ( ! empty( $data[ 'order_currency'] ) ) ? $data[ 'order_currency'] : '',
270
+ )
271
+ );
272
+
273
+ if ( is_wp_error( $subscription ) ) {
274
+ throw new Exception( sprintf( esc_html__( 'Could not create subscription: %s', 'import-users-from-csv-with-meta' ), $subscription->get_error_message() ) );
275
+ }
276
+
277
+ $subscription_id = version_compare( WC()->version, '3.0', '>=' ) ? $subscription->get_id() : $subscription->id;
278
+
279
+ foreach ( $post_meta as $meta_data ) {
280
+ update_post_meta( $subscription_id, $meta_data['key'], $meta_data['value'] );
281
+ }
282
+
283
+ if( !empty( $data['custom_post_meta'] ) ){
284
+ foreach ( $data['custom_post_meta'] as $meta_key ) {
285
+ if ( ! empty( $data[ $meta_key ] ) ) {
286
+ update_post_meta( $subscription_id, $meta_key, $data[ $meta_key ] );
287
+ }
288
+ }
289
+ }
290
+
291
+ if( !empty( $data['custom_user_post_meta'] ) ){
292
+ foreach ( $data['custom_user_post_meta'] as $meta_key ) {
293
+ if ( ! empty( $data[ $meta_key ] ) ) {
294
+ update_post_meta( $subscription_id, $meta_key, $data[ $meta_key ] );
295
+ update_user_meta( $user_id, $meta_key, $data[ $meta_key ] );
296
+ }
297
+ }
298
+ }
299
+
300
+ // Now that we've set all the meta data, reinit the object so the data is set
301
+ $subscription = wcs_get_subscription( $subscription_id );
302
+
303
+ $subscription->update_dates( $dates_to_update );
304
+
305
+ if ( ! $set_manual && ! in_array( $status, wcs_get_subscription_ended_statuses() ) ) { // don't bother trying to set payment meta on a subscription that won't ever renew
306
+ $result['warning'] = array_merge( $result['warning'], $this->set_payment_meta( $subscription, $data ) );
307
+ }
308
+
309
+ if ( $set_manual || $requires_manual_renewal ) {
310
+ $subscription->set_requires_manual_renewal( true );
311
+ }
312
+
313
+ if ( ! empty( $data[ 'order_notes'] ) ) {
314
+ $order_notes = explode( ';', $data[ 'order_notes'] );
315
+
316
+ foreach ( $order_notes as $order_note ) {
317
+ $subscription->add_order_note( $order_note );
318
+ }
319
+ }
320
+
321
+ if ( $set_manual ) {
322
+ $result['warning'][] = esc_html__( 'No payment method was given in CSV and so the subscription has been set to manual renewal.', 'import-users-from-csv-with-meta' );
323
+ } else if ( $requires_manual_renewal ) {
324
+ $result['warning'][] = esc_html__( 'Import forced manual renewal.', 'import-users-from-csv-with-meta' );
325
+ }
326
+
327
+ if ( ! empty( $data[ 'coupon_items'] ) ) {
328
+ $this->add_coupons( $subscription, $data );
329
+ }
330
+
331
+ $chosen_tax_rate_id = 0;
332
+ if ( ! empty( $data[ 'tax_items'] ) ) {
333
+ $chosen_tax_rate_id = $this->add_taxes( $subscription, $data );
334
+ }
335
+
336
+ if ( ! empty( $data[ 'order_items'] ) ) {
337
+ if ( is_numeric( $data[ 'order_items'] ) ) {
338
+ $product_id = absint( $data[ 'order_items'] );
339
+ $result['items'] = $this->add_product( $subscription, array( 'product_id' => $product_id ), $chosen_tax_rate_id );
340
+ $order_items[] = $product_id;
341
+ } else {
342
+ $order_items_row = explode( ';', $data[ 'order_items'] );
343
+
344
+ if ( ! empty( $order_items_row ) ) {
345
+ foreach ( $order_items_row as $order_item ) {
346
+ $item_data = array();
347
+
348
+ foreach ( explode( '|', $order_item ) as $item ) {
349
+ list( $name, $value ) = explode( ':', $item );
350
+ $item_data[ trim( $name ) ] = trim( $value );
351
+ }
352
+
353
+ $result['items'] .= $this->add_product( $subscription, $item_data, $chosen_tax_rate_id ) . '<br/>';
354
+ $order_items[] = $item_data['product_id'];
355
+ }
356
+ }
357
+ }
358
+ }
359
+
360
+ if ( ! empty( $data[ 'fee_items'] ) ) {
361
+ $this->add_fees( $subscription, $data, $chosen_tax_rate_id );
362
+ }
363
+
364
+ if ( ! empty( $data[ 'shipping_method'] ) ) {
365
+ $shipping_method = $this->add_shipping_lines( $subscription, $data, $chosen_tax_rate_id );
366
+ }
367
+
368
+ // only show the following warnings on the import when the subscription requires shipping
369
+ if ( ! $this->all_virtual ) {
370
+ if ( ! empty( $missing_shipping_addresses ) ) {
371
+ $result['warning'][] = sprintf( esc_html__( 'The following shipping address fields have been left empty: %s. ', 'import-users-from-csv-with-meta' ), rtrim( implode( ', ', $missing_shipping_addresses ), ',' ) );
372
+ }
373
+
374
+ if ( ! empty( $missing_billing_addresses ) ) {
375
+ $result['warning'][] = sprintf( esc_html__( 'The following billing address fields have been left empty: %s. ', 'import-users-from-csv-with-meta' ), rtrim( implode( ', ', $missing_billing_addresses ), ',' ) );
376
+ }
377
+
378
+ if ( empty( $shipping_method ) ) {
379
+ $result['warning'][] = esc_html__( 'Shipping method and title for the subscription have been left as empty. ', 'import-users-from-csv-with-meta' );
380
+ }
381
+ }
382
+
383
+
384
+ add_filter( 'woocommerce_can_subscription_be_updated_to_cancelled', '__return_true' );
385
+ add_filter( 'woocommerce_can_subscription_be_updated_to_pending-cancel', '__return_true' );
386
+
387
+ $subscription->update_status( $status );
388
+
389
+ remove_filter( 'woocommerce_can_subscription_be_updated_to_cancelled', '__return_true' );
390
+ remove_filter( 'woocommerce_can_subscription_be_updated_to_pending-cancel', '__return_true' );
391
+
392
+ foreach ( $order_items as $product_id ) {
393
+ $this->maybe_add_memberships( $user_id, $subscription->id, $product_id );
394
+ }
395
+
396
+ $subscription->save();
397
+
398
+ $wpdb->query( 'COMMIT' );
399
+
400
+ } catch ( Exception $e ) {
401
+ $wpdb->query( 'ROLLBACK' );
402
+ $result['error'][] = $e->getMessage();
403
+ }
404
+ }
405
+
406
+ if ( empty( $result['error'] ) ) {
407
+ $result['status'] = 'success';
408
+ $result['subscription'] = sprintf( '<a href="%s">#%s</a>', esc_url( admin_url( 'post.php?post=' . absint( $subscription_id ) . '&action=edit' ) ), $subscription->get_order_number() );
409
+ $result['subscription_status'] = $subscription->get_status();
410
+
411
+ }
412
+
413
+ // print result
414
+ if( !empty( $result['warning'] ) ){
415
+ foreach ( $result['warning'] as $warning ) {
416
+ echo "<td>" . $warning . "</td>";
417
+ }
418
+ }
419
+ else{
420
+ echo "<td></td>";
421
+ }
422
+
423
+ if( !empty( $result['error'] ) ){
424
+ foreach ( $result['error'] as $error ) {
425
+ echo "<td>" . $error . "</td>";
426
+ }
427
+ }
428
+ else{
429
+ echo "<td></td>";
430
+ }
431
+ }
432
+
433
+ function set_payment_meta( $subscription, $data ) {
434
+ $warnings = array();
435
+ $payment_gateways = WC()->payment_gateways->get_available_payment_gateways();
436
+ $subscription_id = version_compare( WC()->version, '3.0', '>=' ) ? $subscription->get_id() : $subscription->id;
437
+ $payment_method = version_compare( WC()->version, '3.0', '>=' ) ? $subscription->get_payment_method() : $subscription->payment_method;
438
+
439
+ if ( ! empty( $payment_method ) ) {
440
+ $payment_method_table = apply_filters( 'woocommerce_subscription_payment_meta', array(), $subscription );
441
+ $payment_gateway = ( isset( $payment_gateways[ $payment_method ] ) ) ? $payment_gateways[ $payment_method ] : '';
442
+
443
+ if ( ! empty( $payment_gateway ) && isset( $payment_method_table[ $payment_gateway->id ] ) ) {
444
+ $payment_post_meta = $payment_user_meta = array();
445
+
446
+ if ( ! empty( $data[ 'payment_method_post_meta'] ) ) {
447
+ foreach ( explode( '|', $data[ 'payment_method_post_meta'] ) as $meta ) {
448
+ list( $name, $value ) = explode( ':', $meta );
449
+ $payment_post_meta[ trim( $name ) ] = trim( $value );
450
+ }
451
+ }
452
+
453
+ if ( ! empty( $data[ 'payment_method_user_meta'] ) ) {
454
+ foreach ( explode( '|', $data[ 'payment_method_user_meta'] ) as $meta ) {
455
+ list( $name, $value ) = explode( ':', $meta );
456
+ $payment_user_meta[ trim( $name ) ] = trim( $value );
457
+ }
458
+ }
459
+
460
+ $payment_method_data = $payment_method_table[ $payment_gateway->id ];
461
+ $meta_set = false;
462
+
463
+ foreach ( $payment_method_data as $meta_table => &$meta ) {
464
+ if ( ! is_array( $meta ) ) {
465
+ continue;
466
+ }
467
+
468
+ foreach ( $meta as $meta_key => &$meta_data ) {
469
+ switch ( $meta_table ) {
470
+ case 'post_meta':
471
+ case 'postmeta':
472
+ $value = ( ! empty( $payment_post_meta[ $meta_key ] ) ) ? $payment_post_meta[ $meta_key ] : '';
473
+ break;
474
+ case 'user_meta':
475
+ case 'usermeta':
476
+ $value = ( ! empty( $payment_user_meta[ $meta_key ] ) ) ? $payment_user_meta[ $meta_key ] : '';
477
+ break;
478
+ default :
479
+ $value = '';
480
+ }
481
+
482
+ if ( ! empty( $value ) ) {
483
+ $meta_data['value'] = $value;
484
+ $meta_set = true;
485
+ }
486
+ }
487
+ }
488
+
489
+ if ( $meta_set ) {
490
+ // Reload the subscription to update the meta values.
491
+ $subscription = wcs_get_subscription( $subscription->get_id() );
492
+ $subscription->set_payment_method( $payment_gateway, $payment_method_data );
493
+ $subscription->save();
494
+ } else {
495
+ $warnings[] = sprintf( esc_html__( 'No payment meta was set for your %1$s subscription (%2$s). The next renewal is going to fail if you leave this.', 'import-users-from-csv-with-meta' ), $payment_method, $subscription_id );
496
+ }
497
+ } else {
498
+ if ( 'paypal' == $payment_method ) {
499
+ $warnings[] = sprintf( esc_html__( 'Could not set payment method as PayPal, defaulted to manual renewals. Either PayPal was not enabled or your PayPal account does not have Reference Transaction setup. Learn more about enabling Reference Transactions %1$shere%2$s.', 'import-users-from-csv-with-meta' ), '<a href="https://support.woocommerce.com/hc/en-us/articles/205151193-PayPal-Reference-Transactions-for-Subscriptions">', '</a>' );
500
+ } else {
501
+ $warnings[] = sprintf( esc_html__( 'The payment method "%s" is either not enabled or does not support the new features of Subscriptions 2.0 and can not be properly attached to your subscription. This subscription has been set to manual renewals.', 'import-users-from-csv-with-meta' ), $payment_method );
502
+ }
503
+ $subscription->set_requires_manual_renewal( true );
504
+ }
505
+ }
506
+ return $warnings;
507
+ }
508
+
509
+ function save_download_permissions( $subscription, $product, $quantity = 1 ) {
510
+
511
+ if ( $product && $product->exists() && $product->is_downloadable() ) {
512
+ $downloads = $product->get_downloads();
513
+
514
+ foreach ( array_keys( $downloads ) as $download_id ) {
515
+ wc_downloadable_file_permission( $download_id, $product->get_id(), $subscription, $quantity );
516
+ }
517
+ }
518
+ }
519
+
520
+ function maybe_add_memberships( $user_id, $subscription_id, $product_id ) {
521
+ if ( function_exists( 'wc_memberships_get_membership_plans' ) ) {
522
+ $membership_plans = wc_memberships_get_membership_plans();
523
+
524
+ foreach ( $membership_plans as $plan ) {
525
+ if ( $plan->has_product( $product_id ) ) {
526
+ $plan->grant_access_from_purchase( $user_id, $product_id, $subscription_id );
527
+ }
528
+
529
+ // if the product is a variation we want to also check if the parent variable product has any plans as well and add them
530
+ $product = wc_get_product( $product_id );
531
+ $parent_id = wcs_get_objects_property( $product, 'parent_id' );
532
+ if ( $product && $product->is_type( 'variation' ) && ! empty( $parent_id ) && $plan->has_product( $parent_id ) ) {
533
+ $plan->grant_access_from_purchase( $user_id, $product->parent->id, $subscription_id );
534
+ }
535
+ }
536
+ }
537
+ }
538
+
539
+ function add_coupons( $subscription, $data ) {
540
+ $coupon_items = explode( ';', $data[ 'coupon_items'] );
541
+
542
+ if ( ! empty( $coupon_items ) ) {
543
+ foreach ( $coupon_items as $coupon_item ) {
544
+ $coupon_data = array();
545
+
546
+ foreach ( explode( '|', $coupon_item ) as $item ) {
547
+ list( $name, $value ) = explode( ':', $item );
548
+ $coupon_data[ trim( $name ) ] = trim( $value );
549
+ }
550
+
551
+ $coupon_code = isset( $coupon_data['code'] ) ? $coupon_data['code'] : '';
552
+ $coupon = new WC_Coupon( $coupon_code );
553
+
554
+ if ( ! $coupon ) {
555
+ throw new Exception( sprintf( esc_html__( 'Could not find coupon with code "%s" in your store.', 'import-users-from-csv-with-meta' ), $coupon_code ) );
556
+ } elseif ( isset( $coupon_data['amount'] ) ) {
557
+ $discount_amount = floatval( $coupon_data['amount'] );
558
+ } else {
559
+ $discount_amount = version_compare( WC()->version, '3.0', '>=' ) ? $coupon->get_discount_amount( 0 ) : $coupon->discount_amount;
560
+ }
561
+
562
+
563
+ $coupon_line_item = new WC_Order_Item_Coupon();
564
+ $coupon_line_item->set_props( array(
565
+ 'code' => $coupon_code,
566
+ 'discount' => $discount_amount,
567
+ 'discount_tax' => 0,
568
+ 'order_id' => $subscription->get_id(),
569
+ ) );
570
+ $coupon_line_item->save();
571
+ $subscription->add_item( $coupon_line_item );
572
+ $coupon_id = $coupon_line_item->get_id();
573
+
574
+ if ( ! $coupon_id ) {
575
+ throw new Exception( sprintf( esc_html__( 'Coupon "%s" could not be added to subscription.', 'import-users-from-csv-with-meta' ), $coupon_code ) );
576
+ }
577
+ }
578
+ }
579
+ }
580
+
581
+ function add_product( $subscription, $data, $chosen_tax_rate_id ) {
582
+ $item_args = array();
583
+ $item_args['qty'] = isset( $data['quantity'] ) ? $data['quantity'] : 1;
584
+
585
+ if ( ! isset( $data['product_id'] ) ) {
586
+ throw new Exception( __( 'The product_id is missing from CSV.', 'import-users-from-csv-with-meta' ) );
587
+ }
588
+
589
+ $_product = wc_get_product( $data['product_id'] );
590
+
591
+ if ( ! $_product ) {
592
+ throw new Exception( sprintf( __( 'No product or variation in your store matches the product ID #%s.', 'import-users-from-csv-with-meta' ), $data['product_id'] ) );
593
+ }
594
+
595
+ $_product_id = version_compare( WC()->version, '3.0', '>=' ) ? $_product->get_id() : $_product->id;
596
+ $line_item_name = ( ! empty( $data['name'] ) ) ? $data['name'] : $_product->get_title();
597
+ $product_string = sprintf( '<a href="%s">%s</a>', get_edit_post_link( $_product_id ), $line_item_name );
598
+
599
+ foreach ( array( 'total', 'tax', 'subtotal', 'subtotal_tax' ) as $line_item_data ) {
600
+
601
+ switch ( $line_item_data ) {
602
+ case 'total' :
603
+ $default = WC_Subscriptions_Product::get_price( $data['product_id'] );
604
+ break;
605
+ case 'subtotal' :
606
+ $default = ( ! empty( $data['total'] ) ) ? $data['total'] : WC_Subscriptions_Product::get_price( $data['product_id'] );
607
+ break;
608
+ default :
609
+ $default = 0;
610
+ }
611
+ $item_args['totals'][ $line_item_data ] = ( ! empty( $data[ $line_item_data ] ) ) ? $data[ $line_item_data ] : $default;
612
+ }
613
+
614
+ // Add this site's variation meta data if no line item meta data was specified in the CSV
615
+ if ( empty( $data['meta'] ) && $_product->is_type( 'variable' ) ) {
616
+ $_product_variation_data = version_compare( WC()->version, '3.0', '>=' ) ? $_product->get_available_variations() : $_product->variation_data;
617
+
618
+ $item_args['variation'] = array();
619
+
620
+ foreach ( $_product_variation_data as $attribute => $variation ) {
621
+ $item_args['variation'][ $attribute ] = $variation;
622
+ }
623
+ $product_string .= ' [#' . $data['product_id'] . ']';
624
+ }
625
+
626
+ if ( $this->all_virtual && ! $_product->is_virtual() ) {
627
+ $this->all_virtual = false;
628
+ }
629
+
630
+ if ( ! empty( $item_args['totals']['tax'] ) && ! empty( $chosen_tax_rate_id ) ) {
631
+ $item_args['totals']['tax_data']['total'] = array( $chosen_tax_rate_id => $item_args['totals']['tax'] );
632
+ $item_args['totals']['tax_data']['subtotal'] = array( $chosen_tax_rate_id => $item_args['totals']['tax'] );
633
+ }
634
+
635
+ $item_id = $subscription->add_product( $_product, $item_args['qty'], $item_args );
636
+
637
+ // Set the name used in the CSV if it's different to the product's current title (which is what WC_Abstract_Order::add_product() uses)
638
+ if ( ! empty( $data['name'] ) && $_product->get_title() != $data['name'] ) {
639
+ wc_update_order_item( $item_id, array( 'order_item_name' => $data['name'] ) );
640
+ }
641
+
642
+ // Add any meta data for the line item
643
+ if ( ! empty( $data['meta'] ) ) {
644
+ foreach ( explode( '+', $data['meta'] ) as $meta ) {
645
+ $meta = explode( '=', $meta );
646
+ wc_update_order_item_meta( $item_id, $meta[0], $meta[1] );
647
+ }
648
+ }
649
+
650
+ if ( ! $item_id ) {
651
+ throw new Exception( __( 'An unexpected error occurred when trying to add product "%s" to your subscription. The error was caught and no subscription for this row will be created. Please fix up the data from your CSV and try again.', 'import-users-from-csv-with-meta' ) );
652
+ }
653
+
654
+ if ( ! empty( $data[ 'download_permissions'] ) && ( 'true' == $data[ 'download_permissions'] || 1 == (int) $data[ 'download_permissions'] ) ) {
655
+ $this->save_download_permissions( $subscription, $_product, $item_args['qty'] );
656
+ }
657
+
658
+ return $product_string;
659
+ }
660
+
661
+ function add_fees( $subscription, $data, $chosen_tax_rate_id ) {
662
+ $fee_items = explode( ';', $data[ 'fee_items'] );
663
+
664
+ if ( ! empty( $fee_items ) ) {
665
+ foreach ( $fee_items as $fee_item ) {
666
+ $fee_data = array();
667
+
668
+ foreach ( explode( '|', $fee_item ) as $item ) {
669
+ list( $name, $value ) = explode( ':', $item );
670
+ $fee_data[ trim( $name ) ] = trim( $value );
671
+ }
672
+
673
+ if ( empty( $fee_data['name'] ) ) {
674
+ throw new Exception( __( 'Fee name is missing from your CSV. This subscription has not been imported.', 'import-users-from-csv-with-meta' ) );
675
+ }
676
+
677
+ $fee = new stdClass();
678
+ $fee->id = sanitize_title( $fee_data['name'] );
679
+ $fee->name = $fee_data['name'];
680
+ $fee->amount = isset( $fee_data['total'] ) ? floatval( $fee_data['total'] ) : 0;
681
+ $fee->taxable = false;
682
+ $fee->tax = 0;
683
+ $fee->tax_data = array();
684
+ $fee->tax_class = 0;
685
+
686
+ if ( ! empty( $fee_data['tax'] ) ) {
687
+ $fee->tax = wc_format_decimal( $fee_data['tax'] );
688
+ $fee->tax_class = ( ! empty( $fee_data['tax_class'] ) ) ? $fee_data['tax_class'] : 0;
689
+ $fee->taxable = true;
690
+
691
+ if ( ! empty( $chosen_tax_rate_id ) ) {
692
+ $fee->tax_data = array( 'total' => array( $chosen_tax_rate_id => $fee->tax ), 'subtotal' => array( $chosen_tax_rate_id => $fee->tax ) );
693
+ }
694
+ }
695
+
696
+
697
+ $fee_line_item = new WC_Order_Item_Fee();
698
+ $fee_line_item->set_props( array(
699
+ 'name' => $fee->name,
700
+ 'tax_class' => $fee->taxable ? $fee->tax_class : 0,
701
+ 'total' => $fee->amount,
702
+ 'total_tax' => $fee->tax,
703
+ 'taxes' => array(
704
+ 'total' => $fee->tax_data,
705
+ ),
706
+ 'order_id' => $subscription->get_id(),
707
+ ) );
708
+ $fee_line_item->save();
709
+ $subscription->add_item( $fee_line_item );
710
+
711
+ $fee_id = $fee_line_item->get_id();
712
+
713
+ if ( ! $fee_id ) {
714
+ throw new Exception( __( 'Could not add the fee to your subscription, the subscription has not been imported.', 'import-users-from-csv-with-meta' ) );
715
+ }
716
+ }
717
+ }
718
+ }
719
+
720
+ function add_shipping_lines( $subscription, $data, $chosen_tax_rate_id ) {
721
+ $shipping_items = explode( ';', $data[ 'shipping_method'] );
722
+ $shipping_method = '';
723
+ $default_total = ( ! empty( $data[ 'order_shipping'] ) ) ? $data[ 'order_shipping'] : 0;
724
+
725
+ if ( ! empty( $shipping_items ) ) {
726
+ foreach ( $shipping_items as $shipping_item ) {
727
+ $shipping_line = array();
728
+
729
+ if ( false !== strpos( $shipping_item, ':' ) ) {
730
+ foreach ( explode( '|', $shipping_item ) as $item ) {
731
+ list( $name, $value ) = explode( ':', $item );
732
+ $shipping_line[ trim( $name ) ] = trim( $value );
733
+ }
734
+ } else {
735
+ $shipping_line['method_id'] = $shipping_item;
736
+ }
737
+
738
+ $shipping_method = isset( $shipping_line['method_id'] ) ? $shipping_line['method_id'] : '';
739
+ $shipping_title = isset( $shipping_line['method_title'] ) ? $shipping_line['method_title'] : $shipping_method;
740
+ $shipping_rate = new WC_Shipping_Rate( $shipping_method, $shipping_title, isset( $shipping_line['total'] ) ? floatval( $shipping_line['total'] ) : $default_total, array(), $shipping_method );
741
+
742
+ if ( ! empty( $data[ 'order_shipping_tax'] ) && ! empty( $chosen_tax_rate_id ) ) {
743
+ $shipping_rate->taxes = array( $chosen_tax_rate_id => $data[ 'order_shipping_tax'] );
744
+ }
745
+
746
+ $shipping_line_item = new WC_Order_Item_Shipping();
747
+ $shipping_line_item->set_props( array(
748
+ 'method_title' => $shipping_rate->label,
749
+ 'method_id' => $shipping_rate->id,
750
+ 'total' => wc_format_decimal( $shipping_rate->cost ),
751
+ 'taxes' => $shipping_rate->taxes,
752
+ 'order_id' => $subscription->get_id(),
753
+ ) );
754
+ foreach ( $shipping_rate->get_meta_data() as $key => $value ) {
755
+ $shipping_line_item->add_meta_data( $key, $value, true );
756
+ }
757
+ $shipping_line_item->save();
758
+ $subscription->add_item( $shipping_line_item );
759
+ wc_do_deprecated_action( 'woocommerce_order_add_shipping', array( $subscription->get_id(), $shipping_line_item->get_id(), $shipping_rate ), '3.0', 'woocommerce_new_order_item action instead.' );
760
+ $shipping_id = $shipping_line_item->get_id();
761
+
762
+ if ( ! $shipping_id ) {
763
+ throw new Exception( __( 'An error occurred when trying to add the shipping item to the subscription, a subscription not been created for this row.', 'import-users-from-csv-with-meta' ) );
764
+ }
765
+
766
+ update_post_meta( $subscription->get_id(), '_shipping_method', $shipping_method );
767
+ update_post_meta( $subscription->get_id(), '_shipping_method_title', $shipping_title );
768
+ }
769
+ }
770
+
771
+ return $shipping_method;
772
+ }
773
+
774
+ function add_taxes( $subscription, $data ) {
775
+ global $wpdb;
776
+
777
+ $tax_items = explode( ';', $data[ 'tax_items'] );
778
+ $chosen_tax_rate_id = 0;
779
+
780
+ if ( ! empty( $tax_items ) ) {
781
+ foreach ( $tax_items as $tax_item ) {
782
+ $tax_data = array();
783
+
784
+ if ( false !== strpos( $tax_item, ':' ) ) {
785
+ foreach ( explode( '|', $tax_item ) as $item ) {
786
+ list( $name, $value ) = explode( ':', $item );
787
+ $tax_data[ trim( $name ) ] = trim( $value );
788
+ }
789
+ } elseif ( 1 == count( $tax_items ) ) {
790
+ if ( is_numeric( $tax_item ) ) {
791
+ $tax_data['id'] = $tax_item;
792
+ } else {
793
+ $tax_data['code'] = $tax_item;
794
+ }
795
+ }
796
+
797
+ if ( ! empty( $tax_data['id'] ) ) {
798
+ $tax_rate = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %s", $tax_data['id'] ) );
799
+ } elseif ( ! empty( $tax_data['code'] ) ) {
800
+ $tax_rate = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_name = %s ORDER BY tax_rate_priority LIMIT 1", $tax_data['code'] ) );
801
+ } else {
802
+ $result['warning'][] = sprintf( esc_html__( 'Missing tax code or ID from column: %s', 'import-users-from-csv-with-meta' ), $data['tax_items'] );
803
+ }
804
+
805
+ if ( ! empty( $tax_rate ) ) {
806
+ $tax_rate = array_pop( $tax_rate );
807
+
808
+ $tax_line_item = new WC_Order_Item_Tax();
809
+ $tax_line_item->set_props( array(
810
+ 'rate_id' => $tax_rate->tax_rate_id,
811
+ 'tax_total' => ( ! empty( $data[ 'order_tax'] ) ) ? $data[ 'order_tax'] : 0,
812
+ 'shipping_tax_total' => ( ! empty( $data[ 'order_shipping_tax'] ) ) ? $data[ 'order_shipping_tax'] : 0,
813
+ ) );
814
+ $tax_line_item->set_rate( $tax_rate->tax_rate_id );
815
+ $tax_line_item->set_order_id( $subscription->get_id() );
816
+ $tax_line_item->save();
817
+ $subscription->add_item( $tax_line_item );
818
+ $tax_id = $tax_line_item->get_id();
819
+
820
+ $chosen_tax_rate_id = $tax_rate->tax_rate_id;
821
+ }
822
+ }
823
+ }
824
+
825
+ return $chosen_tax_rate_id;
826
+ }
827
+ }
828
+ new ACUI_WooCommerceSubscriptions();
trunk/addons/woocommerce.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ if( !is_plugin_active( 'woocommerce/woocommerce.php' ) ){
5
+ return;
6
+ }
7
+
8
+ class ACUI_WooCommerce{
9
+ private $all_virtual;
10
+
11
+ function __construct(){
12
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
13
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
14
+ add_action( 'post_acui_import_single_user', array( $this, 'sync_wc_customer' ), 10, 4 );
15
+ add_action( 'after_acui_import_users', array( $this, 'clear_transients' ) );
16
+ add_filter( 'acui_import_email_body_before_wpautop', array( $this, 'include_overrides_email' ), 10, 5 );
17
+ add_action( 'acui_email_wildcards_list_elements', array( $this, 'new_wildcards_email' ) );
18
+ add_filter( 'acui_force_reset_password_edit_profile_url', array( $this, 'force_reset_password_edit_profile_url' ) );
19
+ add_filter( 'acui_force_reset_password_redirect_condition', array( $this, 'force_reset_password_redirect_condition' ) );
20
+ add_action( 'wp_head', array( $this, 'force_reset_password_notice' ) );
21
+ add_action( 'woocommerce_save_account_details', array( $this, 'force_reset_save_account_details' ) );
22
+ }
23
+
24
+ function fields(){
25
+ return array(
26
+ 'billing_first_name', // Billing Address Info
27
+ 'billing_last_name',
28
+ 'billing_company',
29
+ 'billing_address_1',
30
+ 'billing_address_2',
31
+ 'billing_city',
32
+ 'billing_state',
33
+ 'billing_postcode',
34
+ 'billing_country',
35
+ 'billing_email',
36
+ 'billing_phone',
37
+
38
+ 'shipping_first_name', // Shipping Address Info
39
+ 'shipping_last_name',
40
+ 'shipping_company',
41
+ 'shipping_address_1',
42
+ 'shipping_address_2',
43
+ 'shipping_city',
44
+ 'shipping_state',
45
+ 'shipping_postcode',
46
+ 'shipping_country',
47
+ );
48
+ }
49
+
50
+ function restricted_fields( $acui_restricted_fields ){
51
+ return array_merge( $acui_restricted_fields, $this->fields() );
52
+ }
53
+
54
+ function documentation(){
55
+ ?>
56
+ <tr valign="top">
57
+ <th scope="row"><?php _e( "WooCommerce is activated", 'import-users-from-csv-with-meta' ); ?></th>
58
+ <td><?php _e( "You can use those labels if you want to set data adapted to the WooCommerce default user columns", 'import-users-from-csv-with-meta' ); ?>
59
+ <ol>
60
+ <li>billing_first_name</li>
61
+ <li>billing_last_name</li>
62
+ <li>billing_company</li>
63
+ <li>billing_address_1</li>
64
+ <li>billing_address_2</li>
65
+ <li>billing_city</li>
66
+ <li>billing_postcode</li>
67
+ <li>billing_country</li>
68
+ <li>billing_state</li>
69
+ <li>billing_phone</li>
70
+ <li>billing_email</li>
71
+ <li>shipping_first_name</li>
72
+ <li>shipping_last_name</li>
73
+ <li>shipping_company</li>
74
+ <li>shipping_address_1</li>
75
+ <li>shipping_address_2</li>
76
+ <li>shipping_city</li>
77
+ <li>shipping_postcode</li>
78
+ <li>shipping_country</li>
79
+ <li>shipping_state</li>
80
+ </ol>
81
+ </td>
82
+ </tr>
83
+ <?php
84
+ }
85
+
86
+ function sync_wc_customer( $headers, $data, $user_id, $role ){
87
+ if( !in_array( 'customer', $role ) || !class_exists( 'WC_Customer' ) )
88
+ return;
89
+
90
+ $customer = new WC_Customer( $user_id );
91
+ $customer->save();
92
+ }
93
+
94
+ function clear_transients(){
95
+ if( !class_exists( 'WC_Customer' ) )
96
+ return;
97
+
98
+ wc_delete_product_transients();
99
+ wc_delete_shop_order_transients();
100
+ delete_transient( 'wc_count_comments' );
101
+ }
102
+
103
+ function include_overrides_email( $body, $headers, $data, $created, $user_id ){
104
+ $user_data = get_user_by( 'ID', $user_id );
105
+ $reset_key = get_password_reset_key( $user_data );
106
+
107
+ $body = str_replace( "**woocommercelostpasswordurl**", wc_lostpassword_url(), $body );
108
+
109
+ $woocommerce_password_reset_url = esc_url( add_query_arg( array( 'key' => $reset_key, 'id' => $user_id ), wc_get_endpoint_url( 'lost-password', '', wc_get_page_permalink( 'myaccount' ) ) ) );
110
+ $body = str_replace( "**woocommercepasswordreseturl**", $woocommerce_password_reset_url, $body );
111
+
112
+ $woocommerce_password_reset_url_link = wp_sprintf( '<a href="%s">%s</a>', $woocommerce_password_reset_url, __( 'Password reset link', 'import-users-from-csv-with-meta' ) );
113
+ $body = str_replace( "**woocommercepasswordreseturllink**", $woocommerce_password_reset_url_link, $body );
114
+
115
+ return $body;
116
+ }
117
+
118
+ function new_wildcards_email(){
119
+ ?>
120
+ <li>**woocommercelostpasswordurl** = <?php _e( 'WooCommerce lost password url', 'import-users-from-csv-with-meta' ); ?></li>
121
+ <li>**woocommercepasswordreseturl** = <?php _e( 'WooCommerce password reset url', 'import-users-from-csv-with-meta' ); ?>
122
+ <li>**woocommercepasswordreseturllink** = <?php _e( 'WooCommerce password reset url with HTML link', 'import-users-from-csv-with-meta' ); ?>
123
+ <?php
124
+ }
125
+
126
+ function force_reset_password_edit_profile_url(){
127
+ return wc_get_page_permalink( 'myaccount' );
128
+ }
129
+
130
+ function force_reset_password_redirect_condition( $condition ){
131
+ return ( function_exists( 'is_account_page' ) ) ? is_account_page() : $condition;
132
+ }
133
+
134
+ function force_reset_password_notice(){
135
+ if ( get_user_meta( get_current_user_id(), 'acui_force_reset_password', true ) ) {
136
+ wc_add_notice( apply_filters( 'acui_force_reset_password_message', __( 'Please change your password', 'import-users-from-csv-with-meta' ) ), 'error' );
137
+ }
138
+ }
139
+
140
+ function force_reset_save_account_details( $user_id ){
141
+ $pass1 = $pass2 = '';
142
+
143
+ if ( isset( $_POST['password_1'] ) )
144
+ $pass1 = $_POST['password_1'];
145
+
146
+ if ( isset( $_POST['password_2'] ) )
147
+ $pass2 = $_POST['password_2'];
148
+
149
+ if ( $pass1 != $pass2 || empty( $pass1 ) || empty( $pass2 ) || false !== strpos( stripslashes( $pass1 ), "\\" ) )
150
+ return;
151
+
152
+ delete_user_meta( $user_id, 'acui_force_reset_password' );
153
+ }
154
+ }
155
+
156
+ new ACUI_WooCommerce();
trunk/addons/wp-access-area.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'wp-access-areas/wp-access-areas.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_WP_Access_Area{
10
+ function __construct(){
11
+ }
12
+
13
+ function hooks(){
14
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
15
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
16
+ }
17
+
18
+ function restricted_fields( $acui_restricted_fields ){
19
+ return array_merge( $acui_restricted_fields, array( 'wp-access-areas' ) );
20
+ }
21
+
22
+ function import( $headers, $row, $user_id ){
23
+ $pos = array_search( 'wp-access-areas', $headers );
24
+
25
+ if( $pos === FALSE )
26
+ return;
27
+
28
+ $wpaa_labels = WPAA_AccessArea::get_available_userlabels();
29
+ $active_labels = array_map( 'trim', explode( "#", $row[ $pos ] ) );
30
+
31
+ foreach( $wpaa_labels as $wpa_label ){
32
+ if( in_array( $wpa_label->cap_title , $active_labels )){
33
+ $this->set_cap_for_user( $wpa_label->capability , $user_object , true );
34
+ }
35
+ else{
36
+ $this->set_cap_for_user( $wpa_label->capability , $user_object , false );
37
+ }
38
+ }
39
+ }
40
+
41
+ function set_cap_for_user( $capability , &$user , $add ) {
42
+ $has_cap = $user->has_cap( $capability );
43
+ $is_change = ($add && ! $has_cap) || (!$add && $has_cap);
44
+ if ( $is_change ) {
45
+ if ( $add ) {
46
+ $user->add_cap( $capability , true );
47
+ do_action( 'wpaa_grant_access' , $user , $capability );
48
+ do_action( "wpaa_grant_{$capability}" , $user );
49
+ } else if ( ! $add ) {
50
+ $user->remove_cap( $capability );
51
+ do_action( 'wpaa_revoke_access' , $user , $capability );
52
+ do_action( "wpaa_revoke_{$capability}" , $user );
53
+ }
54
+ }
55
+ }
56
+ }
57
+
58
+ $acui_wp_access_area = new ACUI_WP_Access_Area();
59
+ $acui_wp_access_area->hooks();
trunk/addons/wp-lms-course.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* this addon was originally developed by @egraznov https://wordpress.org/support/topic/lifterlms-addon/ */
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) exit;
6
+
7
+ if( !is_plugin_active( 'lifterlms/lifterlms.php' ) ){
8
+ return;
9
+ }
10
+
11
+ add_filter( 'acui_restricted_fields', 'acui_wlms_restricted_fields', 10, 1 );
12
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_wlms_documentation_after_plugins_activated' );
13
+ add_action( 'post_acui_import_single_user', 'acui_wlms_post_import_single_user', 10, 3 );
14
+
15
+ function acui_wlms_restricted_fields( $acui_restricted_fields ){
16
+ return array_merge( $acui_restricted_fields, array( 'lms_courses' ) );
17
+ }
18
+
19
+ function acui_wlms_documentation_after_plugins_activated(){
20
+ ?>
21
+ <tr valign="top">
22
+ <th scope="row"><?php _e( "LifterLMS is activated", 'import-users-from-csv-with-meta' ); ?></th>
23
+ <td>
24
+ <?php _e( "You can import users and assign them to LMS Course using next format", 'import-users-from-csv-with-meta' ); ?>.
25
+ <ul style="list-style:disc outside none; margin-left:2em;">
26
+ <li><?php _e( "lms_courses as the column title", 'import-users-from-csv-with-meta' ); ?></li>
27
+ <li><?php _e( "The value of each cell will be the NUMBER of the course to enroll (do not use slugs)", 'import-users-from-csv-with-meta' ); ?></li>
28
+ <li><?php _e( "If you want to import multiple values, you can use a list using / to separate items", 'import-users-from-csv-with-meta' ); ?></li>
29
+ </ul>
30
+ </td>
31
+ </tr>
32
+ <?php
33
+ }
34
+
35
+ function acui_wlms_post_import_single_user( $headers, $row, $user_id ){
36
+ $pos = array_search( 'lms_courses', $headers );
37
+
38
+ if( $pos === FALSE )
39
+ return;
40
+
41
+ $lms_courses = explode( '/', $row[ $pos ] );
42
+ $lms_courses = array_filter( $lms_courses, function( $value ){ return $value !== ''; } );
43
+
44
+ foreach ($lms_courses as $course) {
45
+ if ( is_int( (int)$course ) ) {
46
+ $trigger = 'admin_import_' . $user_id;
47
+ $enrolled = llms_enroll_student( $user_id, (int)$course, $trigger );
48
+ }
49
+ }
50
+ }
trunk/addons/wp-members.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'wp-members/wp-members.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_action( 'acui_tab_import_before_import_button', 'acui_wp_members_tab_import_before_import_button' );
10
+ function acui_wp_members_tab_import_before_import_button(){
11
+ ?>
12
+ <h2><?php _e( 'WP Members compatibility', 'import-users-from-csv-with-meta'); ?></h2>
13
+
14
+ <table class="form-table">
15
+ <tbody>
16
+ <tr class="form-field form-required">
17
+ <th scope="row"><label>Activate user when they are being imported?</label></th>
18
+ <td>
19
+ <select name="activate_users_wp_members">
20
+ <option value="no_activate"><?php _e( 'Do not activate users', 'import-users-from-csv-with-meta' ); ?></option>
21
+ <option value="activate"><?php _e( 'Activate users when they are being imported', 'import-users-from-csv-with-meta' ); ?></option>
22
+ </select>
23
+
24
+ <p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/wp-members/"><?php _e( 'WP Members', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta' ); ?>)</strong>.</p>
25
+ </td>
26
+
27
+ </tr>
28
+ </tbody>
29
+ </table>
30
+ <?php
31
+ }
32
+
33
+ add_action( 'acui_tab_frontend_before_save_button', 'acui_wp_members_tab_frontend_before_save_button' );
34
+ function acui_wp_members_tab_frontend_before_save_button(){
35
+ ?>
36
+ <h2><?php _e( 'WP Members compatibility', 'import-users-from-csv-with-meta'); ?></h2>
37
+ <table class="form-table">
38
+ <tbody>
39
+
40
+ <tr class="form-field form-required">
41
+ <th scope="row"><label>Activate user when they are being imported?</label></th>
42
+ <td>
43
+ <select name="activate-users-wp-members-frontend">
44
+ <option value="no_activate" <?php selected( $activate_users_wp_members,'no_activate', true ); ?>><?php _e( 'Do not activate users', 'import-users-from-csv-with-meta' ); ?></option>
45
+ <option value="activate" <?php selected( $activate_users_wp_members,'activate', true ); ?>><?php _e( 'Activate users when they are being imported', 'import-users-from-csv-with-meta' ); ?></option>
46
+ </select>
47
+
48
+ <p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/wp-members/"><?php _e( 'WP Members', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta' ); ?>)</strong>.</p>
49
+ </td>
50
+ </tr>
51
+ </tbody>
52
+ </table>
53
+ <?php
54
+ }
55
+
56
+ add_action( 'post_acui_import_single_user', 'acui_wp_members_post_acui_import_single_user', 10, 6 );
57
+ function acui_wp_members_post_acui_import_single_user( $headers, $data, $user_id, $role, $positions, $form_data ){
58
+ $activate_users_wp_members = ( !isset( $form_data["activate_users_wp_members"] ) || empty( $form_data["activate_users_wp_members"] ) ) ? "no_activate" : sanitize_text_field( $form_data["activate_users_wp_members"] );
59
+ if( $activate_users_wp_members == "activate" ){
60
+ update_user_meta( $user_id, "active", true );
61
+ }
62
+ }
trunk/addons/wp-private-content-plus.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'wp-private-content-plus/wp-private-content-plus.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_WP_Private_Content_Plus{
10
+ function __construct(){
11
+ }
12
+
13
+ function bootstrap(){
14
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
15
+ add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
16
+ add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 3 );
17
+ add_action( 'post_acui_import_single_user', array( $this, 'import' ), 10, 3 );
18
+ }
19
+
20
+ function restricted_fields( $acui_restricted_fields ){
21
+ return array_merge( $acui_restricted_fields, array( 'wp_private_content_plus_groups' ) );
22
+ }
23
+
24
+ function export_columns( $row ){
25
+ $row[] = 'wp_private_content_plus_groups';
26
+ return $row;
27
+ }
28
+
29
+ function export_data( $row, $user_id ){
30
+ global $wppcp;
31
+ $user_groups = $wppcp->groups->get_user_groups_by_id( $user_id );
32
+ $user_groups_slugs = array();
33
+
34
+ foreach( $user_groups as $user_group ){
35
+ $user_group_object = get_post( $user_group );
36
+
37
+ if( is_a( $user_group_object, 'WP_Post') )
38
+ $user_groups_slugs[] = $user_group_object->post_name;
39
+ }
40
+
41
+ $row[] = implode( ',', $user_groups_slugs );
42
+ return $row;
43
+ }
44
+
45
+ function import( $headers, $row, $user_id ){
46
+ global $wpdb;
47
+
48
+ $pos_wp_private_content_plus_groups = array_search( 'wp_private_content_plus_groups', $headers );
49
+ if( $pos_wp_private_content_plus_groups === FALSE )
50
+ return;
51
+
52
+ $wp_private_content_plus_groups = explode( ',', $row[ $pos_wp_private_content_plus_groups ] );
53
+ if( !is_array( $wp_private_content_plus_groups ) )
54
+ return;
55
+
56
+ foreach( $wp_private_content_plus_groups as $group ){
57
+ $user_id = (int) $user_id;
58
+ $group_object = get_page_by_path( $group, OBJECT, 'wppcp_group' );
59
+
60
+ if( empty( $group_object ) )
61
+ continue;
62
+
63
+ $wpdb->get_results( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wppcp_group_users where group_id=%d and user_id=%d", $group_object->ID , $user_id) );
64
+ $wpdb->get_results( $wpdb->prepare( "INSERT INTO {$wpdb->prefix}wppcp_group_users( group_id, user_id, updated_at) values(%d,%d,'%s')", $group_object->ID , $user_id, date("Y-m-d H:i:s") ) );
65
+ }
66
+ }
67
+ }
68
+
69
+ $acui_wp_private_content_plus = new ACUI_WP_Private_Content_Plus();
70
+ $acui_wp_private_content_plus->bootstrap();
trunk/addons/wp-user-avatar.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'wp-user-avatar/wp-user-avatar.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_WPUA{
10
+ var $meta_key;
11
+
12
+ function __construct(){
13
+ global $blog_id, $wpdb;
14
+ $this->meta_key = $wpdb->get_blog_prefix( $blog_id ) . 'user_avatar';
15
+ }
16
+
17
+ function hooks(){
18
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
19
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation_after_plugins_activated' ) );
20
+ add_action( 'post_acui_import_single_user', array( $this, 'post_import_single_user' ), 10, 3 );
21
+ add_filter( 'acui_export_columns', array( $this, 'export_columns' ), 10, 1 );
22
+ add_filter( 'acui_export_data', array( $this, 'export_data' ), 10, 3 );
23
+ }
24
+
25
+ function restricted_fields( $acui_restricted_fields ){
26
+ return array_merge( $acui_restricted_fields, array( 'avatar_url' ) );
27
+ }
28
+
29
+ function documentation_after_plugins_activated(){
30
+ ?>
31
+ <tr valign="top">
32
+ <th scope="row"><?php _e( "WP Users Avatar is activated", 'import-users-from-csv-with-meta' ); ?></th>
33
+ <td>
34
+ <?php _e( "You can import user avatar and assign them to the users using the next format", 'import-users-from-csv-with-meta' ); ?>.
35
+ <ul style="list-style:disc outside none; margin-left:2em;">
36
+ <li><?php _e( "avatar_url as the column title", 'import-users-from-csv-with-meta' ); ?></li>
37
+ <li><?php _e( "The value of each cell will be the url to the image in your system", 'import-users-from-csv-with-meta' ); ?></li>
38
+ </ul>
39
+ </td>
40
+ </tr>
41
+ <?php
42
+ }
43
+
44
+ function post_import_single_user( $headers, $row, $user_id ){
45
+ $pos = array_search( 'avatar_url', $headers );
46
+
47
+ if( $pos === FALSE )
48
+ return;
49
+
50
+ $avatar_url = $row[ $pos ];
51
+
52
+ $avatar_id = media_sideload_image( $avatar_url, 0, 'Avatar of user ' . $user_id, 'id' );
53
+ update_user_meta( $user_id, $this->meta_key, $avatar_id );
54
+ }
55
+
56
+ function export_columns( $row ){
57
+ $row[] = 'user_avatar';
58
+ return $row;
59
+ }
60
+
61
+ function export_data( $row, $user ){
62
+ $row[] = wp_get_attachment_url( get_user_meta( $user, $this->meta_key, true ) );
63
+ return $row;
64
+ }
65
+ }
66
+
67
+ $acui_wpua = new ACUI_WPUA();
68
+ $acui_wpua->hooks();
trunk/addons/wp-user-manager.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ if( !is_plugin_active( 'wp-user-manager/wp-user-manager.php' ) ){
5
+ return;
6
+ }
7
+
8
+ class ACUI_WP_User_Manager{
9
+ function __construct(){
10
+ add_filter( 'acui_force_reset_password_edit_profile_url', array( $this, 'force_reset_password_edit_profile_url' ) );
11
+ add_filter( 'acui_force_reset_password_redirect_condition', array( $this, 'force_reset_password_redirect_condition' ), 10 , 1 );
12
+ add_action( 'wpum_account_page_content', array( $this, 'force_reset_password_notice' ), 1 );
13
+ add_action( 'wpum_after_user_password_recovery', array( $this, 'force_reset_save_account_details' ) );
14
+ add_action( 'wpum_account_page_content', array( $this, 'maybe_force_reset_save_account_details' ), 0 );
15
+ }
16
+
17
+ function force_reset_password_edit_profile_url(){
18
+ global $wpdb;
19
+ $query = "SELECT ID FROM ".$wpdb->posts." WHERE post_content LIKE '%[wpum_account]%' AND post_status = 'publish'";
20
+ $results = $wpdb->get_results( $query );
21
+ $result = $results[0];
22
+
23
+ return get_permalink( $result->ID ) . "/password";
24
+ }
25
+
26
+ function force_reset_password_redirect_condition( $condition ){
27
+ global $post;
28
+ return ( $post instanceof WP_Post ) ? has_shortcode( $post->post_content, 'wpum_account' ) : $condition;
29
+ }
30
+
31
+ function force_reset_password_notice(){
32
+ if ( get_user_meta( get_current_user_id(), 'acui_force_reset_password', true ) ) {
33
+ echo apply_filters( 'acui_force_reset_password_message', __( '<span class="acui_force_reset_password_message">Please change your password</span>', 'import-users-from-csv-with-meta' ) );
34
+ }
35
+ }
36
+
37
+ function force_reset_save_account_details( $user_id ){
38
+ delete_user_meta( $user_id, 'acui_force_reset_password' );
39
+ }
40
+
41
+ function maybe_force_reset_save_account_details(){
42
+ if( !isset( $_GET ) || empty( $_GET ) )
43
+ return;
44
+
45
+ if( isset( $_GET['password-updated'] ) && $_GET['password-updated'] == 'success' && isset( $_GET['tab'] ) && $_GET['tab'] == 'password' )
46
+ delete_user_meta( get_current_user_id(), 'acui_force_reset_password' );
47
+ }
48
+ }
49
+ new ACUI_WP_User_Manager();
trunk/addons/wp-users-group.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'wp-user-groups/wp-user-groups.php' ) ){
6
+ return;
7
+ }
8
+
9
+ add_filter( 'acui_restricted_fields', 'acui_wpug_restricted_fields', 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_wpug_documentation_after_plugins_activated' );
11
+ add_action( 'post_acui_import_single_user', 'acui_wpug_post_import_single_user', 10, 3 );
12
+
13
+ function acui_wpug_restricted_fields( $acui_restricted_fields ){
14
+ return array_merge( $acui_restricted_fields, array( 'user_group' ) );
15
+ }
16
+
17
+ function acui_wpug_documentation_after_plugins_activated(){
18
+ ?>
19
+ <tr valign="top">
20
+ <th scope="row"><?php _e( "WP Users Group is activated", 'import-users-from-csv-with-meta' ); ?></th>
21
+ <td>
22
+ <?php _e( "You can import user groups and assign them to the users using the next format", 'import-users-from-csv-with-meta' ); ?>.
23
+ <ul style="list-style:disc outside none; margin-left:2em;">
24
+ <li><?php _e( "user_group as the column title", 'import-users-from-csv-with-meta' ); ?></li>
25
+ <li><?php _e( "The value of each cell will be the name of the user group (do not use slugs)", 'import-users-from-csv-with-meta' ); ?></li>
26
+ <li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
27
+ </ul>
28
+ </td>
29
+ </tr>
30
+ <?php
31
+ }
32
+
33
+ function acui_wpug_post_import_single_user( $headers, $row, $user_id ){
34
+ $pos = array_search( 'user_group', $headers );
35
+
36
+ if( $pos === FALSE )
37
+ return;
38
+
39
+ $user_groups = explode( ',', $row[ $pos ] );
40
+ $user_groups = array_filter( $user_groups, function( $value ){ return $value !== ''; } );
41
+
42
+ $taxonomy = 'user-group';
43
+ $terms = array();
44
+
45
+ foreach ( $user_groups as $user_group ) {
46
+ $term = get_term_by( 'name', $user_group , $taxonomy );
47
+
48
+ if( $term == false ){
49
+ $term = wp_insert_term( $user_group, $taxonomy);
50
+ $terms[] = $term['term_id'];
51
+ }else{
52
+ $terms[] = $term->term_id;
53
+ }
54
+ }
55
+
56
+ wp_set_object_terms( $user_id, $terms, $taxonomy, false );
57
+ clean_object_term_cache( $user_id, $taxonomy );
58
+ }
trunk/addons/wpml.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_WPML{
10
+ function __construct(){
11
+ }
12
+
13
+ function hooks(){
14
+ add_filter( 'acui_import_email_body_source', array( $this, 'translated_body' ), 10, 5 );
15
+ add_filter( 'acui_import_email_subject_source', array( $this, 'translated_subject' ), 10, 5 );
16
+ }
17
+
18
+ function get_translated_template( $template_id, $locale ){
19
+ $translated_template_id = apply_filters( 'wpml_object_id', $template_id, 'acui_email_template', false, $locale );
20
+
21
+ if( empty( $translated_template_id ) )
22
+ return false;
23
+
24
+ return get_post( $translated_template_id );
25
+ }
26
+
27
+ function translated_body( $body, $headers, $data, $created, $user_id ){
28
+ $locale = ACUI_Helper::get_value_from_row( 'locale', $headers, $data );
29
+
30
+ if( empty( $locale ) )
31
+ $locale = apply_filters( 'wpml_current_language', NULL );
32
+
33
+ $template_id = get_option( "acui_mail_template_id" );
34
+ $locale = substr( $locale, 0, 2 );
35
+
36
+ $translated_template = $this->get_translated_template( $template_id, $locale );
37
+
38
+ if( empty( $translated_template ) )
39
+ return $body;
40
+
41
+ return $translated_template->post_content;
42
+ }
43
+
44
+ function translated_subject( $body, $headers, $data, $created, $user_id ){
45
+ $locale = ACUI_Helper::get_value_from_row( 'locale', $headers, $data, $user_id );
46
+
47
+ if( empty( $locale ) )
48
+ return $body;
49
+
50
+ $template_id = get_option( "acui_mail_template_id" );
51
+ $locale = substr( $locale, 0, 2 );
52
+
53
+ $translated_template = $this->get_translated_template( $template_id, $locale );
54
+
55
+ if( empty( $translated_template ) )
56
+ return $body;
57
+
58
+ return $translated_template->post_title;
59
+ }
60
+
61
+
62
+ }
63
+
64
+ $acui_wpml = new ACUI_WPML();
65
+ $acui_wpml->hooks();
trunk/addons/wpum-groups.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( !is_plugin_active( 'wpum-groups/wpum-groups.php' ) ){
6
+ return;
7
+ }
8
+
9
+ class ACUI_WPUM_Groups{
10
+ function __construct(){
11
+ }
12
+
13
+ function hooks(){
14
+ add_action( 'post_acui_import_single_user', array( $this, 'assign_group' ), 10, 7 );
15
+ }
16
+
17
+ function assign_group( $headers, $data, $user_id, $role, $positions, $form_data, $is_frontend ){
18
+ if( !$is_frontend )
19
+ return;
20
+
21
+ $group_ids = wpumgrp_get_user_group_ids( get_current_user_id() );
22
+ if( empty( $group_ids ) )
23
+ return;
24
+
25
+ foreach( $group_ids as $group_id ){
26
+ wpumgp_join_group( $group_id, $user_id );
27
+ wpumgr_approve_group_member( $group_id, $user_id );
28
+ }
29
+ }
30
+ }
31
+
32
+ $acui_wpum_groups = new ACUI_WPUM_Groups();
33
+ $acui_wpum_groups->hooks();
trunk/assets/codection-inmotion.png ADDED
Binary file
trunk/assets/email-options.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ 'use strict';
3
+
4
+ $( '#acui_email_option_remove_upload_button' ).click( function(){
5
+ var data = {
6
+ 'action': 'acui_mail_options_remove_attachment',
7
+ 'security': email_options.security,
8
+ };
9
+
10
+ $.post( ajaxurl, data, function( response ) {
11
+ location.reload();
12
+ });
13
+ } );
14
+
15
+ $( '#acui_email_template_remove_upload_button' ).click( function(){
16
+ $( '#email_template_attachment_file' ).val( '' );
17
+ $( '#email_template_attachment_id' ).val( '' );
18
+ } );
19
+
20
+ $( '#send_test_email' ).click( function(){
21
+ var data = {
22
+ 'action': 'acui_send_test_email',
23
+ 'security': email_options.security,
24
+ };
25
+
26
+ $.post( ajaxurl, data, function( response ) {
27
+ alert( email_options.success_message );
28
+ });
29
+ })
30
+ });
trunk/assets/email-template-attachment-admin.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ 'use strict';
3
+ var attachmentFrame;
4
+
5
+ $( '#acui_email_option_upload_button,#acui_email_template_upload_button' ).click(function(e) {
6
+ var btn = e.target;
7
+
8
+ if ( !btn ) return;
9
+
10
+ e.preventDefault();
11
+
12
+ attachmentFrame = wp.media.frames.attachmentFrame = wp.media({
13
+ title: email_template_attachment_admin.title,
14
+ button: { text: email_template_attachment_admin.button },
15
+ });
16
+
17
+ attachmentFrame.on('select', function() {
18
+ var media_attachment = attachmentFrame.state().get('selection').first().toJSON();
19
+
20
+ $( '#email_template_attachment_file' ).val( media_attachment.url );
21
+ $( '#email_template_attachment_id' ).val( media_attachment.id );
22
+ });
23
+
24
+ attachmentFrame.open();
25
+ });
26
+
27
+ $( '#enable_email_templates' ).change( function(){
28
+ var enable = $( this ).is( ':checked' );
29
+ var data = {
30
+ 'action': 'acui_refresh_enable_email_templates',
31
+ 'enable': enable,
32
+ 'security': email_template_attachment_admin.security,
33
+ };
34
+
35
+ $.post( ajaxurl, data, function( response ) {
36
+ location.reload();
37
+ });
38
+ } );
39
+
40
+ $( '#load_email_template' ).click( function(){
41
+ if( $( '#email_template_selected' ).val() == '' )
42
+ return;
43
+
44
+ var data = {
45
+ 'action': 'acui_email_template_selected',
46
+ 'email_template_selected': $( '#email_template_selected' ).val(),
47
+ 'security': email_template_attachment_admin.security,
48
+ };
49
+
50
+ $.post( ajaxurl, data, function( response ) {
51
+ var response = JSON.parse( response );
52
+ $( '#title' ).val( response.title );
53
+
54
+ if( typeof( tinyMCE ) === "undefined" )
55
+ $( 'body_mail' ).val( response.content );
56
+ else
57
+ tinyMCE.get( 'body_mail' ).setContent( response.content );
58
+
59
+ $( '#email_template_attachment_id' ).val( response.attachment_id );
60
+ if( response.attachment_url != '' ){
61
+ $( '#email_template_attachment_file' ).val( response.attachment_url );
62
+ }
63
+ $( '#template_id' ).val( response.id );
64
+ $( '#save_mail_template_options' ).click();
65
+ });
66
+ } );
67
+ });
trunk/assets/export.js ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function ( $, window ) {
2
+ var userExportForm = function( $form ) {
3
+ this.$form = $form;
4
+ this.xhr = false;
5
+
6
+ this.$form.find( '.user-exporter-progress' ).val( 0 );
7
+ this.processStep = this.processStep.bind( this );
8
+ $form.on( 'submit', { userExportForm: this }, this.onSubmit );
9
+ };
10
+
11
+ userExportForm.prototype.onSubmit = function( event ) {
12
+ event.preventDefault();
13
+
14
+ $( "html, body" ).animate({ scrollTop: 0 }, "slow" );
15
+
16
+ var currentDate = new Date(),
17
+ day = currentDate.getDate(),
18
+ month = currentDate.getMonth() + 1,
19
+ year = currentDate.getFullYear(),
20
+ timestamp = currentDate.getTime(),
21
+ filename = 'user-export-' + day + '-' + month + '-' + year + '-' + timestamp + '.csv';
22
+
23
+ event.data.userExportForm.$form.addClass( 'user-exporter__exporting' );
24
+ event.data.userExportForm.$form.find( '.user-exporter-progress' ).val( 0 );
25
+ event.data.userExportForm.$form.find( '.user-exporter-progress-value' ).text( acui_export_js_object.starting_process + " - 0%" );
26
+ event.data.userExportForm.processStep( 1, $( this ).serialize(), '', filename );
27
+ };
28
+
29
+ userExportForm.prototype.processStep = function( step, data, filename ) {
30
+ var $this = this;
31
+ var frontend = $( '[name="acui_frontend_export"]' ).val();
32
+ var convert_timestamp, order_fields_alphabetically, double_encapsulate_serialized_values;
33
+
34
+ if( frontend == 1 ){
35
+ convert_timestamp = $this.$form.find( '[name="convert_timestamp"]' ).val();
36
+ order_fields_alphabetically = $this.$form.find( '[name="order_fields_alphabetically"]' ).val();
37
+ double_encapsulate_serialized_values = $this.$form.find( '[name="double_encapsulate_serialized_values"]' ).val();
38
+ }
39
+ else{
40
+ convert_timestamp = $this.$form.find( '[name="convert_timestamp"]' ).is( ":checked");
41
+ order_fields_alphabetically = $this.$form.find( '[name="order_fields_alphabetically"]' ).is( ":checked");
42
+ double_encapsulate_serialized_values = $this.$form.find( '[name="double_encapsulate_serialized_values"]' ).is( ":checked");
43
+ }
44
+
45
+ $.ajax( {
46
+ type: 'POST',
47
+ url: acui_export_js_object.ajaxurl,
48
+ data: {
49
+ form: data,
50
+ action: 'acui_export_users_csv',
51
+ step: step,
52
+ filename: filename,
53
+ delimiter: $this.$form.find( '[name="delimiter"]' ).val(),
54
+ role: $this.$form.find( '[name="role"]' ).val(),
55
+ from: $this.$form.find( '[name="from"]' ).val(),
56
+ to: $this.$form.find( '[name="to"]' ).val(),
57
+ convert_timestamp: convert_timestamp,
58
+ datetime_format: $this.$form.find( '[name="datetime_format"]' ).val(),
59
+ order_fields_alphabetically: order_fields_alphabetically,
60
+ double_encapsulate_serialized_values: double_encapsulate_serialized_values,
61
+ columns: $this.$form.find( '[name="columns"]' ).val(),
62
+ orderby: $this.$form.find( '[name="orderby"]' ).val(),
63
+ order: $this.$form.find( '[name="order"]' ).val(),
64
+ security: $this.$form.find( '#security' ).val(),
65
+ },
66
+ dataType: 'json',
67
+ success: function( response ) {
68
+ if ( response.success ) {
69
+ if ( 'done' === response.data.step ) {
70
+ $this.$form.find('.user-exporter-progress').val( response.data.percentage );
71
+ $this.$form.find('.user-exporter-progress-value').text( response.data.percentage + "%" );
72
+ window.location = response.data.url;
73
+ setTimeout( function() {
74
+ $this.$form.removeClass( 'user-exporter__exporting' );
75
+ $( '#acui_download_csv_wrapper > td > input' ).prop( 'disabled', false );
76
+ }, 2000 );
77
+ } else {
78
+ $this.$form.find( '.user-exporter-progress' ).val( response.data.percentage );
79
+ $this.$form.find( '.user-exporter-progress-value' ).text( acui_export_js_object.step + " " + response.data.step + " " + acui_export_js_object.of_approximately + " " + response.data.total_steps + " " + acui_export_js_object.steps + " - " + response.data.percentage + "%" );
80
+ $this.processStep( parseInt( response.data.step, 10 ), data, filename );
81
+ }
82
+ }
83
+ }
84
+ } ).fail( function( response ) {
85
+ window.console.log( response );
86
+ alert( acui_export_js_object.error_thrown );
87
+ } );
88
+ };
89
+
90
+ $.fn.user_export_form = function() {
91
+ new userExportForm( this );
92
+ return this;
93
+ };
94
+
95
+ $( '#acui_exporter' ).user_export_form();
96
+ })( jQuery, window );
trunk/assets/icon_coffee.png ADDED
Binary file
trunk/assets/iontics_logo.svg ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ width="114px" height="49.3px" viewBox="0 0 114 49.3" style="enable-background:new 0 0 114 49.3;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#333333;}
7
+ .st1{fill:#C1D548;}
8
+ </style>
9
+ <g>
10
+ <path class="st0" d="M8,7.3h0.3c1.6,0,3,1.3,3,3l0,0c0,1.6-1.3,3-3,3H8c-1.6-0.1-3-1.4-3-3.1l0,0C5,8.6,6.3,7.3,8,7.3z M5,16.1
11
+ l1.9,0.7c0.8,0.3,1.7,0.3,2.5,0l1.9-0.7v25.4H5V16.1z"/>
12
+ <path class="st0" d="M14.4,23c0-3.1,1.1-7.4,8.6-7.4c1.9,0,4.2,0.4,5.7,1.4c2.3,1.5,2.6,3.6,2.6,5.7v12.2c0,4.6-3.1,7.1-8.7,7.1
13
+ c-8.3,0-8.3-5.8-8.3-7.7L14.4,23L14.4,23z M20.7,35.3c0,0.6,0,2.6,2.2,2.6c2.2,0,2.2-1.7,2.2-2.7V22.4c0-1.5-0.2-3.1-2.1-3.1
14
+ c-2.3,0-2.3,1.9-2.3,3.1V35.3z"/>
15
+ <path class="st0" d="M34.4,16.1h6.4L40.8,18c1.2-1.2,2.6-2.4,5.5-2.4c1.9,0,3.5,0.7,4.3,1.7c1.2,1.3,1.2,2.8,1.2,4.3v19.8h-6.2
16
+ V22.8c0-1.4-0.1-3.1-2.2-3.1c-2.6,0-2.6,2.2-2.6,3.4v18.3h-6.3C34.4,41.4,34.4,16.1,34.4,16.1z"/>
17
+ <path class="st1" d="M55.2,20L55.1,7h6.3v9.1h3.8V20h-3.8v14.5c0,1.6,0.3,2.8,2.9,2.8c0.4,0,0.7-0.1,1.1-0.1v4.2
18
+ c-0.4,0.1-1.2,0.3-3.3,0.3c-6,0-6.9-2.1-6.9-5.3L55.2,20"/>
19
+ <path class="st1" d="M70.5,6.9h0.3c1.6,0,3,1.3,3,3l0,0c0,1.6-1.3,3-3,3h-0.3c-1.6,0-3-1.3-3-3l0,0C67.5,8.3,68.8,6.9,70.5,6.9z"/>
20
+ <path class="st1" d="M87.4,25.7v-3.1c0-0.9,0-2.8-2.3-2.8c-2.6,0-2.6,2.2-2.6,3.5v11c0,1.2,0,3.3,2.5,3.3c2.4,0,2.5-2.2,2.5-3.3
21
+ v-2.9h6.3v2.9c0,5.2-2.9,7.7-8.7,7.7c-1.4,0-4.3-0.2-6.4-1.7c-2.1-1.5-2.4-3.6-2.4-5.6V23.4c0-1.7,0.4-3.6,1.5-4.9
22
+ c1.7-2,4.5-2.8,7.3-2.8c2.3,0,4.8,0.6,6.4,1.8c1.6,1.3,2.2,2.9,2.2,5.3v2.9H87.4z"/>
23
+ <path class="st1" d="M67.5,16.1l1.9,0.7c0.8,0.3,1.7,0.3,2.5,0l1.9-0.7v25.4h-6.3V16.1z"/>
24
+ <path class="st1" d="M95.3,32.6h5.8c0,3.6,0,5.2,2.5,5.2c1.4,0,2.5-0.6,2.5-2.8c0-1.5-0.1-2.2-1.9-3.3l-5.3-3.5
25
+ c-0.4-0.2-1.3-1.1-1.8-1.5c-0.7-0.8-1.5-1.8-1.5-4.5c0-5.3,3.7-6.5,8.2-6.5c5.5,0,7.7,2.2,7.7,5.9v2.8h-5.5c0-2.9,0-4.6-2.3-4.6
26
+ c-0.9,0-2.2,0.2-2.2,2.2c0,0.7,0.1,1.6,1.8,2.8l5.8,3.8c0.4,0.2,1.5,1.3,1.8,1.7c0.8,1,0.9,2.3,0.9,3.9c0,3.3,0,7.8-8.4,7.8
27
+ c-6.8,0-8.2-3.3-8.2-6.7V32.6z"/>
28
+ </g>
29
+ </svg>
trunk/assets/style.css ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .acui .main_bar{
2
+ float: left;
3
+ width: 80%;
4
+ }
5
+
6
+ .acui .sidebar {
7
+ float: right;
8
+ font-size: 12px;
9
+ margin: 0 1%;
10
+ width: 18%;
11
+ }
12
+
13
+ .acui .sidebar_section{
14
+ background-color: #F6F6F6;
15
+ border: 1px solid #8A2BE2;
16
+ float: left;
17
+ margin: 0 0 10px;
18
+ padding: 10px;
19
+ width: 100%;
20
+ }
21
+
22
+ .acui .sidebar_section.become_patreon,
23
+ .acui .sidebar_section.buy_me_a_coffee,
24
+ .acui .sidebar_section.vote_us,
25
+ .acui .sidebar_section.donate{
26
+ background-color: transparent;
27
+ border: 0;
28
+ }
29
+
30
+ .acui .sidebar ul {
31
+ margin: 0;
32
+ padding: 0;
33
+ }
34
+
35
+ .acui .sidebar li {
36
+ font-size: 11px;
37
+ line-height: 16px;
38
+ list-style: disc outside none;
39
+ margin: 5px 0 5px 20px;
40
+ }
41
+
42
+ .acui .sidebar h3 {
43
+ margin: 0 0 10px;
44
+ }
45
+
46
+ .acui .sidebar img {
47
+ display: block;
48
+ margin: 0 auto;
49
+ }
50
+
51
+ .acui .sidebar_section label {
52
+ font-size: 11px;
53
+ }
54
+
55
+ .acui .sidebar_section.webempresa img {
56
+ width: 100%;
57
+ }
58
+
59
+ .acui #vote_us{
60
+ cursor: pointer;
61
+ }
62
+
63
+ .acui .patreon,
64
+ .acui .ko-fi,
65
+ .acui .vote-us,
66
+ .acui .donate-button{
67
+ backface-visibility: hidden;
68
+ background-color: rgb(249, 104, 84);
69
+ box-sizing: border-box;
70
+ display: inline-block;
71
+ font-weight: 700;
72
+ position: relative;
73
+ text-align: center;
74
+ text-transform: uppercase;
75
+ user-select: none;
76
+ white-space: inherit;
77
+ cursor: pointer;
78
+ width: 100%;
79
+ color: rgb(255, 255, 255) !important;
80
+ font-size: 1rem !important;
81
+ border-width: 2px;
82
+ border-style: solid;
83
+ border-color: rgb(249, 104, 84);
84
+ border-image: initial;
85
+ border-radius: 0px;
86
+ padding: 0.75rem 1rem;
87
+ text-decoration: none;
88
+ transition: all 300ms cubic-bezier(0.19, 1, 0.22, 1);
89
+ }
90
+
91
+ .acui-subsubsub{
92
+ list-style: none;
93
+ padding: 0;
94
+ font-size: 13px;
95
+ float: left;
96
+ color: #646970;
97
+ margin: 0 0 10px;
98
+ width: 100%;
99
+ border-bottom: 1px solid #ccc;
100
+ box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
101
+ }
102
+
103
+ .acui-subsubsub li {
104
+ display: inline-block;
105
+ margin: 0;
106
+ padding: 0;
107
+ white-space: nowrap;
108
+ }
109
+
110
+ .acui-subsubsub a {
111
+ padding: 13px;
112
+ display: block;
113
+ line-height: 2;
114
+ text-decoration: none;
115
+ }
116
+
117
+ .acui-subsubsub a.current {
118
+ color: #000;
119
+ border-bottom: 4px solid #00a0d2;
120
+ padding-bottom: 9px;
121
+ }
122
+
123
+ /* settings */
124
+ #acui_roles_wrapper label.roles{
125
+ margin-right: 5px;
126
+ }
127
+
128
+ input[type=checkbox].acui-checkbox{
129
+ margin-left: 2px;
130
+ }
131
+
132
+ /* dataTables */
133
+ .dataTables_wrapper .dataTables_length select{
134
+ font-size: 13px;
135
+ background: none;
136
+ line-height: 1;
137
+ min-height: 13px;
138
+ }
139
+
140
+ /* exporter */
141
+ #acui_exporter .user-exporter-progress-wrapper{
142
+ padding: 5px;
143
+ background-color: white;
144
+ width: 80%;
145
+ margin: 0 auto;
146
+ text-align: center;
147
+ }
148
+
149
+ #acui_exporter .user-exporter-progress{
150
+ width: 100%;
151
+ height: 42px;
152
+ border: 0;
153
+ border-radius: 9px;
154
+ }
155
+ .user-exporter-progress::-webkit-progress-bar {
156
+ background-color: #f3f3f3;
157
+ border-radius: 9px;
158
+ }
159
+
160
+ .user-exporter-progress::-webkit-progress-value {
161
+ background: #2271b1;
162
+ border-radius: 9px;
163
+ }
164
+
165
+ .user-exporter-progress::-moz-progress-bar {
166
+ background: #2271b1;
167
+ border-radius: 9px;
168
+ }
169
+
170
+ .user-exporter-progress .progress-value {
171
+ padding: 0px 5px;
172
+ line-height: 20px;
173
+ margin-left: 5px;
174
+ font-size: .8em;
175
+ color: #555;
176
+ height: 18px;
177
+ float: right;
178
+ }
179
+
180
+ #acui_exporter.user-exporter__exporting table,
181
+ #acui_exporter .user-exporter-progress-wrapper{
182
+ display: none;
183
+ }
184
+
185
+ #acui_exporter.user-exporter__exporting .user-exporter-progress-wrapper{
186
+ display: block;
187
+ }
trunk/assets/webempresa_logo.png ADDED
Binary file
trunk/classes/actions.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Actions{
5
+ var $prefix;
6
+ var $registered;
7
+
8
+ function __construct(){
9
+ $this->prefix = '#action_';
10
+ $this->registered = array( 'assign_post' );
11
+ }
12
+
13
+ function hooks(){
14
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ) );
15
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
16
+
17
+ foreach( $this->registered as $registered_action ){
18
+ add_action( 'acui_action_' . $registered_action, array( $this, $registered_action ), 10, 6 );
19
+ }
20
+
21
+ add_action( 'post_acui_import_single_user', array( $this, 'run' ), 10, 8 );
22
+ }
23
+
24
+ function check_prefix( $header ){
25
+ return ( substr( $header, 0, strlen( $this->prefix ) ) === $this->prefix );
26
+ }
27
+
28
+ function remove_prefix( $header ){
29
+ return substr( $header, strlen( $this->prefix ) );
30
+ }
31
+
32
+ function restricted_fields( $fields ){
33
+ $actions = array();
34
+ foreach( $this->registered as $registered_action )
35
+ $actions[] = $this->prefix . $registered_action;
36
+
37
+ return array_merge( $fields, $actions );
38
+ }
39
+
40
+ function run( $headers, $data, $user_id, $role, $positions, $form_data, $is_frontend, $is_cron ){
41
+ $actions = $this->get_actions_from_headers( $headers );
42
+
43
+ if( empty( $actions ) )
44
+ return;
45
+
46
+ foreach( $actions as $pos => $action ){
47
+ do_action( 'acui_action_' . $action, $user_id, $role, $data[ $pos ], $form_data, $is_frontend, $is_cron );
48
+ }
49
+ }
50
+
51
+ function get_actions_from_headers( $headers ){
52
+ $actions = array();
53
+
54
+ foreach( $headers as $pos => $header ){
55
+ if( $this->is_action( $header ) )
56
+ $actions[ $pos ] = $this->remove_prefix( $header );
57
+ }
58
+
59
+ return $actions;
60
+ }
61
+
62
+ function is_action( $header ){
63
+ if( !$this->check_prefix( $header ) )
64
+ return false;
65
+
66
+ return in_array( $this->remove_prefix( $header ), $this->registered );
67
+ }
68
+
69
+ function documentation(){
70
+ ?>
71
+ <tr valign="top">
72
+ <th scope="row"><?php _e( 'Actions', 'import-users-from-csv-with-meta' ); ?></th>
73
+ <td><?php _e( 'You can do some actions while you are importing. You have to name the column as indicated below and follow the instructions:', 'import-users-from-csv-with-meta' ); ?>
74
+ <ul style="list-style:disc outside none;margin-left:2em;">
75
+ <li><strong>#action_assign_post</strong>: <?php _e( 'Within each cell, you must indicate the post_id that will be assigned to this user. You can use a list separating each ID by commas. The post can be of any post type.', 'import-users-from-csv-with-meta' ); ?></li>
76
+ </ul>
77
+ </td>
78
+ </tr>
79
+ <?php
80
+ }
81
+
82
+ function assign_post( $user_id, $role, $data_cell, $form_data, $is_frontend, $is_cron ){
83
+ $post_ids = explode( ',', $data_cell );
84
+
85
+ foreach( $post_ids as $post_id ){
86
+ wp_update_post( array(
87
+ 'ID' => intval( $post_id ),
88
+ 'post_author' => $user_id,
89
+ ) );
90
+ }
91
+ }
92
+ }
93
+
94
+ $acui_actions = new ACUI_Actions();
95
+ $acui_actions->hooks();
trunk/classes/batch_exporter.php ADDED
@@ -0,0 +1,695 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+ class ACUI_Batch_Exporter{
8
+ protected $path = '';
9
+ protected $filename = 'user-export.csv';
10
+ protected $limit = 50;
11
+ protected $exported_row_count = 0;
12
+ protected $row_data = array();
13
+ protected $total_rows = 0;
14
+ protected $columns_to_export = array();
15
+
16
+ protected $page = 1;
17
+ protected $delimiter = ',';
18
+ protected $role = '';
19
+ protected $from = '';
20
+ protected $to = '';
21
+ protected $convert_timestamp = false;
22
+ protected $datetime_format;
23
+ protected $order_fields_alphabetically = false;
24
+ protected $double_encapsulate_serialized_values = false;
25
+ protected $filtered_columns = array();
26
+ protected $orderby = '';
27
+ protected $order = '';
28
+
29
+ protected $user_data;
30
+ protected $accepted_order_by;
31
+ protected $woocommerce_default_user_meta_keys;
32
+ protected $other_non_date_keys;
33
+
34
+ function __construct() {
35
+ add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), 10, 2 );
36
+ add_filter( 'acui_export_get_key_user_data', array( $this, 'filter_key_user_id' ) );
37
+ add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_filtered_columns_parameter' ), 11, 2 );
38
+ add_filter( 'acui_export_data', array( $this, 'maybe_double_encapsulate_serialized_values' ), 9 - 1, 5 );
39
+ add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), 10, 5 );
40
+ add_filter( 'acui_export_data', array( $this, 'maybe_order_row_filtered_columns_parameter' ), 11, 5 );
41
+
42
+ $this->user_data = array( "user_login", "user_email", "source_user_id", "user_pass", "user_nicename", "user_url", "user_registered", "display_name" );
43
+ $this->accepted_order_by = array( 'ID', 'display_name', 'name', 'user_name', 'login', 'user_login', 'nicename', 'user_nicename', 'email', 'user_email', 'url', 'user_url', 'registered', 'user_registered', 'post_count' );
44
+ $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' );
45
+ $this->other_non_date_keys = array( 'shipping_phone', '_vat_number', '_billing_vat_number' );
46
+ $this->total_rows = $this->get_total_rows();
47
+ }
48
+
49
+ function get_non_date_keys(){
50
+ return apply_filters( 'acui_export_non_date_keys', array_merge( $this->user_data, $this->woocommerce_default_user_meta_keys, $this->other_non_date_keys ) );
51
+ }
52
+
53
+ function maybe_order_columns_alphabetacally( $row, $args ){
54
+ if( !$args['order_fields_alphabetically'] )
55
+ return $row;
56
+
57
+ $first_two_columns = array_slice( $row, 0, 2 );
58
+ $to_order_columns = array_unique( array_slice( $row, 2 ) );
59
+ sort( $to_order_columns, SORT_LOCALE_STRING );
60
+
61
+ return array_merge( $first_two_columns, $to_order_columns );
62
+ }
63
+
64
+ function filter_key_user_id( $key ){
65
+ return ( $key == 'source_user_id' ) ? 'ID' : $key;
66
+ }
67
+
68
+ function maybe_order_columns_filtered_columns_parameter( $row, $args ){
69
+ return ( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 ) ? $row : $args['filtered_columns'];
70
+ }
71
+
72
+ function maybe_order_row_alphabetically( $row, $user, $datetime_format, $columns, $args ){
73
+ if( !$args['order_fields_alphabetically'] )
74
+ return $row;
75
+
76
+ $row_sorted = array();
77
+ foreach( $columns as $field ){
78
+ $row_sorted[ $field ] = $row[ $field ];
79
+ }
80
+
81
+ return $row_sorted;
82
+ }
83
+
84
+ function maybe_order_row_filtered_columns_parameter( $row, $user, $datetime_format, $columns, $args ){
85
+ if( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 )
86
+ return $row;
87
+
88
+ $row_sorted = array();
89
+ foreach( $args['filtered_columns'] as $field ){
90
+ $row_sorted[ $field ] = $row[ $field ];
91
+ }
92
+
93
+ return $row_sorted;
94
+ }
95
+
96
+ function maybe_double_encapsulate_serialized_values( $row, $user, $datetime_format, $columns, $args ){
97
+ if( !$args['double_encapsulate_serialized_values'] )
98
+ return $row;
99
+
100
+ foreach( $columns as $field ){
101
+ if( is_serialized( $row[ $field ] ) )
102
+ $row[ $field ] = '"' . $row[ $field ] . '"';
103
+ }
104
+
105
+ return $row;
106
+ }
107
+
108
+ function load_columns(){
109
+ $row = array();
110
+
111
+ foreach ( $this->get_user_data() as $key ) {
112
+ $row[] = $key;
113
+ }
114
+
115
+ if( count( $this->get_filtered_columns() ) == 0 || in_array( 'role', $this->get_filtered_columns() ) )
116
+ $row[] = "role";
117
+
118
+ foreach ( $this->get_user_meta_keys() as $key ) {
119
+ $row[] = $key;
120
+ }
121
+
122
+ $this->set_columns_to_export( apply_filters( 'acui_export_columns', $row, array( 'order_fields_alphabetically' => $this->get_order_fields_alphabetically(), 'double_encapsulate_serialized_values' => $this->get_double_encapsulate_serialized_values(), 'filtered_columns' => $this->get_filtered_columns() ) ) );
123
+ }
124
+
125
+ function set_path( $path ){
126
+ $this->path = $path;
127
+ }
128
+
129
+ function get_path(){
130
+ return $this->path;
131
+ }
132
+
133
+ function set_columns_to_export( $columns ) {
134
+ $this->columns_to_export = $columns;
135
+ }
136
+
137
+ function get_columns_to_export() {
138
+ return $this->columns_to_export;
139
+ }
140
+
141
+ function set_delimiter( $delimiter ){
142
+ switch ( $delimiter ) {
143
+ case 'COMMA':
144
+ $this->delimiter = ",";
145
+ break;
146
+
147
+ case 'COLON':
148
+ $this->delimiter = ":";
149
+ break;
150
+
151
+ case 'SEMICOLON':
152
+ $this->delimiter = ";";
153
+ break;
154
+
155
+ case 'TAB':
156
+ $this->delimiter = "\t";
157
+ break;
158
+
159
+ default:
160
+ $this->delimiter = ",";
161
+ break;
162
+ }
163
+ }
164
+
165
+ function get_delimiter() {
166
+ return $this->delimiter;
167
+ }
168
+
169
+ function set_role( $role ){
170
+ $this->role = $role;
171
+ }
172
+
173
+ function get_role(){
174
+ return $this->role;
175
+ }
176
+
177
+ function set_from( $from ){
178
+ $this->from = $from;
179
+ }
180
+
181
+ function get_from(){
182
+ return $this->from;
183
+ }
184
+
185
+ function set_to( $to ){
186
+ $this->to = $to;
187
+ }
188
+
189
+ function get_to(){
190
+ return $this->to;
191
+ }
192
+
193
+ function set_convert_timestamp( $convert_timestamp ){
194
+ $this->convert_timestamp = filter_var( $convert_timestamp, FILTER_VALIDATE_BOOLEAN );
195
+ }
196
+
197
+ function get_convert_timestamp(){
198
+ return $this->convert_timestamp;
199
+ }
200
+
201
+ function set_datetime_format( $datetime_format ){
202
+ $this->datetime_format = $datetime_format;
203
+ }
204
+
205
+ function get_datetime_format(){
206
+ return $this->datetime_format;
207
+ }
208
+
209
+ function set_order_fields_alphabetically( $order_fields_alphabetically ){
210
+ $this->order_fields_alphabetically = filter_var( $order_fields_alphabetically, FILTER_VALIDATE_BOOLEAN );
211
+ }
212
+
213
+ function get_order_fields_alphabetically(){
214
+ return $this->order_fields_alphabetically;
215
+ }
216
+
217
+ function set_double_encapsulate_serialized_values( $double_encapsulate_serialized_values ){
218
+ $this->double_encapsulate_serialized_values = filter_var( $double_encapsulate_serialized_values, FILTER_VALIDATE_BOOLEAN );
219
+ }
220
+
221
+ function get_double_encapsulate_serialized_values(){
222
+ return $this->double_encapsulate_serialized_values;
223
+ }
224
+
225
+ function set_filtered_columns( $filtered_columns ){
226
+ $filtered_columns = ( is_array( $filtered_columns ) ) ? array_walk( $filtered_columns, 'sanitize_text_field' ) : explode( ',', sanitize_text_field( $filtered_columns ) );
227
+
228
+ if( empty( $filtered_columns[0] ) )
229
+ $filtered_columns = array();
230
+
231
+ $this->filtered_columns = $filtered_columns;
232
+ }
233
+
234
+ function get_filtered_columns(){
235
+ return $this->filtered_columns;
236
+ }
237
+
238
+ function set_orderby( $orderby ){
239
+ $this->orderby = $orderby;
240
+ }
241
+
242
+ function get_orderby(){
243
+ return $this->orderby;
244
+ }
245
+
246
+ function set_order( $order ){
247
+ $this->order = $order;
248
+ }
249
+
250
+ function get_order(){
251
+ return $this->order;
252
+ }
253
+
254
+ function get_total_rows(){
255
+ $total_rows = get_transient( 'acui_export_total_rows' );
256
+
257
+ if( empty( $total_rows ) ){
258
+ $this->total_rows = $this->calculate_total();
259
+ }
260
+ else{
261
+ $this->total_rows = $total_rows;
262
+ }
263
+
264
+ return $this->total_rows;
265
+ }
266
+
267
+ function get_total_steps(){
268
+ return floor( $this->get_total_rows() / $this->get_limit() ) + 1;
269
+ }
270
+
271
+ function set_time_limit( $limit = 0 ) {
272
+ if ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
273
+ @set_time_limit( $limit );
274
+ }
275
+ }
276
+
277
+ function maybe_define_constant( $name, $value ) {
278
+ if ( ! defined( $name ) ) {
279
+ define( $name, $value );
280
+ }
281
+ }
282
+
283
+ function set_nocache_constants() {
284
+ $this->maybe_define_constant( 'DONOTCACHEPAGE', true );
285
+ $this->maybe_define_constant( 'DONOTCACHEOBJECT', true );
286
+ $this->maybe_define_constant( 'DONOTCACHEDB', true );
287
+ }
288
+
289
+ function send_nocache_headers() {
290
+ $this->set_nocache_constants();
291
+ nocache_headers();
292
+ }
293
+
294
+ function send_headers() {
295
+ if ( function_exists( 'gc_enable' ) ) {
296
+ gc_enable();
297
+ }
298
+ if ( function_exists( 'apache_setenv' ) ) {
299
+ @apache_setenv( 'no-gzip', 1 );
300
+ }
301
+ @ini_set( 'zlib.output_compression', 'Off' );
302
+ @ini_set( 'output_buffering', 'Off' );
303
+ @ini_set( 'output_handler', '' );
304
+ ignore_user_abort( true );
305
+ $this->set_time_limit( 0 );
306
+ $this->send_nocache_headers();
307
+ header( 'Content-Type: text/csv; charset=utf-8' );
308
+ header( 'Content-Disposition: attachment; filename=' . $this->get_filename() );
309
+ header( 'Pragma: no-cache' );
310
+ header( 'Expires: 0' );
311
+ }
312
+
313
+ function set_filename( $filename ) {
314
+ $this->filename = sanitize_file_name( str_replace( '.csv', '', $filename ) . '.csv' );
315
+ }
316
+
317
+ function get_filename() {
318
+ return sanitize_file_name( $this->filename );
319
+ }
320
+
321
+ function send_content( $csv_data ) {
322
+ echo $csv_data;
323
+ }
324
+
325
+ protected function get_csv_data() {
326
+ return $this->export_rows();
327
+ }
328
+
329
+ protected function export_column_headers() {
330
+ $columns = $this->get_columns_to_export();
331
+ $export_row = array();
332
+ $buffer = fopen( 'php://output', 'w' );
333
+ ob_start();
334
+
335
+ foreach ( $columns as $column_name ) {
336
+ $export_row[] = $this->format_data( $column_name );
337
+ }
338
+
339
+ $this->fputcsv( $buffer, $export_row );
340
+
341
+ return ob_get_clean();
342
+ }
343
+
344
+ protected function get_data_to_export() {
345
+ return $this->row_data;
346
+ }
347
+
348
+ protected function export_rows() {
349
+ $data = $this->get_data_to_export();
350
+ $buffer = fopen( 'php://output', 'w' );
351
+ ob_start();
352
+
353
+ array_walk( $data, array( $this, 'export_row' ), $buffer );
354
+
355
+ return ob_get_clean();
356
+ }
357
+
358
+ protected function export_row( $row_data, $key, $buffer ) {
359
+ $this->fputcsv( $buffer, $row_data );
360
+ ++ $this->exported_row_count;
361
+ }
362
+
363
+ function get_limit() {
364
+ return $this->limit;
365
+ }
366
+
367
+ function set_limit( $limit ) {
368
+ $this->limit = ( $limit == -1 ) ? $limit : absint( $limit );
369
+ }
370
+
371
+ function escape_data( $data ) {
372
+ $active_content_triggers = array( '=', '+', '-', '@' );
373
+
374
+ if ( in_array( mb_substr( $data, 0, 1 ), $active_content_triggers, true ) ) {
375
+ $data = "'" . $data;
376
+ }
377
+
378
+ return $data;
379
+ }
380
+
381
+ function format_data( $data ) {
382
+ if ( is_bool( $data ) ) {
383
+ $data = $data ? 1 : 0;
384
+ }
385
+
386
+ $use_mb = function_exists( 'mb_convert_encoding' );
387
+ if ( $use_mb ) {
388
+ $encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true );
389
+ $data = 'UTF-8' === $encoding ? $data : utf8_encode( $data );
390
+ }
391
+
392
+ return $this->escape_data( $data );
393
+ }
394
+
395
+ protected function implode_values( $values ) {
396
+ $values_to_implode = array();
397
+
398
+ foreach ( $values as $value ) {
399
+ $value = (string) is_scalar( $value ) ? $value : '';
400
+ $values_to_implode[] = str_replace( ',', '\\,', $value );
401
+ }
402
+
403
+ return implode( ', ', $values_to_implode );
404
+ }
405
+
406
+ protected function fputcsv( $buffer, $export_row ) {
407
+ if ( version_compare( PHP_VERSION, '5.5.4', '<' ) ) {
408
+ ob_start();
409
+ $temp = fopen( 'php://output', 'w' );
410
+ fputcsv( $temp, $export_row, $this->get_delimiter(), '"' );
411
+ fclose( $temp );
412
+ $row = ob_get_clean();
413
+ $row = str_replace( '\\"', '\\""', $row );
414
+ fwrite( $buffer, $row );
415
+ } else {
416
+ fputcsv( $buffer, $export_row, $this->get_delimiter(), '"', "\0" );
417
+ }
418
+ }
419
+
420
+ protected function get_file_path() {
421
+ if( !empty( $this->get_path() ) )
422
+ return $this->get_path();
423
+
424
+ $upload_dir = wp_upload_dir();
425
+ return trailingslashit( $upload_dir['basedir'] ) . $this->get_filename();
426
+ }
427
+
428
+ protected function get_headers_row_file_path() {
429
+ return $this->get_file_path() . '.headers';
430
+ }
431
+
432
+ function get_headers_row_file() {
433
+ $file = chr( 239 ) . chr( 187 ) . chr( 191 ) . $this->export_column_headers();
434
+
435
+ if ( @file_exists( $this->get_headers_row_file_path() ) ){
436
+ $file = @file_get_contents( $this->get_headers_row_file_path() );
437
+ }
438
+
439
+ return $file;
440
+ }
441
+
442
+ function get_file() {
443
+ $file = '';
444
+ if ( @file_exists( $this->get_file_path() ) ){
445
+ $file = @file_get_contents( $this->get_file_path() );
446
+ } else {
447
+ @file_put_contents( $this->get_file_path(), '' );
448
+ @chmod( $this->get_file_path(), 0664 );
449
+ }
450
+ return $file;
451
+ }
452
+
453
+ function export() {
454
+ $this->send_headers();
455
+ $this->send_content( $this->get_headers_row_file() . $this->get_file() );
456
+
457
+ do_action( 'acui_export_before_delete_file', $this->get_file_path() );
458
+
459
+ @unlink( $this->get_file_path() );
460
+ @unlink( $this->get_headers_row_file_path() );
461
+ die();
462
+ }
463
+
464
+ function generate_file() {
465
+ if( 1 === $this->get_page() ){
466
+ @unlink( $this->get_file_path() );
467
+
468
+ $this->get_file();
469
+ }
470
+ $this->prepare_data_to_export();
471
+ $this->write_csv_data( $this->get_csv_data() );
472
+ }
473
+
474
+ function calculate_total(){
475
+ $total_rows = count( $this->get_user_id_list( true ) );
476
+ set_transient( 'acui_export_total_rows', $total_rows, HOUR_IN_SECONDS );
477
+
478
+ return $total_rows;
479
+ }
480
+
481
+ protected function write_csv_data( $data ) {
482
+ if ( ! file_exists( $this->get_file_path() ) || ! is_writeable( $this->get_file_path() ) ) {
483
+ return false;
484
+ }
485
+
486
+ $fp = fopen( $this->get_file_path(), 'a+' );
487
+
488
+ if ( $fp ) {
489
+ fwrite( $fp, $data );
490
+ fclose( $fp );
491
+ }
492
+
493
+ if ( 100 <= $this->get_percent_complete() ) {
494
+ $header = chr( 239 ) . chr( 187 ) . chr( 191 ) . $this->export_column_headers();
495
+
496
+ @file_put_contents( $this->get_headers_row_file_path(), $header );
497
+ }
498
+
499
+ }
500
+
501
+ function get_page() {
502
+ return $this->page;
503
+ }
504
+
505
+ function set_page( $page ) {
506
+ $this->page = absint( $page );
507
+ }
508
+
509
+ function get_total_exported() {
510
+ return ( ( $this->get_page() - 1 ) * $this->get_limit() ) + $this->exported_row_count;
511
+ }
512
+
513
+ function get_percent_complete() {
514
+ return $this->get_total_rows() ? floor( ( $this->get_total_exported() / $this->get_total_rows() ) * 100 ) : 100;
515
+ }
516
+
517
+ function get_user_data(){
518
+ if( count( $this->get_filtered_columns() ) == 0 )
519
+ return $this->user_data;
520
+
521
+ $result = array();
522
+ foreach( $this->user_data as $column ){
523
+ if( in_array( $column, $this->get_filtered_columns() ) )
524
+ $result[] = $column;
525
+ }
526
+
527
+ return $result;
528
+ }
529
+
530
+ function get_user_id_list( $calculate_total = false ){
531
+ $args = array( 'fields' => array( 'ID' ), 'order' => $this->get_order() );
532
+
533
+ if( !$calculate_total && $this->get_limit() != -1 ){
534
+ $args['number'] = $this->get_limit();
535
+ $args['offset'] = ($this->get_page() - 1) * $this->get_limit();
536
+ }
537
+
538
+ if( !empty( $this->get_role() ) )
539
+ $args['role'] = $this->get_role();
540
+
541
+ $date_query = array();
542
+
543
+ if( !empty( $this->get_from() ) )
544
+ $date_query[] = array( 'after' => $this->get_from() );
545
+
546
+ if( !empty( $this->get_to() ) )
547
+ $date_query[] = array( 'before' => $this->get_to() );
548
+
549
+ if( !empty( $date_query ) ){
550
+ $date_query['inclusive'] = true;
551
+ $args['date_query'] = $date_query;
552
+ }
553
+
554
+ if( !empty( $this->get_orderby() ) ){
555
+ if( in_array( $this->get_orderby(), $this->accepted_order_by ) )
556
+ $args['orderby'] = $this->get_orderby();
557
+ else{
558
+ $args['orderby'] = "meta_value";
559
+ $args['meta_key'] = $this->get_orderby();
560
+ }
561
+ }
562
+
563
+ $users = get_users( $args );
564
+
565
+ if( $calculate_total )
566
+ return $users;
567
+
568
+ $list = array();
569
+
570
+ foreach ( $users as $user ) {
571
+ $list[] = $user->ID;
572
+ }
573
+
574
+ return $list;
575
+ }
576
+
577
+ function prepare_data_to_export() {
578
+ $acui_helper = new ACUI_Helper();
579
+
580
+ $users = $this->get_user_id_list();
581
+ $this->row_data = array();
582
+
583
+ foreach ( $users as $user ) {
584
+ $row = array();
585
+ $userdata = get_userdata( $user );
586
+
587
+ foreach ( $this->get_user_data( $this->get_filtered_columns() ) as $key ) {
588
+ $key = apply_filters( 'acui_export_get_key_user_data', $key );
589
+ $row[ $key ] = $this->prepare( $key, $userdata->data->{$key}, $this->get_datetime_format(), $user );
590
+ }
591
+
592
+ if( count( $this->get_filtered_columns() ) == 0 || in_array( 'role', $this->get_filtered_columns() ) )
593
+ $row['role'] = implode( ',', $acui_helper->get_roles_by_user_id( $user ) );
594
+
595
+ foreach ( $this->get_user_meta_keys( $this->get_filtered_columns() ) as $key ) {
596
+ $row[ $key ] = $this->prepare( $key, get_user_meta( $user, $key, true ), $this->get_datetime_format(), $user );
597
+ }
598
+
599
+ if( count( $this->get_filtered_columns() ) == 0 || in_array( 'user_email', $this->get_filtered_columns() ) || in_array( 'user_login', $this->get_filtered_columns() ) )
600
+ $row = $this->maybe_fill_empty_data( $row, $user, $this->get_filtered_columns() );
601
+
602
+ $row = apply_filters( 'acui_export_data', $row, $user, $this->get_datetime_format(), $this->get_columns_to_export(), array( 'order_fields_alphabetically' => $this->get_order_fields_alphabetically(), 'double_encapsulate_serialized_values' => $this->get_double_encapsulate_serialized_values(), 'filtered_columns' => $this->get_filtered_columns() ));
603
+
604
+ $this->row_data[] = array_values( $row );
605
+ }
606
+ }
607
+
608
+ function prepare( $key, $value, $datetime_format, $user = 0 ){
609
+ $acui_helper = new ACUI_Helper();
610
+
611
+ $timestamp_keys = apply_filters( 'acui_export_timestamp_keys', array( 'wc_last_active' ) );
612
+ $original_value = $value;
613
+ $value = $this->clean_bad_characters_formulas( $value );
614
+
615
+ if( has_filter( 'acui_export_prepare' ) ){
616
+ return apply_filters( 'acui_export_prepare', $value, $original_value );
617
+ }
618
+
619
+ if( $key == 'role' ){
620
+ return implode( ',', $acui_helper->get_roles_by_user_id( $user ) );
621
+ }
622
+
623
+ if( is_array( $value ) || is_object( $value ) ){
624
+ return serialize( $value );
625
+ }
626
+
627
+ if( in_array( $key, $this->get_non_date_keys() ) || empty( $datetime_format ) ){
628
+ return $value;
629
+ }
630
+
631
+ if( $this->get_convert_timestamp() && is_int( $value ) && ( ( $this->is_valid_timestamp( $value ) && strlen( $value ) > 4 ) || in_array( $key, $timestamp_keys) ) ){ // dates in timestamp format
632
+ return date( $datetime_format, $value );
633
+ }
634
+
635
+ return $value;
636
+ }
637
+
638
+ function clean_bad_characters_formulas( $value ){
639
+ if( is_array( $value ) )
640
+ return $value;
641
+
642
+ if( strlen( $value ) == 0 )
643
+ return $value;
644
+
645
+ $bad_characters = array( '+', '-', '=', '@' );
646
+ $first_character = substr( $value, 0, 1 );
647
+ if( in_array( $first_character, $bad_characters ) )
648
+ $value = "\\" . $first_character . substr( $value, 1 );
649
+
650
+ return $value;
651
+ }
652
+
653
+ function is_valid_timestamp( $timestamp ){
654
+ return ( (string) (int) $timestamp === $timestamp ) && ( $timestamp <= PHP_INT_MAX ) && ( $timestamp >= ~PHP_INT_MAX );
655
+ }
656
+
657
+ function maybe_fill_empty_data( $row, $user_id, $filtered_columns ){
658
+ if( empty( $row['user_login'] ) || empty( $row['user_email'] ) ){
659
+ $user = new WP_User( $user_id );
660
+
661
+ if( $user->ID == 0 )
662
+ return $row;
663
+
664
+ if( count( $filtered_columns ) == 0 || in_array( 'user_login', $filtered_columns ) )
665
+ $row['user_login'] = $user->user_login;
666
+
667
+ if( count( $filtered_columns ) == 0 || in_array( 'user_email', $filtered_columns ) )
668
+ $row['user_email'] = $user->user_email;
669
+ }
670
+
671
+ return $row;
672
+ }
673
+
674
+ function get_user_meta_keys() {
675
+ global $wpdb;
676
+ $meta_keys = array();
677
+
678
+ $usermeta = get_transient( 'acui_export_user_meta_keys' );
679
+
680
+ if( empty( $usermeta ) ){
681
+ $usermeta = $wpdb->get_results( "SELECT distinct $wpdb->usermeta.meta_key FROM $wpdb->usermeta", ARRAY_A );
682
+ set_transient( 'acui_export_user_meta_keys', $usermeta, HOUR_IN_SECONDS );
683
+ }
684
+
685
+ foreach( $usermeta as $key => $value) {
686
+ if( $value["meta_key"] == 'role' )
687
+ continue;
688
+
689
+ if( count( $this->get_filtered_columns() ) == 0 || in_array( $value["meta_key"], $this->get_filtered_columns() ) )
690
+ $meta_keys[] = $value["meta_key"];
691
+ }
692
+
693
+ return apply_filters( 'acui_export_get_user_meta_keys', $meta_keys );
694
+ }
695
+ }
trunk/classes/columns.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Columns{
5
+ function __construct(){
6
+ //add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
7
+
8
+ add_action( 'acui_columns_save_settings', array( $this, 'save_settings' ), 10, 1 );
9
+
10
+ if( get_option( 'acui_show_profile_fields' ) == true ){
11
+ add_action( "user_new_form", array( $this, "extra_user_profile_fields" ) );
12
+ add_action( "show_user_profile", array( $this, "extra_user_profile_fields" ) );
13
+ add_action( "edit_user_profile", array( $this, "extra_user_profile_fields" ) );
14
+ add_action( "user_register", array( $this, "save_extra_user_profile_fields" ), 10, 1 );
15
+ add_action( "personal_options_update", array( $this, "save_extra_user_profile_fields" ), 10, 1 );
16
+ add_action( "edit_user_profile_update", array( $this, "save_extra_user_profile_fields" ), 10, 1 );
17
+ }
18
+ }
19
+
20
+ function enqueue( $hook ) {
21
+ if( $hook != 'tools_page_acui' || !isset( $_GET['tab'] ) || $_GET['tab'] != 'columns' )
22
+ return;
23
+
24
+ wp_enqueue_script( 'acui-datatables', '//cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js', array( 'jquery' ), '1.10.20' );
25
+ wp_enqueue_style( 'acui-datatables', '//cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css', array(), '1.10.20' );
26
+ }
27
+
28
+ public static function admin_gui(){
29
+ $show_profile_fields = get_option( "acui_show_profile_fields");
30
+ $headers = get_option("acui_columns");
31
+ //$headers_extended = self::get_extended();
32
+ ?>
33
+ <h3><?php _e( 'Extra profile fields', 'import-users-from-csv-with-meta' ); ?></h3>
34
+ <table class="form-table">
35
+ <tbody>
36
+ <tr valign="top">
37
+ <th scope="row"><?php _e( 'Show fields in profile?', 'import-users-from-csv-with-meta' ); ?></th>
38
+ <td>
39
+ <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8">
40
+ <input type="checkbox" name="show-profile-fields" value="yes" <?php if( $show_profile_fields == true ) echo "checked='checked'"; ?>>
41
+ <input type="hidden" name="show-profile-fields-action" value="update"/>
42
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
43
+ <input class="button-primary" type="submit" value="<?php _e( 'Save option', 'import-users-from-csv-with-meta'); ?>"/>
44
+ </form>
45
+ </td>
46
+ </tr>
47
+ <tr valign="top">
48
+ <th scope="row"><?php _e( 'Reset fields in profile?', 'import-users-from-csv-with-meta' ); ?></th>
49
+ <td>
50
+ <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" id="reset-profile-fields">
51
+ <input type="hidden" name="reset-profile-fields-action" value="reset"/>
52
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
53
+ <input class="button-primary reset_fields_profile" type="submit" value="<?php _e( 'Reset fields', 'import-users-from-csv-with-meta'); ?>"/>
54
+ </form>
55
+ </td>
56
+ </tr>
57
+ <tr valign="top">
58
+ <th scope="row"><?php _e( 'Extra profile fields loadad in previous files', 'import-users-from-csv-with-meta' ); ?></th>
59
+ <td><small><em><?php _e( '(if you load another CSV with different columns, the new ones will replace this list)', 'import-users-from-csv-with-meta' ); ?></em></small>
60
+ <ol>
61
+ <?php
62
+ if( is_array( $headers ) && count( $headers ) > 0 ):
63
+ foreach ($headers as $column): ?>
64
+ <li><?php echo $column; ?></li>
65
+ <?php endforeach; ?>
66
+
67
+ <?php else: ?>
68
+ <li><?php _e( 'There is no columns loaded yet', 'import-users-from-csv-with-meta' ); ?></li>
69
+ <?php endif;
70
+ ?>
71
+ </ol>
72
+ </td>
73
+ </tr>
74
+ </tbody>
75
+ </table>
76
+
77
+ <?php /*
78
+ <h2><?php _e( 'Profile fields', 'import-users-from-csv-with-meta' ); ?></h2>
79
+ <form id="form_table_headers_extended" action="" method="POST">
80
+ <table id="headers_extended">
81
+ <thead>
82
+ <tr>
83
+ <td>Key</td>
84
+ <td>Label</td>
85
+ <td>Show</td>
86
+ <td>Type</td>
87
+ </tr>
88
+ </thead>
89
+ <tfoot>
90
+ <tr>
91
+ <td>Key</td>
92
+ <td>Label</td>
93
+ <td>Show</td>
94
+ <td>Type</td>
95
+ </tr>
96
+ </tfoot>
97
+ <tbody>
98
+ <?php foreach ( $headers_extended as $key => $header_extended): ?>
99
+ <tr>
100
+ <td><?php echo $key; ?></td>
101
+ <td><input type="text" name="<?php echo $key; ?>[label]" value="<?php echo $header_extended['label']; ?>"></td>
102
+ <td><input type="checkbox" name="<?php echo $key; ?>[show]" <?php checked( $header_extended['show'] ); ?>></td>
103
+ <td><?php echo $header_extended['type']; ?></td>
104
+ </tr>
105
+ <?php endforeach; ?>
106
+ </tbody>
107
+ </table>
108
+
109
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
110
+ <input type="submit" class="button button-primary" value="Save extended fields">
111
+ </form>
112
+ */ ?>
113
+
114
+ <script type="text/javascript">
115
+ jQuery( document ).ready( function( $ ){
116
+ $( '.reset_fields_profile' ).click( function( e ){
117
+ e.preventDefault();
118
+
119
+ var r = confirm( "<?php _e( 'Are you sure to reset all fields, it will delete current fields and they will restored in next import', 'import-users-from-csv-with-meta' ); ?>" );
120
+
121
+ if( !r )
122
+ return;
123
+
124
+ $( '#reset-profile-fields' ).submit();
125
+ } );
126
+
127
+ /*var table_headers_extended = $( '#headers_extended' ).DataTable();
128
+
129
+ $( '#form_table_headers_extended' ).on( 'submit', function (e) {
130
+ table_headers_extended.rows().nodes().page.len(-1).draw(false);
131
+
132
+ if( $( this ).valid() ) {
133
+ return true;
134
+ }
135
+
136
+ e.preventDefault();
137
+ });*/
138
+ } )
139
+ </script>
140
+ <?php
141
+ }
142
+
143
+ public static function get_extended(){
144
+ $headers_extended = get_option( "acui_columns_extended" );
145
+
146
+ return ( empty( $headers_extended ) ) ? self::init_extended() : $headers_extended;
147
+ }
148
+
149
+ public static function init_extended(){
150
+ $headers = get_option( "acui_columns" );
151
+ $headers_extended = array();
152
+
153
+ foreach ( $headers as $header ) {
154
+ $headers_extended[ $header ] = array(
155
+ 'label' => $header,
156
+ 'show' => true,
157
+ 'type' => 'text'
158
+ );
159
+ }
160
+
161
+ update_option( "acui_columns_extended", $headers_extended );
162
+
163
+ return $headers_extended;
164
+ }
165
+
166
+ function extra_user_profile_fields( $user ) {
167
+ $acui_helper = new ACUI_Helper();
168
+ $acui_restricted_fields = $acui_helper->get_restricted_fields();
169
+ $headers = get_option("acui_columns");
170
+
171
+ if( is_array( $headers ) && !empty( $headers ) ):
172
+ ?>
173
+ <h3>Extra profile information</h3>
174
+
175
+ <table class="form-table"><?php
176
+ foreach ( $headers as $column ):
177
+ if( in_array( $column, $acui_restricted_fields ) )
178
+ continue;
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" <?php echo apply_filters( 'acui_columns_field_extra_attributes', '', $column ); ?>/></td>
183
+ </tr>
184
+ <?php
185
+ endforeach;
186
+ ?>
187
+ </table><?php
188
+ endif;
189
+ }
190
+
191
+ function save_extra_user_profile_fields( $user_id ){
192
+ $post_filtered = filter_input_array( INPUT_POST );
193
+ if( empty( $post_filtered ) || count( $post_filtered ) == 0 )
194
+ return;
195
+
196
+ $acui_helper = new ACUI_Helper();
197
+ $headers = get_option("acui_columns");
198
+ $acui_restricted_fields = $acui_helper->get_restricted_fields();
199
+ $values_changed = array();
200
+
201
+ if( is_array( $headers ) && count( $headers ) > 0 ):
202
+ $values = array();
203
+
204
+ foreach ( $headers as $column ){
205
+ if( in_array( $column, $acui_restricted_fields ) )
206
+ continue;
207
+
208
+ $column_sanitized = str_replace(" ", "_", $column );
209
+
210
+ if( isset( $post_filtered[ $column_sanitized ] ) ){
211
+ $old_value = get_user_meta( $user_id, $column, true );
212
+
213
+ if( $old_value != $post_filtered[ $column_sanitized ] )
214
+ $values_changed[ $column ] = $post_filtered[ $column_sanitized ];
215
+
216
+ update_user_meta( $user_id, $column, $post_filtered[ $column_sanitized ] );
217
+ $values[ $column ] = $post_filtered[ $column_sanitized ];
218
+ }
219
+ }
220
+
221
+ do_action( 'acui_columns_fields_saved', $values, $values_changed );
222
+ endif;
223
+ }
224
+
225
+ public static function save_settings( $form_data ){
226
+ if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
227
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
228
+ }
229
+
230
+ if( isset( $form_data['show-profile-fields-action'] ) && $form_data['show-profile-fields-action'] == 'update' )
231
+ update_option( "acui_show_profile_fields", isset( $form_data["show-profile-fields"] ) && $form_data["show-profile-fields"] == "yes" );
232
+
233
+ if( isset( $form_data['reset-profile-fields-action'] ) && $form_data['reset-profile-fields-action'] == 'reset' )
234
+ update_option( "acui_columns", array() );
235
+ }
236
+ }
237
+
238
+ new ACUI_Columns();
trunk/classes/cron.php ADDED
@@ -0,0 +1,426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_Cron{
6
+ function __construct(){
7
+ add_action( 'acui_cron_save_settings', array( $this, 'save_settings' ), 10, 1 );
8
+ add_action( 'acui_cron_process', array( $this, 'process' ), 10 );
9
+ add_action( 'wp_ajax_acui_fire_cron', array( $this, 'ajax_fire_cron' ) );
10
+ }
11
+
12
+ function save_settings( $form_data ){
13
+ if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
14
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
15
+ }
16
+
17
+ $next_timestamp = wp_next_scheduled( 'acui_cron_process' );
18
+ $period = sanitize_text_field( $form_data[ "period" ] );
19
+
20
+ if( isset( $form_data["cron-activated"] ) && $form_data["cron-activated"] == "1" ){
21
+ update_option( "acui_cron_activated", true );
22
+
23
+ $old_period = get_option( "acui_cron_period" );
24
+
25
+ if( $old_period != $period ){
26
+ wp_unschedule_event( $next_timestamp, 'acui_cron_process');
27
+ wp_schedule_event( time(), $period, 'acui_cron_process' );
28
+ }
29
+ elseif( !$next_timestamp ) {
30
+ wp_schedule_event( time(), $period, 'acui_cron_process' );
31
+ }
32
+ }
33
+ else{
34
+ update_option( "acui_cron_activated", false );
35
+ wp_unschedule_event( $next_timestamp, 'acui_cron_process');
36
+ }
37
+
38
+ update_option( "acui_cron_send_mail", isset( $form_data["send-mail-cron"] ) && $form_data["send-mail-cron"] == "1" );
39
+ update_option( "acui_cron_send_mail_updated", isset( $form_data["send-mail-updated"] ) && $form_data["send-mail-updated"] == "1" );
40
+ update_option( "acui_cron_delete_users", isset( $form_data["cron-delete-users"] ) && $form_data["cron-delete-users"] == "1" );
41
+
42
+ if( isset( $form_data["cron-delete-users-assign-posts"] ) )
43
+ update_option( "acui_cron_delete_users_assign_posts", sanitize_text_field( $form_data["cron-delete-users-assign-posts"] ) );
44
+
45
+ update_option( "acui_move_file_cron", isset( $form_data["move-file-cron"] ) && $form_data["move-file-cron"] == "1" );
46
+ update_option( "acui_cron_path_to_move_auto_rename", isset( $form_data["path_to_move_auto_rename"] ) && $form_data["path_to_move_auto_rename"] == "1" );
47
+ update_option( "acui_cron_allow_multiple_accounts", ( isset( $form_data["allow_multiple_accounts"] ) && $form_data["allow_multiple_accounts"] == "1" ) ? "allowed" : "not_allowed" );
48
+ update_option( "acui_cron_path_to_file", sanitize_text_field( $form_data["path_to_file"] ) );
49
+ update_option( "acui_cron_path_to_move", sanitize_text_field( $form_data["path_to_move"] ) );
50
+ update_option( "acui_cron_period", sanitize_text_field( $form_data["period"] ) );
51
+ update_option( "acui_cron_role", sanitize_text_field( $form_data["role"] ) );
52
+ update_option( "acui_cron_update_roles_existing_users", isset( $form_data["update-roles-existing-users"] ) && $form_data["update-roles-existing-users"] == "1" );
53
+ update_option( "acui_cron_change_role_not_present", isset( $form_data["cron-change-role-not-present"] ) && $form_data["cron-change-role-not-present"] == "1" );
54
+
55
+ if( isset( $form_data["cron-change-role-not-present-role"] ) )
56
+ update_option( "acui_cron_change_role_not_present_role", sanitize_text_field( $form_data["cron-change-role-not-present-role"] ) );
57
+ ?>
58
+ <div class="updated">
59
+ <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
60
+ </div>
61
+ <?php
62
+ }
63
+
64
+ function process(){
65
+ $message = __('Import cron task starts at', 'import-users-from-csv-with-meta' ) . ' ' . date("Y-m-d H:i:s") . '<br/>';
66
+
67
+ $form_data = array();
68
+ $form_data[ "path_to_file" ] = get_option( "acui_cron_path_to_file");
69
+ $form_data[ "role" ] = get_option( "acui_cron_role");
70
+ $form_data[ "update_roles_existing_users" ] = ( get_option( "acui_cron_update_roles_existing_users" ) ) ? 'yes' : 'no';
71
+ $form_data[ "empty_cell_action" ] = "leave";
72
+ $form_data[ "allow_update_emails" ] = "disallow";
73
+ $form_data[ "security" ] = wp_create_nonce( "codection-security" );
74
+
75
+ ob_start();
76
+ $acui_import = new ACUI_Import();
77
+ $acui_import->fileupload_process( $form_data, true );
78
+ $message .= "<br/>" . ob_get_contents() . "<br/>";
79
+ ob_end_clean();
80
+
81
+ $move_file_cron = get_option( "acui_move_file_cron");
82
+
83
+ if( $move_file_cron ){
84
+ $path_to_file = get_option( "acui_cron_path_to_file");
85
+ $path_to_move = get_option( "acui_cron_path_to_move");
86
+
87
+ rename( $path_to_file, $path_to_move );
88
+
89
+ $this->auto_rename(); // optionally rename with date and time included
90
+ }
91
+ $message .= __( '--Finished at', 'import-users-from-csv-with-meta' ) . ' ' . date("Y-m-d H:i:s") . '<br/><br/>';
92
+
93
+ update_option( "acui_cron_log", $message );
94
+ }
95
+
96
+ function auto_rename() {
97
+ if( get_option( "acui_cron_path_to_move_auto_rename" ) != true )
98
+ return;
99
+
100
+ $movefile = get_option( "acui_cron_path_to_move");
101
+
102
+ if ( $movefile && file_exists( $movefile ) ) {
103
+ $parts = pathinfo( $movefile );
104
+ $filename = $parts['filename'];
105
+
106
+ if ( $filename ){
107
+ $date = date( 'YmdHis' );
108
+ $newfile = $parts['dirname'] . '/' . $filename .'_' . $date . '.' . $parts['extension'];
109
+ rename( $movefile , $newfile );
110
+ }
111
+ }
112
+ }
113
+
114
+ public static function admin_gui(){
115
+ $cron_activated = get_option( "acui_cron_activated");
116
+ $send_mail_cron = get_option( "acui_cron_send_mail");
117
+ $send_mail_updated = get_option( "acui_cron_send_mail_updated");
118
+ $cron_delete_users = get_option( "acui_cron_delete_users");
119
+ $cron_delete_users_assign_posts = get_option( "acui_cron_delete_users_assign_posts");
120
+ $cron_change_role_not_present = get_option( "acui_cron_change_role_not_present" );
121
+ $cron_change_role_not_present_role = get_option( "acui_cron_change_role_not_present_role" );
122
+ $path_to_file = get_option( "acui_cron_path_to_file");
123
+ $period = get_option( "acui_cron_period");
124
+ $role = get_option( "acui_cron_role");
125
+ $update_roles_existing_users = get_option( "acui_cron_update_roles_existing_users");
126
+ $move_file_cron = get_option( "acui_move_file_cron");
127
+ $path_to_move = get_option( "acui_cron_path_to_move");
128
+ $path_to_move_auto_rename = get_option( "acui_cron_path_to_move_auto_rename");
129
+ $log = get_option( "acui_cron_log");
130
+ $allow_multiple_accounts = get_option("acui_cron_allow_multiple_accounts");
131
+
132
+ $rest_api_execute_cron_url = home_url() . '/wp-json/import-users-from-csv-with-meta/v1/execute-cron/';
133
+
134
+ if( empty( $cron_activated ) )
135
+ $cron_activated = false;
136
+
137
+ if( empty( $send_mail_cron ) )
138
+ $send_mail_cron = false;
139
+
140
+ if( empty( $send_mail_updated ) )
141
+ $send_mail_updated = false;
142
+
143
+ if( empty( $cron_delete_users ) )
144
+ $cron_delete_users = false;
145
+
146
+ if( empty( $update_roles_existing_users) )
147
+ $update_roles_existing_users = false;
148
+
149
+ if( empty( $cron_delete_users_assign_posts ) )
150
+ $cron_delete_users_assign_posts = '';
151
+
152
+ if( empty( $path_to_file ) )
153
+ $path_to_file = dirname( __FILE__ ) . '/test.csv';
154
+
155
+ if( empty( $period ) )
156
+ $period = 'hourly';
157
+
158
+ if( empty( $move_file_cron ) )
159
+ $move_file_cron = false;
160
+
161
+ if( empty( $path_to_move ) )
162
+ $path_to_move = dirname( __FILE__ ) . '/move.csv';
163
+
164
+ if( empty( $path_to_move_auto_rename ) )
165
+ $path_to_move_auto_rename = false;
166
+
167
+ if( empty( $log ) )
168
+ $log = "No tasks done yet.";
169
+
170
+ if( empty( $allow_multiple_accounts ) )
171
+ $allow_multiple_accounts = "not_allowed";
172
+ ?>
173
+ <h2><?php _e( "Execute an import of users periodically", 'import-users-from-csv-with-meta' ); ?></h2>
174
+
175
+ <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8">
176
+ <table class="form-table">
177
+ <tbody>
178
+
179
+ <tr class="form-field form-required">
180
+ <th scope="row"><label for="cron-activated"><?php _e( 'Activate periodical import?', 'import-users-from-csv-with-meta' ); ?></label></th>
181
+ <td>
182
+ <?php ACUIHTML()->checkbox( array( 'name' => 'cron-activated', 'compare_value' => $cron_activated ) ); ?>
183
+ </td>
184
+ </tr>
185
+
186
+ <tr class="form-field">
187
+ <th scope="row"><label for="path_to_file"><?php _e( "Path of file that are going to be imported", 'import-users-from-csv-with-meta' ); ?></label></th>
188
+ <td>
189
+ <?php ACUIHTML()->text( array( 'name' => 'path_to_file', 'value' => $path_to_file, 'class' => '', 'placeholder' => __( 'Insert complete path to the file', 'import-users-from-csv-with-meta' ) ) ); ?>
190
+ <p class="description"><?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</p>
191
+ </td>
192
+ </tr>
193
+
194
+ <tr class="form-field form-required">
195
+ <th scope="row"><label for="period"><?php _e( 'Period', 'import-users-from-csv-with-meta' ); ?></label></th>
196
+ <td>
197
+ <?php ACUIHTML()->select( array(
198
+ 'options' => ACUI_Helper::get_loaded_periods(),
199
+ 'name' => 'period',
200
+ 'selected' => $period,
201
+ 'show_option_all' => false,
202
+ 'show_option_none' => false,
203
+ )); ?>
204
+ <p class="description"><?php _e( 'How often the event should reoccur?', 'import-users-from-csv-with-meta' ); ?></p>
205
+ </td>
206
+ </tr>
207
+
208
+ <tr class="form-field form-required">
209
+ <th scope="row"><label for="send-mail-cron"><?php _e( 'Send mail when using periodical import?', 'import-users-from-csv-with-meta' ); ?></label></th>
210
+ <td>
211
+ <?php ACUIHTML()->checkbox( array( 'name' => 'send-mail-cron', 'compare_value' => $send_mail_cron ) ); ?>
212
+ </td>
213
+ </tr>
214
+
215
+ <tr class="form-field form-required">
216
+ <th scope="row"><label for="send-mail-updated"><?php _e( 'Send mail also to users that are being updated?', 'import-users-from-csv-with-meta' ); ?></label></th>
217
+ <td>
218
+ <?php ACUIHTML()->checkbox( array( 'name' => 'send-mail-updated', 'compare_value' => $send_mail_updated ) ); ?>
219
+ </td>
220
+ </tr>
221
+
222
+ <tr class="form-field form-required">
223
+ <th scope="row"><label for="role"><?php _e( 'Role', 'import-users-from-csv-with-meta' ); ?></label></th>
224
+ <td>
225
+ <?php ACUIHTML()->select( array(
226
+ 'options' => ACUI_Helper::get_editable_roles(),
227
+ 'name' => 'role',
228
+ 'selected' => $role,
229
+ 'show_option_all' => false,
230
+ 'show_option_none' => __( 'Disable role assignment in cron import', 'import-users-from-csv-with-meta' ),
231
+ )); ?>
232
+ <p class="description"><?php _e( 'Which role would be used to import users?', 'import-users-from-csv-with-meta' ); ?></p>
233
+ </td>
234
+ </tr>
235
+
236
+ <tr class="form-field form-required">
237
+ <th scope="row"><label for="update-roles-existing-users"><?php _e( 'Update roles for existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
238
+ <td>
239
+ <?php ACUIHTML()->checkbox( array( 'name' => 'update-roles-existing-users', 'compare_value' => $update_roles_existing_users ) ); ?>
240
+ </td>
241
+ </tr>
242
+
243
+ <tr class="form-field form-required">
244
+ <th scope="row"><label for="move-file-cron"><?php _e( 'Move file after import?', 'import-users-from-csv-with-meta' ); ?></label></th>
245
+ <td>
246
+ <div style="float:left;">
247
+ <?php ACUIHTML()->checkbox( array( 'name' => 'move-file-cron', 'compare_value' => $move_file_cron ) ); ?>
248
+ </div>
249
+
250
+ <div class="move-file-cron-cell" style="margin-left:25px;">
251
+ <?php ACUIHTML()->text( array( 'name' => 'path_to_move', 'value' => $path_to_move, 'class' => '', 'placeholder' => __( 'Insert complete path to the file', 'import-users-from-csv-with-meta' ) ) ); ?>
252
+ <p class="description"><?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"]; ?>/move.csv</p>
253
+ </div>
254
+ </td>
255
+ </tr>
256
+
257
+ <tr class="form-field form-required move-file-cron-cell">
258
+ <th scope="row"><label for="move-file-cron"><?php _e( 'Auto rename after move?', 'import-users-from-csv-with-meta' ); ?></label></th>
259
+ <td>
260
+ <div style="float:left;">
261
+ <?php ACUIHTML()->checkbox( array( 'name' => 'path_to_move_auto_rename', 'compare_value' => $path_to_move_auto_rename ) ); ?>
262
+ </div>
263
+
264
+ <div style="margin-left:25px;">
265
+ <p class="description"><?php _e( 'Your file will be renamed after moved, so you will not lost any version of it. The way to rename will be append the time stamp using this date format: YmdHis.', 'import-users-from-csv-with-meta'); ?></p>
266
+ </div>
267
+ </td>
268
+ </tr>
269
+
270
+ </tbody>
271
+ </table>
272
+
273
+ <h2><?php _e( 'Users not present in CSV file', 'import-users-from-csv-with-meta'); ?></h2>
274
+
275
+ <table class="form-table">
276
+ <tbody>
277
+
278
+ <tr class="form-field form-required">
279
+ <th scope="row"><label for="cron-delete-users"><?php _e( 'Delete users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
280
+ <td>
281
+ <div style="float:left; margin-top: 10px;">
282
+ <?php ACUIHTML()->checkbox( array( 'name' => 'cron-delete-users', 'compare_value' => $cron_delete_users ) ); ?>
283
+ </div>
284
+ <div style="margin-left:25px;">
285
+ <?php ACUIHTML()->select( array(
286
+ 'options' => ACUI_Helper::get_list_users_with_display_name(),
287
+ 'name' => 'cron-delete-users-assign-posts',
288
+ 'selected' => $cron_delete_users_assign_posts,
289
+ 'show_option_all' => false,
290
+ 'show_option_none' => __( 'Delete posts of deleted users without assigning to any user', 'import-users-from-csv-with-meta' ),
291
+ )); ?>
292
+ </select>
293
+ <p class="description"><?php _e( 'Administrators will not be deleted anyway. After delete users, we can choose if we want to assign their posts to another user. If you do not choose some user, content will be deleted.', 'import-users-from-csv-with-meta' ); ?></p>
294
+ </div>
295
+ </td>
296
+ </tr>
297
+
298
+ <tr class="form-field form-required">
299
+ <th scope="row"><label for="cron-change-role-not-present"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
300
+ <td>
301
+ <div style="float:left; margin-top: 10px;">
302
+ <?php ACUIHTML()->checkbox( array( 'name' => 'cron-change-role-not-present', 'compare_value' => $cron_change_role_not_present ) ); ?>
303
+ </div>
304
+ <div style="margin-left:25px;">
305
+ <?php ACUIHTML()->select( array(
306
+ 'options' => ACUI_Helper::get_editable_roles(),
307
+ 'name' => 'cron-change-role-not-present-role',
308
+ 'selected' => $cron_change_role_not_present_role,
309
+ 'show_option_all' => false,
310
+ 'show_option_none' => false,
311
+ )); ?>
312
+ <p class="description"><?php _e( 'After import users which is not present in the CSV and can be changed to a different role.', 'import-users-from-csv-with-meta' ); ?></p>
313
+ </div>
314
+ </td>
315
+ </tr>
316
+ </tbody>
317
+ </table>
318
+
319
+ <h2><?php _e( 'Call cron process using REST-API', 'import-users-from-csv-with-meta'); ?></h2>
320
+
321
+ <table class="form-table">
322
+ <tbody>
323
+ <tr class="form-field form-required">
324
+ <th scope="row"><label for="log"><?php _e( 'GET endpoint to execute cron', 'import-users-from-csv-with-meta' ); ?></label></th>
325
+ <td>
326
+ <?php _e( 'You can execute the cron process out of your site using the next REST-API endpoint:', 'import-users-from-csv-with-meta' ); ?> <a href="<?php echo $rest_api_execute_cron_url; ?>"><?php echo $rest_api_execute_cron_url; ?></a>.<br/>
327
+ <p class="description"><?php _e( 'This endpoint does an administrative task, so in order to run it you must be authenticated with a user with privileges.', 'import-users-from-csv-with-meta' ); ?></p>
328
+ </td>
329
+ </tr>
330
+ </tbody>
331
+ </table>
332
+
333
+ <?php do_action( 'acui_tab_cron_before_log' ); ?>
334
+
335
+ <h2><?php _e( 'Log', 'import-users-from-csv-with-meta'); ?></h2>
336
+
337
+ <table class="form-table">
338
+ <tbody>
339
+ <tr class="form-field form-required">
340
+ <th scope="row"><label for="log"><?php _e( 'Last actions of schedule task', 'import-users-from-csv-with-meta' ); ?></label></th>
341
+ <td>
342
+ <pre><?php echo strip_tags( $log, '<br><div><p><strong><style><h2><h3><table><tbody><tr><td><th>' ); ?></pre>
343
+ </td>
344
+ </tr>
345
+
346
+ </tbody>
347
+ </table>
348
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
349
+ <input class="button-primary" type="submit" value="<?php _e( 'Save schedule options', 'import-users-from-csv-with-meta'); ?>"/>
350
+ <input id="cron-execute-cron-task-now" class="button-primary" type="button" value="<?php _e( 'Execute cron task now', 'import-users-from-csv-with-meta'); ?>"/>
351
+ </form>
352
+
353
+ <script>
354
+ jQuery( document ).ready( function( $ ){
355
+ check_delete_users_checked();
356
+
357
+ $( '#cron-delete-users' ).on( 'click', function() {
358
+ check_delete_users_checked();
359
+ });
360
+
361
+ $( '#cron-execute-cron-task-now' ).click( function(){
362
+ $( this )
363
+ .prop( 'disabled', true )
364
+ .val( 'Loading...' );
365
+
366
+ var data = {
367
+ 'action': 'acui_fire_cron',
368
+ 'security': '<?php echo wp_create_nonce( "codection-security" ); ?>'
369
+ };
370
+
371
+ $.post( ajaxurl, data, function( response ) {
372
+ if( response != "OK" )
373
+ alert( "<?php _e( 'Problems executing cron task: ', 'import-users-from-csv-with-meta' ); ?>" + response );
374
+ else{
375
+ alert( "<?php _e( 'Cron task successfully executed', 'import-users-from-csv-with-meta' ); ?>" );
376
+ document.location.reload();
377
+ }
378
+ });
379
+ } );
380
+
381
+ function check_delete_users_checked(){
382
+ if( $('#cron-delete-users').is(':checked') ){
383
+ $( '#cron-delete-users-assign-posts' ).prop( 'disabled', false );
384
+ $( '#cron-change-role-not-present-role' ).prop( 'disabled', true );
385
+ $( '#cron-change-role-not-present' ).prop( 'disabled', true );
386
+ } else {
387
+ $( '#cron-delete-users-assign-posts' ).prop( 'disabled', true );
388
+ $( '#cron-change-role-not-present-role' ).prop( 'disabled', false );
389
+ $( '#cron-change-role-not-present' ).prop( 'disabled', false );
390
+ }
391
+ }
392
+
393
+ $( "[name='cron-delete-users']" ).change(function() {
394
+ if( $ (this ).is( ":checked" ) ) {
395
+ var returnVal = confirm("<?php _e( 'Are you sure to delete all users that are not present in the CSV? This action cannot be undone.', 'import-users-from-csv-with-meta' ); ?>");
396
+ $( this ).prop( "checked", returnVal );
397
+ }
398
+ });
399
+
400
+ $( "[name='move-file-cron']" ).change(function() {
401
+ if( $(this).is( ":checked" ) ){
402
+ $( '.move-file-cron-cell' ).show();
403
+ }
404
+ else{
405
+ $( '.move-file-cron-cell' ).hide();
406
+ }
407
+ });
408
+
409
+ <?php if( !$move_file_cron ): ?>
410
+ $( '.move-file-cron-cell' ).hide();
411
+ <?php endif; ?>
412
+ });
413
+ </script>
414
+ <?php
415
+ }
416
+
417
+ function ajax_fire_cron(){
418
+ check_ajax_referer( 'codection-security', 'security' );
419
+
420
+ do_action( 'acui_cron_process' );
421
+ echo "OK";
422
+ wp_die();
423
+ }
424
+ }
425
+
426
+ new ACUI_Cron();
trunk/classes/doc.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_Doc{
6
+ public static function message(){
7
+ ?>
8
+ <h3><?php _e( 'Documentation', 'import-users-from-csv-with-meta' ); ?></h3>
9
+ <table class="form-table">
10
+ <tbody>
11
+ <tr valign="top">
12
+ <th scope="row"><?php _e( 'Columns position', 'import-users-from-csv-with-meta' ); ?></th>
13
+ <td><small><em><?php _e( '(Documents should look like the one presented into screenshot. Remember you should fill the first two columns with the next values)', 'import-users-from-csv-with-meta' ); ?></em></small>
14
+ <ol>
15
+ <li><?php _e( 'Username: you can leave it empty and the username will be generated randomly', 'import-users-from-csv-with-meta' ); ?> </li>
16
+ <li><?php _e( 'Email', 'import-users-from-csv-with-meta' ); ?></li>
17
+ </ol>
18
+ <small><em><?php _e( '(The next columns are totally customizable and you can use whatever you want. All rows must contains same columns)', 'import-users-from-csv-with-meta' ); ?></em></small>
19
+ <small><em><?php _e( '(User profile will be adapted to the kind of data you have selected)', 'import-users-from-csv-with-meta' ); ?></em></small>
20
+ <small><em><?php _e( '(If you want to disable the extra profile information, please deactivate this plugin after make the import)', 'import-users-from-csv-with-meta' ); ?></em></small>
21
+ </td>
22
+ </tr>
23
+ <tr valign="top">
24
+ <th scope="row"><?php _e( 'id (column id)', 'import-users-from-csv-with-meta' ); ?></th>
25
+ <td><?php _e( 'You can use a column called id in order to make inserts or updates of an user using the ID used by WordPress in the wp_users table. We have two different cases:', 'import-users-from-csv-with-meta' ); ?>
26
+ <ul style="list-style:disc outside none; margin-left:2em;">
27
+ <li><?php _e( "If id <strong>doesn't exist in your users table</strong>: WordPress core does not allow us insert it, so it will throw an error of kind: invalid_user_id", 'import-users-from-csv-with-meta' ); ?></li>
28
+ <li><?php _e( "If id <strong>exists</strong>: plugin check if username is the same, if yes, it will update the data, if not, it ignores the cell to avoid problems", 'import-users-from-csv-with-meta' ); ?></li>
29
+ </ul>
30
+ </td>
31
+ </tr>
32
+ <tr valign="top">
33
+ <th scope="row"><?php _e( "Passwords (column password and user_pass)", 'import-users-from-csv-with-meta' ); ?></th>
34
+ <td><?php _e( "A string that contains user passwords. We have different options for this case:", 'import-users-from-csv-with-meta' ); ?>
35
+ <ul style="list-style:disc outside none; margin-left:2em;">
36
+ <li><?php _e( "If you <strong>create a column password</strong>: if cell is empty, password won't be updated; if cell has a value, it will be used.", 'import-users-from-csv-with-meta' ); ?></li>
37
+ <li><?php _e( "If you <strong>create a column called user_pass</strong>: this will be a hashed password that will be inserted directly in database, this is the best option to move users with their passwords using export tool", 'import-users-from-csv-with-meta' ); ?></li>
38
+ <li><?php _e( "If you <strong>don't create a column for passwords (nor user_pass nor password)</strong>: passwords will be generated automatically.", 'import-users-from-csv-with-meta' ); ?></li>
39
+ <li><?php _e( "You should not use both columns in the same import", 'import-users-from-csv-with-meta' ); ?></li>
40
+ </ul>
41
+ </td>
42
+ </tr>
43
+ <tr valign="top">
44
+ <th scope="row"><?php _e( "Roles (column role)", 'import-users-from-csv-with-meta' ); ?></th>
45
+ <td><?php _e( "Plugin can import roles from the CSV. This is how it works:", 'import-users-from-csv-with-meta' ); ?>
46
+ <ul style="list-style:disc outside none; margin-left:2em;">
47
+ <li><?php _e( "If you <strong>don't create a column for roles</strong>: roles would be chosen from the 'Default role' field in import screen.", 'import-users-from-csv-with-meta' ); ?></li>
48
+ <li><?php _e( "If you <strong>create a column called 'role'</strong>: if cell is empty, roles would be chosen from 'Default role' field in import screen; if cell has a value, it will be used as role, if this role doesn't exist the default one would be used", 'import-users-from-csv-with-meta' ); ?></li>
49
+ <li><?php _e( "Multiple roles can be imported creating <strong>a list of roles</strong> using commas to separate values.", 'import-users-from-csv-with-meta' ); ?></li>
50
+ </ul>
51
+ <em><?php _e( "Notice: If the default new role is administrator in WordPress settings, role will not be set during a CSV file import with this plugin. Check it if all users are being imported as administrators and you have set another role in this plugin.", 'import-users-from-csv-with-meta' ); ?></em>
52
+ </td>
53
+ </tr>
54
+ <tr valign="top">
55
+ <th scope="row"><?php _e( "Serialized data", 'import-users-from-csv-with-meta' ); ?></th>
56
+ <td><?php _e( "Plugin can now import serialized data. You have to use the serialized string directly in the CSV cell in order the plugin will be able to understand it as an serialized data instead as any other string.", 'import-users-from-csv-with-meta' ); ?>
57
+ </td>
58
+ </tr>
59
+ <tr valign="top">
60
+ <th scope="row"><?php _e( "Lists", 'import-users-from-csv-with-meta' ); ?></th>
61
+ <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' ); ?>
62
+ </td>
63
+ </tr>
64
+ <tr valign="top">
65
+ <th scope="row"><?php _e( "Arrays with string keys", 'import-users-from-csv-with-meta' ); ?></th>
66
+ <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
67
+ </td>
68
+ </tr>
69
+ <tr valign="top">
70
+ <th scope="row"><?php _e( 'WordPress default profile data', 'import-users-from-csv-with-meta' ); ?></th>
71
+ <td><?php _e( "You can use those labels if you want to set data adapted to the WordPress default user columns (the ones who use the function", 'import-users-from-csv-with-meta' ); ?> <a href="http://codex.wordpress.org/Function_Reference/wp_update_user">wp_update_user</a>)
72
+ <ol>
73
+ <li><strong>user_nicename</strong>: <?php _e( "A string that contains a URL-friendly name for the user. The default is the user's username.", 'import-users-from-csv-with-meta' ); ?></li>
74
+ <li><strong>user_url</strong>: <?php _e( "A string containing the user's URL for the user's web site.", 'import-users-from-csv-with-meta' ); ?> </li>
75
+ <li><strong>display_name</strong>: <?php _e( "A string that will be shown on the site. Defaults to user's username. It is likely that you will want to change this, for both appearance and security through obscurity (that is if you don't use and delete the default admin user).", 'import-users-from-csv-with-meta' ); ?></li>
76
+ <li><strong>nickname</strong>: <?php _e( "The user's nickname, defaults to the user's username.", 'import-users-from-csv-with-meta' ); ?> </li>
77
+ <li><strong>first_name</strong>: <?php _e( "The user's first name.", 'import-users-from-csv-with-meta' ); ?></li>
78
+ <li><strong>last_name</strong>: <?php _e("The user's last name.", 'import-users-from-csv-with-meta' ); ?></li>
79
+ <li><strong>description</strong>: <?php _e("A string containing content about the user.", 'import-users-from-csv-with-meta' ); ?></li>
80
+ <li><strong>jabber</strong>: <?php _e("User's Jabber account.", 'import-users-from-csv-with-meta' ); ?></li>
81
+ <li><strong>aim</strong>: <?php _e("User's AOL IM account.", 'import-users-from-csv-with-meta' ); ?></li>
82
+ <li><strong>yim</strong>: <?php _e("User's Yahoo IM account.", 'import-users-from-csv-with-meta' ); ?></li>
83
+ <li><strong>user_registered</strong>: <?php _e( "Using the WordPress format for this kind of data Y-m-d H:i:s.", "import-users-from-csv-with-meta "); ?></li>
84
+ </ol>
85
+ </td>
86
+ </tr>
87
+
88
+ <tr valign="top">
89
+ <th scope="row"><?php _e( 'Cron', 'import-users-from-csv-with-meta' ); ?></th>
90
+ <td><?php _e( 'Cron tab allows you to make periodical imports using the WordPress cron scheduler.','import-users-from-csv-with-meta'); ?></td>
91
+ </tr>
92
+
93
+ <?php do_action( 'acui_documentation_after_plugins_activated' ); ?>
94
+
95
+ <tr valign="top">
96
+ <th scope="row"><?php _e( "Any question about it", 'import-users-from-csv-with-meta' ); ?></th>
97
+ <td>
98
+ <ul style="list-style:disc outside none; margin-left:2em;">
99
+ <li><?php _e( 'Free support (in WordPress forums):', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/support/plugin/import-users-from-csv-with-meta">https://wordpress.org/support/plugin/import-users-from-csv-with-meta</a>.</li>
100
+ <li><?php _e( 'Premium support (with a quote):', 'import-users-from-csv-with-meta' ); ?> <a href="mailto:contacto@codection.com">contacto@codection.com</a>.</li>
101
+ </ul>
102
+ </td>
103
+ </tr>
104
+
105
+ <tr valign="top">
106
+ <th scope="row"><?php _e( 'Hooks', 'import-users-from-csv-with-meta' ); ?></th>
107
+ <td><?php _e( 'If you are a developer you can extend or use this plugin with all the hooks we provide, you have <a href="https://codection.com/import-users-csv-meta/listado-de-hooks-de-import-and-exports-users-and-customers/">a list of them here</a>','import-users-from-csv-with-meta'); ?></td>
108
+ </tr>
109
+
110
+ <tr valign="top">
111
+ <th scope="row"><?php _e( 'Example', 'import-users-from-csv-with-meta' ); ?></th>
112
+ <td><?php _e( 'Download this', 'import-users-from-csv-with-meta' ); ?> <a href="<?php echo esc_url( plugins_url( 'test.csv', dirname( __FILE__ ) ) ); ?>">.csv <?php _e('file','import-users-from-csv-with-meta'); ?></a> <?php _e( 'to test', 'import-users-from-csv-with-meta' ); ?></td>
113
+ </tr>
114
+ </tbody>
115
+ </table>
116
+ <br/>
117
+ <div style="width:775px;margin:0 auto"><img src="<?php echo esc_url( plugins_url( 'csv_example.png', dirname( __FILE__ ) ) ); ?>"/></div>
118
+ <?php
119
+ }
120
+ }
trunk/classes/donate.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Donate{
5
+ public static function message(){
6
+ ?>
7
+ <div class="postbox">
8
+ <h3 class="hndle"><span>&nbsp;<?php _e( 'Do you like it?', 'import-users-from-csv-with-meta' ); ?></span></h3>
9
+
10
+ <div class="inside" style="display: block;">
11
+ <img src="<?php echo esc_url( plugins_url( 'assets/icon_coffee.png', dirname( __FILE__ ) ) ); ?>" alt="<?php _e( 'buy me a coffee', 'import-users-from-csv-with-meta' ); ?>" style=" margin: 5px; float:left;">
12
+ <p><?php _e( 'Hi! we are', 'import-users-from-csv-with-meta'); ?> <a href="https://twitter.com/fjcarazo" target="_blank" title="Javier Carazo">Javier Carazo</a> <?php _e( 'and all the team of', 'import-users-from-csv-with-meta' ); ?> <a href="http://codection.com">Codection</a>, <?php _e("developers of this plugin.", 'import-users-from-csv-with-meta' ); ?></p>
13
+ <p><?php _e( 'We have been spending many hours to develop this plugin and answering questions in the forum to give you the best support. <br>If you like and use this plugin, you can <strong>buy us a cup of coffee</strong>.', 'import-users-from-csv-with-meta' ); ?></p>
14
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
15
+ <input type="hidden" name="cmd" value="_s-xclick">
16
+ <input type="hidden" name="hosted_button_id" value="QPYVWKJG4HDGG">
17
+ <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="<?php _e('PayPal – The safer, easier way to pay online.', 'import-users-from-csv-with-meta' ); ?>">
18
+ <img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1">
19
+ </form>
20
+ <div style="clear:both;"></div>
21
+ </div>
22
+
23
+ <h3 class="hndle"><span>&nbsp;<?php _e( 'Or if you prefer, you can also help us becoming a Patreon:', 'import-users-from-csv-with-meta' ); ?></span></h3>
24
+
25
+ <div class="inside acui" style="display: block;">
26
+ <a class="patreon" color="primary" type="button" name="become-a-patron" data-tag="become-patron-button" href="https://www.patreon.com/carazo" role="button">
27
+ <div class="oosjif-1 jFPfxp"><span>Become a patron</span></div>
28
+ </a>
29
+ </div>
30
+ </div>
31
+ <?php
32
+ }
33
+ }
trunk/classes/email-options.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Email_Options{
5
+ function __construct(){
6
+ add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ), 10, 1 );
7
+ add_action( 'wp_ajax_acui_mail_options_remove_attachment', array( $this, 'ajax_remove_attachment' ) );
8
+ add_action( 'wp_ajax_acui_send_test_email', array( $this, 'ajax_send_test_email' ) );
9
+ add_action( 'acui_homepage_start', array( $this, 'maybe_fill_empty_options' ) );
10
+ add_action( 'acui_mail_options_save_settings', array( $this, 'save_mail_template' ), 10, 1 );
11
+ }
12
+
13
+ public static function admin_gui(){
14
+ $automatic_created_edited_wordpress_email = get_option( "acui_automatic_created_edited_wordpress_email" );
15
+ $automatic_wordpress_email = get_option( "acui_automatic_wordpress_email" );
16
+ $subject_mail = get_option( "acui_mail_subject" );
17
+ $body_mail = get_option( "acui_mail_body" );
18
+ $template_id = get_option( "acui_mail_template_id" );
19
+ $attachment_id = get_option( "acui_mail_attachment_id" );
20
+ $enable_email_templates = get_option( "acui_enable_email_templates" );
21
+ $disable_wp_editor = get_option( "acui_mail_disable_wp_editor" );
22
+ ?>
23
+ <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8">
24
+ <h3><?php _e('WordPress automatic emails','import-users-from-csv-with-meta'); ?></h3>
25
+
26
+ <table class="optiontable form-table">
27
+ <tbody>
28
+ <tr valign="top">
29
+ <th scope="row"><?php _e( 'User created or edited', 'import-users-from-csv-with-meta' ); ?></th>
30
+ <td>
31
+ <fieldset>
32
+ <legend class="screen-reader-text">
33
+ <span><?php _e( 'User created or edited', 'import-users-from-csv-with-meta' ); ?></span>
34
+ </legend>
35
+ <label for="automatic_created_edited_wordpress_email">
36
+ <?php ACUIHTML()->select( array(
37
+ 'options' => array( 'false' => __( "Deactivate WordPress automatic email when an user is created or edited", 'import-users-from-csv-with-meta' ), 'true' => __( 'Activate WordPress automatic email when an user is created or edited', 'import-users-from-csv-with-meta' ) ),
38
+ 'name' => 'automatic_created_edited_wordpress_email',
39
+ 'selected' => $automatic_created_edited_wordpress_email,
40
+ 'show_option_all' => false,
41
+ 'show_option_none' => false,
42
+ )); ?>
43
+ <span class="description"><? _e( "When you create or update an user, WordPress prepare and send automatic email, you can deactivate it here.", 'import-users-from-csv-with-meta' ); ?></span>
44
+ </label>
45
+ </fieldset>
46
+ </td>
47
+ </tr>
48
+ <tr valign="top">
49
+ <th scope="row"><?php _e( 'Password changed', 'import-users-from-csv-with-meta' ); ?></th>
50
+ <td>
51
+ <fieldset>
52
+ <legend class="screen-reader-text">
53
+ <span><?php _e( 'Send automatic change password WordPress emails?', 'import-users-from-csv-with-meta' ); ?></span>
54
+ </legend>
55
+ <label for="automatic_wordpress_email">
56
+ <?php ACUIHTML()->select( array(
57
+ 'options' => array( 'false' => __( "Deactivate WordPress automatic email when an user is updated or his password is changed", 'import-users-from-csv-with-meta' ), 'true' => __( 'Activate WordPress automatic email when an user is updated or his password is changed', 'import-users-from-csv-with-meta' ) ),
58
+ 'name' => 'automatic_wordpress_email',
59
+ 'selected' => $automatic_wordpress_email,
60
+ 'show_option_all' => false,
61
+ 'show_option_none' => false,
62
+ )); ?>
63
+ <span class="description"><? _e( "When you update an user or change his password, WordPress prepare and send automatic email, you can deactivate it here.", 'import-users-from-csv-with-meta' ); ?></span>
64
+ </label>
65
+ </fieldset>
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+
71
+ <h3><?php _e( 'Email templates from this plugin', 'import-users-from-csv-with-meta' ); ?></h3>
72
+ <table class="optiontable form-table">
73
+ <tbody>
74
+ <tr valign="top">
75
+ <th scope="row"><?php _e( 'Enable mail templates:', 'import-users-from-csv-with-meta' ); ?></th>
76
+ <td>
77
+ <fieldset>
78
+ <legend class="screen-reader-text">
79
+ <span><?php _e( 'Do you want to enable mail templates?', 'import-users-from-csv-with-meta' ); ?></span>
80
+ </legend>
81
+ <label for="enable_email_templates">
82
+ <?php ACUIHTML()->checkbox( array( 'name' => 'enable_email_templates', 'compare_value' => $enable_email_templates ) ); ?>
83
+ <span class="description"><? _e( "If you activate it, a new option in the menu will be created to store and manage mail templates, instead of using only the next one.", 'import-users-from-csv-with-meta' ); ?></span>
84
+ </label>
85
+ </fieldset>
86
+ </td>
87
+ </tr>
88
+ <tr valign="top">
89
+ <th scope="row">
90
+ <?php _e( 'Disable WP Editor:', 'import-users-from-csv-with-meta' ); ?>
91
+ </th>
92
+ <td>
93
+ <fieldset>
94
+ <legend class="screen-reader-text">
95
+ <span><?php _e( 'Do you want to disable WP Editor?', 'import-users-from-csv-with-meta' ); ?></span>
96
+ </legend>
97
+ <label for="disable_wp_editor">
98
+ <?php ACUIHTML()->checkbox( array( 'name' => 'disable_wp_editor', 'compare_value' => $disable_wp_editor ) ); ?>
99
+ <span class="description"><?php _e( 'If you want to use email with custom HTML and CSS tags, disable WP Editor', 'import-users-from-csv-with-meta' ); ?></span>
100
+ </label>
101
+ </fieldset>
102
+ </td>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+
107
+ <?php if( $enable_email_templates && wp_count_posts( 'acui_email_template' )->publish > 0 ): ?>
108
+ <h3><?php _e( 'Load custom email from email templates', 'import-users-from-csv-with-meta' ); ?></h3>
109
+ <?php wp_dropdown_pages( array( 'id' => 'email_template_selected', 'post_type' => 'acui_email_template', 'selected' => $template_id ) ); ?>
110
+ <input id="load_email_template" class="button-primary" type="button" value="<?php _e( "Load subject, content and attachment from this email template", 'import-users-from-csv-with-meta' ); ?>"/>
111
+ <?php endif; ?>
112
+
113
+ <h3><?php _e( 'Customize the email that can be sent when importing users', 'import-users-from-csv-with-meta' ); ?></h3>
114
+
115
+ <p><?php _e( 'Mail subject:', 'import-users-from-csv-with-meta' ); ?><input name="subject_mail" size="100" value="<?php echo $subject_mail; ?>" id="title" autocomplete="off" type="text"></p>
116
+
117
+ <?php if( $disable_wp_editor ): ?>
118
+ <p><textarea name='body_mail' style="width:100%;" rows="20"><?php echo $body_mail; ?></textarea></p>
119
+ <?php else: ?>
120
+ <?php wp_editor( $body_mail, 'body_mail'); ?>
121
+ <?php endif; ?>
122
+
123
+ <input type="hidden" id="template_id" name="template_id" value="<?php echo $template_id; ?>"/>
124
+
125
+ <fieldset>
126
+ <div>
127
+ <label for="email_template_attachment_file"><?php _e( 'Attachment', 'import-users-from-csv-with-meta' )?></label><br>
128
+ <?php ACUIHTML()->text( array( 'type' => 'url', 'name' => 'email_template_attachment_file', 'value' => wp_get_attachment_url( $attachment_id ), 'class' => 'large-text', 'readonly' => true ) ); ?>
129
+ <input type="hidden" name="email_template_attachment_id" id="email_template_attachment_id" value="<?php echo $attachment_id ?>"/>
130
+ <button type="button" class="button" id="acui_email_option_upload_button"><?php _e( 'Upload file', 'import-users-from-csv-with-meta' )?></button>
131
+ <button type="button" class="button" id="acui_email_option_remove_upload_button"><?php _e( 'Remove file', 'import-users-from-csv-with-meta' )?></button>
132
+ </div>
133
+ </fieldset>
134
+
135
+ <br/>
136
+ <input class="button-primary" type="submit" value="<?php _e( 'Save email template and options', 'import-users-from-csv-with-meta'); ?>" id="save_mail_template_options"/>
137
+ <input class="button-primary" type="button" value="<?php _e( 'Send test email', 'import-users-from-csv-with-meta'); ?>" id="send_test_email" title="<?php _e( 'This test email will be sent to the current user', 'import-users-from-csv-with-meta'); ?>"/>
138
+ <?php _e( 'If you send a test email, no wildcards will be replaced becuase when you test, we have no data to replace.', 'import-users-from-csv-with-meta' ); ?>
139
+
140
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
141
+
142
+ <?php do_action( 'acui_email_options_after_editor' ); ?>
143
+
144
+ </form>
145
+ <?php
146
+ }
147
+
148
+ function maybe_fill_empty_options(){
149
+ if( get_option( "acui_mail_body" ) == "" )
150
+ update_option( "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', 'import-users-from-csv-with-meta' ) . ' = **password**</li></ul>' );
151
+
152
+ if( get_option( "acui_mail_subject" ) == "" )
153
+ update_option( "acui_mail_subject", __('Welcome to','import-users-from-csv-with-meta') . ' ' . get_bloginfo("name") );
154
+ }
155
+
156
+ function save_mail_template( $form_data ){
157
+ if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
158
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
159
+ }
160
+
161
+ add_filter( 'wp_kses_allowed_html', array( $this, 'allow_more_post_tags' ), 10, 2 );
162
+
163
+ $automatic_wordpress_email = sanitize_text_field( $form_data["automatic_wordpress_email"] );
164
+ $automatic_created_edited_wordpress_email = sanitize_text_field( $form_data["automatic_created_edited_wordpress_email"] );
165
+ $subject_mail = sanitize_text_field( stripslashes_deep( $form_data["subject_mail"] ) );
166
+ $body_mail = wp_kses_post( stripslashes( $form_data["body_mail"] ) );
167
+ $template_id = intval( $form_data["template_id"] );
168
+ $email_template_attachment_id = intval( $form_data["email_template_attachment_id"] );
169
+ $disable_wp_editor = isset( $form_data['disable_wp_editor'] ) && $form_data['disable_wp_editor'] == '1';
170
+
171
+ remove_filter( 'wp_kses_allowed_html', array( $this, 'allow_more_post_tags' ), 10, 2 );
172
+
173
+ update_option( "acui_automatic_wordpress_email", $automatic_wordpress_email );
174
+ update_option( "acui_automatic_created_edited_wordpress_email", $automatic_created_edited_wordpress_email );
175
+ update_option( "acui_mail_subject", $subject_mail );
176
+ update_option( "acui_mail_body", $body_mail );
177
+ update_option( "acui_mail_template_id", $template_id );
178
+ update_option( "acui_mail_attachment_id", $email_template_attachment_id );
179
+ update_option( "acui_mail_disable_wp_editor", $disable_wp_editor );
180
+
181
+ $template_id = absint( $form_data["template_id"] );
182
+
183
+ if( !empty( $template_id ) ){
184
+ wp_update_post( array(
185
+ 'ID' => $template_id,
186
+ 'post_title' => $subject_mail,
187
+ 'post_content' => $body_mail,
188
+ ) );
189
+
190
+ update_post_meta( $template_id, 'email_template_attachment_id', $email_template_attachment_id );
191
+ }
192
+ ?>
193
+ <div class="updated">
194
+ <p><?php _e( 'Mail template and options updated correctly', 'import-users-from-csv-with-meta' )?></p>
195
+ </div>
196
+ <?php
197
+ }
198
+
199
+ static function send_email( $user_object, $positions = array(), $headers = array(), $data = array(), $created = false, $password = '' ){
200
+ $acui_helper = new ACUI_Helper();
201
+
202
+ $key = get_password_reset_key( $user_object );
203
+ $wp_users_fields = $acui_helper->get_wp_users_fields();
204
+
205
+ $user_id = $user_object->ID;
206
+ $user_login= $user_object->user_login;
207
+ $user_email = $user_object->user_email;
208
+
209
+ $body = apply_filters( 'acui_import_email_body_source', get_option( "acui_mail_body" ), $headers, $data, $created, $user_id );
210
+ $subject = apply_filters( 'acui_import_email_subject_source', get_option( "acui_mail_subject" ), $headers, $data, $created, $user_id );
211
+
212
+ $body = str_replace( "**loginurl**", wp_login_url(), $body );
213
+ $body = str_replace( "**username**", $user_login, $body );
214
+ $body = str_replace( "**lostpasswordurl**", wp_lostpassword_url(), $body );
215
+ $subject = str_replace( "**username**", $user_login, $subject );
216
+
217
+ if( !is_wp_error( $key ) ){
218
+ $passwordreseturl = apply_filters( 'acui_email_passwordreseturl', network_site_url( 'wp-login.php?action=rp&key=' . $key . '&login=' . rawurlencode( $user_login ), 'login' ) );
219
+ $body = str_replace( "**passwordreseturl**", $passwordreseturl, $body );
220
+
221
+ $passwordreseturllink = wp_sprintf( '<a href="%s">%s</a>', $passwordreseturl, __( 'Password reset link', 'import-users-from-csv-with-meta' ) );
222
+ $body = str_replace( "**passwordreseturllink**", $passwordreseturllink, $body );
223
+ }
224
+
225
+ if( empty( $password ) && !$created ){
226
+ $password = __( 'Password has not been changed', 'import-users-from-csv-with-meta' );
227
+ }
228
+
229
+ $body = str_replace( "**password**", $password, $body );
230
+ $body = str_replace( "**email**", $user_email, $body );
231
+
232
+ foreach ( $wp_users_fields as $wp_users_field ) {
233
+ if( $positions[ $wp_users_field ] != false && $wp_users_field != "password" ){
234
+ $body = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $body );
235
+ $subject = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $subject );
236
+ }
237
+ }
238
+
239
+ for( $i = 0 ; $i < count( $headers ); $i++ ) {
240
+ $to_replace = "**" . $headers[ $i ] . "**";
241
+
242
+ if( strpos( $body, $to_replace ) === false && strpos( $subject, $to_replace ) === false )
243
+ continue;
244
+
245
+ $data[ $i ] = ( is_array( $data[ $i ] ) ) ? implode( "-", $data[ $i ] ) : $data[ $i ];
246
+ $body = str_replace( $to_replace, $data[ $i ] , $body );
247
+ $subject = str_replace( $to_replace, $data[ $i ] , $subject );
248
+ }
249
+
250
+ $body = apply_filters( 'acui_import_email_body_before_wpautop', $body, $headers, $data, $created, $user_id );
251
+
252
+ $body = wpautop( $body );
253
+
254
+ $attachments = array();
255
+ $attachment_id = get_option( 'acui_mail_attachment_id' );
256
+ if( !empty( $attachment_id ) )
257
+ $attachments[] = get_attached_file( $attachment_id );
258
+
259
+ $email_to = apply_filters( 'acui_import_email_to', $user_email, $headers, $data, $created, $user_id );
260
+ $subject = apply_filters( 'acui_import_email_subject', $subject, $headers, $data, $created, $user_id );
261
+ $body = apply_filters( 'acui_import_email_body', $body, $headers, $data, $created, $user_id );
262
+ $headers_mail = apply_filters( 'acui_import_email_headers', array( 'Content-Type: text/html; charset=UTF-8' ), $headers, $data, $created, $user_id );
263
+ $attachments = apply_filters( 'acui_import_email_attachments', $attachments, $headers, $data, $created, $user_id );
264
+
265
+ wp_mail( $email_to, $subject, $body, $headers_mail, $attachments );
266
+ }
267
+
268
+ function load_scripts( $hook ) {
269
+ global $typenow;
270
+
271
+ if( $typenow == 'acui_email_template' || $hook == 'tools_page_acui' ) {
272
+ wp_enqueue_media();
273
+ wp_register_script( 'acui-email-template-attachment-admin', esc_url( plugins_url( 'assets/email-template-attachment-admin.js', dirname( __FILE__ ) ) ), array( 'jquery' ) );
274
+ wp_localize_script( 'acui-email-template-attachment-admin', 'email_template_attachment_admin',
275
+ array(
276
+ 'title' => __( 'Choose or upload file', 'import-users-from-csv-with-meta' ),
277
+ 'button' => __( 'Use this file', 'import-users-from-csv-with-meta' ),
278
+ 'security' => wp_create_nonce( "codection-security" )
279
+ )
280
+ );
281
+ wp_enqueue_script( 'acui-email-template-attachment-admin' );
282
+ }
283
+
284
+ if( $hook == 'tools_page_acui' ){
285
+ wp_register_script( 'acui-email-options', esc_url( plugins_url( 'assets/email-options.js', dirname( __FILE__ ) ) ), array( 'jquery' ) );
286
+ wp_localize_script( 'acui-email-options', 'email_options',
287
+ array(
288
+ 'security' => wp_create_nonce( "codection-security" ),
289
+ 'success_message' => __( 'Test email sent', 'import-users-from-csv-with-meta' ),
290
+ )
291
+ );
292
+ wp_enqueue_script( 'acui-email-options' );
293
+ }
294
+ }
295
+
296
+ function ajax_remove_attachment(){
297
+ check_ajax_referer( 'codection-security', 'security' );
298
+ update_option( "acui_mail_attachment_id", "" );
299
+ }
300
+
301
+ function ajax_send_test_email(){
302
+ check_ajax_referer( 'codection-security', 'security' );
303
+
304
+ self::send_email( wp_get_current_user() );
305
+ }
306
+
307
+ function allow_more_post_tags( $tags, $context ) {
308
+ if ( 'post' === $context ) {
309
+ $tags['style'] = array();
310
+ }
311
+
312
+ return $tags;
313
+ }
314
+ }
315
+ new ACUI_Email_Options();
trunk/classes/email-templates.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_Email_Template{
6
+ function __construct(){
7
+ add_action( 'wp_loaded', array( $this, 'cpt_email_template' ) );
8
+ add_action( 'edit_form_after_editor', array( $this, 'email_templates_edit_form_after_editor' ), 10, 1 );
9
+ add_action( 'wp_ajax_acui_refresh_enable_email_templates', array( $this, 'refresh_enable_email_templates' ) );
10
+ add_action( 'wp_ajax_acui_email_template_selected', array( $this, 'email_template_selected' ) );
11
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
12
+ add_action( 'save_post', array( $this, 'save_post' ) );
13
+ add_action( 'acui_email_options_after_editor', array( $this, 'email_templates_edit_form_after_editor' ) );
14
+ }
15
+
16
+ function cpt_email_template() {
17
+ if( !get_option( 'acui_enable_email_templates' ) )
18
+ return;
19
+
20
+ $labels = array(
21
+ 'name' => _x( 'Email templates (Import Users From CSV With Meta)', 'Post Type General Name', 'import-users-from-csv-with-meta' ),
22
+ 'singular_name' => _x( 'Email template (Import Users From CSV With Meta)', 'Post Type Singular Name', 'import-users-from-csv-with-meta' ),
23
+ 'menu_name' => __( 'Email templates (Import Users)', 'import-users-from-csv-with-meta' ),
24
+ 'name_admin_bar' => __( 'Email templates (Import Users From CSV With Meta)', 'import-users-from-csv-with-meta' ),
25
+ 'archives' => __( 'Item Archives', 'import-users-from-csv-with-meta' ),
26
+ 'attributes' => __( 'Item Attributes', 'import-users-from-csv-with-meta' ),
27
+ 'parent_item_colon' => __( 'Parent Item:', 'import-users-from-csv-with-meta' ),
28
+ 'all_items' => __( 'All email template', 'import-users-from-csv-with-meta' ),
29
+ 'add_new_item' => __( 'Add new email template', 'import-users-from-csv-with-meta' ),
30
+ 'add_new' => __( 'Add new email template', 'import-users-from-csv-with-meta' ),
31
+ 'new_item' => __( 'New email template', 'import-users-from-csv-with-meta' ),
32
+ 'edit_item' => __( 'Edit email template', 'import-users-from-csv-with-meta' ),
33
+ 'update_item' => __( 'Update email template', 'import-users-from-csv-with-meta' ),
34
+ 'view_item' => __( 'View email template', 'import-users-from-csv-with-meta' ),
35
+ 'view_items' => __( 'View email templates', 'import-users-from-csv-with-meta' ),
36
+ 'search_items' => __( 'Search email template', 'import-users-from-csv-with-meta' ),
37
+ 'not_found' => __( 'Not found', 'import-users-from-csv-with-meta' ),
38
+ 'not_found_in_trash' => __( 'Not found in Trash', 'import-users-from-csv-with-meta' ),
39
+ 'featured_image' => __( 'Featured Image', 'import-users-from-csv-with-meta' ),
40
+ 'set_featured_image' => __( 'Set featured image', 'import-users-from-csv-with-meta' ),
41
+ 'remove_featured_image' => __( 'Remove featured image', 'import-users-from-csv-with-meta' ),
42
+ 'use_featured_image' => __( 'Use as featured image', 'import-users-from-csv-with-meta' ),
43
+ 'insert_into_item' => __( 'Insert into email template', 'import-users-from-csv-with-meta' ),
44
+ 'uploaded_to_this_item' => __( 'Uploaded to this email template', 'import-users-from-csv-with-meta' ),
45
+ 'items_list' => __( 'Items list', 'import-users-from-csv-with-meta' ),
46
+ 'items_list_navigation' => __( 'Email template list navigation', 'import-users-from-csv-with-meta' ),
47
+ 'filter_items_list' => __( 'Filter email template list', 'import-users-from-csv-with-meta' ),
48
+ );
49
+ $args = array(
50
+ 'label' => __( 'Mail template (Import Users From CSV With Meta)', 'import-users-from-csv-with-meta' ),
51
+ 'description' => __( 'Mail templates for Import Users From CSV With Meta', 'import-users-from-csv-with-meta' ),
52
+ 'labels' => $labels,
53
+ 'supports' => array( 'title', 'editor' ),
54
+ 'hierarchical' => true,
55
+ 'public' => false,
56
+ 'show_ui' => true,
57
+ 'show_in_menu' => true,
58
+ 'menu_position' => 100,
59
+ 'menu_icon' => 'dashicons-email',
60
+ 'show_in_admin_bar' => true,
61
+ 'show_in_nav_menus' => false,
62
+ 'can_export' => true,
63
+ 'has_archive' => false,
64
+ 'exclude_from_search' => true,
65
+ 'publicly_queryable' => false,
66
+ 'rewrite' => false,
67
+ 'capability_type' => 'page',
68
+ );
69
+ register_post_type( 'acui_email_template', $args );
70
+ }
71
+
72
+ public function email_templates_edit_form_after_editor( $post = "" ){
73
+ if( !empty( $post ) && $post->post_type != 'acui_email_template' )
74
+ return;
75
+ ?>
76
+ <p><?php _e( 'You can use', 'import-users-from-csv-with-meta' ); ?></p>
77
+ <ul style="list-style-type:disc; margin-left:2em;">
78
+ <li>**username** = <?php _e( 'username to login', 'import-users-from-csv-with-meta' ); ?></li>
79
+ <li>**password** = <?php _e( 'user password', 'import-users-from-csv-with-meta' ); ?></li>
80
+ <li>**loginurl** = <?php _e( 'current site login url', 'import-users-from-csv-with-meta' ); ?></li>
81
+ <li>**lostpasswordurl** = <?php _e( 'lost password url', 'import-users-from-csv-with-meta' ); ?></li>
82
+ <li>**passwordreseturl** = <?php _e( 'password reset url', 'import-users-from-csv-with-meta' ); ?></li>
83
+ <li>**passwordreseturllink** = <?php _e( 'password reset url with HTML link', 'import-users-from-csv-with-meta' ); ?></li>
84
+ <li>**email** = <?php _e( 'user email', 'import-users-from-csv-with-meta' ); ?></li>
85
+ <li><?php _e( "You can also use any WordPress user standard field or an own metadata, if you have used it in your CSV. For example, if you have a first_name column, you could use **first_name** or any other meta_data like **my_custom_meta**", 'import-users-from-csv-with-meta' ) ;?></li>
86
+ <?php do_action( 'acui_email_wildcards_list_elements' ); ?>
87
+ </ul>
88
+ <?php
89
+ }
90
+
91
+ function refresh_enable_email_templates(){
92
+ check_ajax_referer( 'codection-security', 'security' );
93
+ update_option( 'acui_enable_email_templates', ( $_POST[ 'enable' ] == "true" ) );
94
+ wp_die();
95
+ }
96
+
97
+ function email_template_selected(){
98
+ check_ajax_referer( 'codection-security', 'security' );
99
+ $email_template = get_post( intval( $_POST['email_template_selected'] ) );
100
+ $attachment_id = get_post_meta( $email_template->ID, 'email_template_attachment_id', true );
101
+
102
+ echo json_encode( array(
103
+ 'id' => $email_template->ID,
104
+ 'title' => $email_template->post_title,
105
+ 'content' => wpautop( $email_template->post_content ),
106
+ 'attachment_id' => $attachment_id,
107
+ 'attachment_url' => wp_get_attachment_url( $attachment_id ),
108
+ ) );
109
+
110
+ wp_die();
111
+ }
112
+
113
+ function add_meta_boxes(){
114
+ add_meta_box( 'email_template_attachments',
115
+ __( 'Attachment', 'import-users-from-csv-with-meta' ),
116
+ array( $this, 'email_template_attachments' ),
117
+ 'acui_email_template',
118
+ 'side',
119
+ 'core' );
120
+ }
121
+
122
+ public function email_template_attachments( $post ){
123
+ $email_template_attachment_id = get_post_meta( $post->ID, 'email_template_attachment_id', true );
124
+ ?>
125
+ <fieldset>
126
+ <div>
127
+ <label for="email_template_attachment_file"><?php _e( 'Attachment', 'import-users-from-csv-with-meta' )?></label><br>
128
+ <input type="url" class="large-text" name="email_template_attachment_file" id="email_template_attachment_file" value="<?php echo wp_get_attachment_url( $email_template_attachment_id ); ?>" readonly/><br>
129
+ <input type="hidden" name="email_template_attachment_id" id="email_template_attachment_id" value="<?php echo $email_template_attachment_id ?>"/>
130
+ <button type="button" class="button" id="acui_email_template_upload_button"><?php _e( 'Upload file', 'import-users-from-csv-with-meta' )?></button>
131
+ <button type="button" class="button" id="acui_email_template_remove_upload_button"><?php _e( 'Remove file', 'import-users-from-csv-with-meta' )?></button>
132
+ </div>
133
+ </fieldset>
134
+ <?php
135
+ wp_nonce_field( 'acui_email_template_attachment', 'acui_email_template_attachment' );
136
+ }
137
+
138
+ function save_post( $post_id ){
139
+ if( !isset( $_POST['acui_email_template_attachment'] ) )
140
+ return $post_id;
141
+
142
+ if( !wp_verify_nonce( $_POST['acui_email_template_attachment'], 'acui_email_template_attachment' ) ) {
143
+ return $post_id;
144
+ }
145
+
146
+ if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
147
+ return $post_id;
148
+ }
149
+
150
+ if( 'acui_email_template' != $_POST['post_type'] ) {
151
+ return $post_id;
152
+ }
153
+
154
+ update_post_meta( $post_id, 'email_template_attachment_id', intval( $_POST['email_template_attachment_id'] ) );
155
+ }
156
+ }
157
+
158
+ new ACUI_Email_Template();
trunk/classes/export.php ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Exporter{
5
+ private $path_csv;
6
+
7
+ function __construct(){
8
+ $upload_dir = wp_upload_dir();
9
+ $this->path_csv = $upload_dir['basedir'] . "/export-users.csv";
10
+
11
+ add_action( 'init', array( $this, 'download_export_file' ) );
12
+ add_action( 'admin_init', array( $this, 'download_export_file' ) );
13
+ add_action( 'wp_ajax_acui_export_users_csv', array( $this, 'export_users_csv' ) );
14
+ }
15
+
16
+ static function enqueue(){
17
+ wp_enqueue_script( 'acui_export_js', plugins_url( 'assets/export.js', dirname( __FILE__ ) ), false, ACUI_VERSION, true );
18
+ wp_localize_script( 'acui_export_js', 'acui_export_js_object', array(
19
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
20
+ 'starting_process' => __( 'Starting process', 'import-users-from-csv-with-meta' ),
21
+ 'step' => __( 'Step', 'import-users-from-csv-with-meta' ),
22
+ 'of_approximately' => __( 'of approximately', 'import-users-from-csv-with-meta' ),
23
+ 'steps' => __( 'steps', 'import-users-from-csv-with-meta' ),
24
+ 'error_thrown' => __( 'Error thrown in the server, we cannot continue. Please check console to see full details about the error.', 'import-users-from-csv-with-meta' ),
25
+ ) );
26
+ }
27
+
28
+ static function styles(){
29
+ ?>
30
+ <style>
31
+ #acui_exporter .user-exporter-progress-wrapper{
32
+ padding: 5px;
33
+ background-color: white;
34
+ width: 80%;
35
+ margin: 0 auto;
36
+ text-align: center;
37
+ }
38
+
39
+ #acui_exporter .user-exporter-progress{
40
+ width: 100%;
41
+ height: 42px;
42
+ border: 0;
43
+ border-radius: 9px;
44
+ }
45
+ .user-exporter-progress::-webkit-progress-bar {
46
+ background-color: #f3f3f3;
47
+ border-radius: 9px;
48
+ }
49
+
50
+ .user-exporter-progress::-webkit-progress-value {
51
+ background: #2271b1;
52
+ border-radius: 9px;
53
+ }
54
+
55
+ .user-exporter-progress::-moz-progress-bar {
56
+ background: #2271b1;
57
+ border-radius: 9px;
58
+ }
59
+
60
+ .user-exporter-progress .progress-value {
61
+ padding: 0px 5px;
62
+ line-height: 20px;
63
+ margin-left: 5px;
64
+ font-size: .8em;
65
+ color: #555;
66
+ height: 18px;
67
+ float: right;
68
+ }
69
+
70
+ #acui_exporter.user-exporter__exporting table,
71
+ #acui_exporter .user-exporter-progress-wrapper{
72
+ display: none;
73
+ }
74
+
75
+ #acui_exporter.user-exporter__exporting .user-exporter-progress-wrapper{
76
+ display: block;
77
+ }
78
+ </style>
79
+ <?php
80
+ }
81
+
82
+ static function admin_gui(){
83
+ ?>
84
+ <h3 id="acui_export_users_header"><?php _e( 'Export users', 'import-users-from-csv-with-meta' ); ?></h3>
85
+ <form id="acui_exporter">
86
+ <table class="form-table">
87
+ <tbody>
88
+ <tr id="acui_role_wrapper" valign="top">
89
+ <th scope="row"><?php _e( 'Role', 'import-users-from-csv-with-meta' ); ?></th>
90
+ <td>
91
+ <?php ACUIHTML()->select( array(
92
+ 'options' => ACUI_Helper::get_editable_roles(),
93
+ 'name' => 'role',
94
+ 'show_option_all' => false,
95
+ 'show_option_none' => __( 'All roles', 'import-users-from-csv-with-meta' ),
96
+ )); ?>
97
+ </td>
98
+ </tr>
99
+ <tr id="acui_columns" valign="top">
100
+ <th scope="row"><?php _e( 'Columns', 'import-users-from-csv-with-meta' ); ?></th>
101
+ <td>
102
+ <?php ACUIHTML()->textarea( array( 'name' => 'columns' ) ); ?>
103
+ <span class="description"><?php _e( 'You can use this field to set which columns must be exported and in which order. If you leave it empty, all columns will be exported. Use a list of fields separated by commas, for example', 'import-users-from-csv-with-meta' ); ?>: user_email,first_name,last_name</span>
104
+ </td>
105
+ </tr>
106
+ <tr id="acui_user_created_wrapper" valign="top">
107
+ <th scope="row"><?php _e( 'User created', 'import-users-from-csv-with-meta' ); ?></th>
108
+ <td>
109
+ <label for="from">from <?php ACUIHTML()->text( array( 'type' => 'date', 'name' => 'from', 'class' => '' ) ); ?></label>
110
+ <label for="to">to <?php ACUIHTML()->text( array( 'type' => 'date', 'name' => 'to', 'class' => '' ) ); ?></label>
111
+ </td>
112
+ </tr>
113
+ <tr id="acui_delimiter_wrapper" valign="top">
114
+ <th scope="row"><?php _e( 'Delimiter', 'import-users-from-csv-with-meta' ); ?></th>
115
+ <td>
116
+ <?php ACUIHTML()->select( array(
117
+ 'options' => ACUI_Helper::get_csv_delimiters_titles(),
118
+ 'name' => 'delimiter',
119
+ 'show_option_all' => false,
120
+ 'show_option_none' => false,
121
+ )); ?>
122
+ </td>
123
+ </tr>
124
+ <tr id="acui_timestamp_wrapper" valign="top">
125
+ <th scope="row"><?php _e( 'Convert timestamp data to date format', 'import-users-from-csv-with-meta' ); ?></th>
126
+ <td>
127
+ <?php ACUIHTML()->checkbox( array( 'name' => 'convert_timestamp', 'current' => 0 ) ); ?>
128
+ <?php ACUIHTML()->text( array( 'name' => 'datetime_format', 'value' => 'Y-m-d H:i:s', 'class' => '' ) ); ?>
129
+ <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> <?php _e( 'If you have problems and you get some value exported as a date that should not be converted to date, please deactivate this option. If this option is not activated, datetime format will be ignored.', 'import-users-from-csv-with-meta' ); ?></span>
130
+ </td>
131
+ </tr>
132
+ <tr id="acui_order_fields_alphabetically_wrapper" valign="top">
133
+ <th scope="row"><?php _e( 'Order fields alphabetically', 'import-users-from-csv-with-meta' ); ?></th>
134
+ <td>
135
+ <?php ACUIHTML()->checkbox( array( 'name' => 'order_fields_alphabetically', 'current' => 0 ) ); ?>
136
+ <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>
137
+ </td>
138
+ </tr>
139
+ <tr id="acui_order_fields_double_encapsulate_serialized_values" valign="top">
140
+ <th scope="row"><?php _e( 'Double encapsulate serialized values', 'import-users-from-csv-with-meta' ); ?></th>
141
+ <td>
142
+ <?php ACUIHTML()->checkbox( array( 'name' => 'double_encapsulate_serialized_values', 'current' => 0 ) ); ?>
143
+ <span class="description"><?php _e( "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", 'import-users-from-csv-with-meta' ); ?></span>
144
+ </td>
145
+ </tr>
146
+ <tr id="acui_download_csv_wrapper" valign="top">
147
+ <th scope="row"><?php _e( 'Download CSV file with users', 'import-users-from-csv-with-meta' ); ?></th>
148
+ <td>
149
+ <input class="button-primary" type="submit" value="<?php _e( 'Download', 'import-users-from-csv-with-meta'); ?>"/>
150
+ </td>
151
+ </tr>
152
+ </tbody>
153
+ </table>
154
+ <input type="hidden" name="action" value="acui_export_users_csv"/>
155
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
156
+
157
+ <div class="user-exporter-progress-wrapper">
158
+ <progress class="user-exporter-progress" value="0" max="100"></progress>
159
+ <span class="user-exporter-progress-value">0%</span>
160
+ </div>
161
+ </form>
162
+
163
+ <script type="text/javascript">
164
+ jQuery( document ).ready( function( $ ){
165
+ $( "input[name='from']" ).change( function() {
166
+ $( "input[name='to']" ).attr( 'min', $( this ).val() );
167
+ })
168
+
169
+ $( '#convert_timestamp' ).on( 'click', function() {
170
+ check_convert_timestamp_checked();
171
+ });
172
+
173
+ function check_convert_timestamp_checked(){
174
+ if( $('#convert_timestamp').is(':checked') ){
175
+ $( '#datetime_format' ).prop( 'disabled', false );
176
+ } else {
177
+ $( '#datetime_format' ).prop( 'disabled', true );
178
+ }
179
+ }
180
+ } )
181
+ </script>
182
+ <?php
183
+ }
184
+
185
+ function download_export_file() {
186
+ if( current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) && isset( $_GET['action'], $_GET['nonce'] ) && wp_verify_nonce( wp_unslash( $_GET['nonce'] ), 'codection-security' ) && 'download_user_csv' === wp_unslash( $_GET['action'] ) ) {
187
+ $exporter = new ACUI_Batch_Exporter();
188
+
189
+ if ( !empty( $_GET['filename'] ) ){
190
+ $exporter->set_filename( wp_unslash( $_GET['filename'] ) );
191
+ }
192
+
193
+ $exporter->export();
194
+ }
195
+ }
196
+
197
+ function export_users_csv(){
198
+ check_ajax_referer( 'codection-security', 'security' );
199
+
200
+ if( !current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
201
+ wp_die( __( 'Only users who are able to create users can export them.', 'import-users-from-csv-with-meta' ) );
202
+
203
+
204
+ $step = isset( $_POST['step'] ) ? absint( $_POST['step'] ) : 1;
205
+
206
+ $exporter = new ACUI_Batch_Exporter();
207
+
208
+ $exporter->set_page( $step );
209
+ $exporter->set_delimiter( sanitize_text_field( $_POST['delimiter'] ) );
210
+ $exporter->set_role( sanitize_text_field( $_POST['role'] ) );
211
+ $exporter->set_from( sanitize_text_field( $_POST['from'] ) );
212
+ $exporter->set_to( sanitize_text_field( $_POST['to'] ) );
213
+ $exporter->set_convert_timestamp( $_POST['convert_timestamp'] );
214
+ $exporter->set_datetime_format( sanitize_text_field( $_POST['datetime_format'] ) );
215
+ $exporter->set_order_fields_alphabetically( $_POST['order_fields_alphabetically'] );
216
+ $exporter->set_double_encapsulate_serialized_values( $_POST['double_encapsulate_serialized_values'] );
217
+ $exporter->set_filtered_columns( ( isset( $_POST['columns'] ) && !empty( $_POST['columns'] ) ) ? $_POST['columns'] : array() );
218
+ $exporter->set_orderby( ( isset( $_POST['orderby'] ) && !empty( $_POST['orderby'] ) ) ? sanitize_text_field( $_POST['orderby'] ) : '' );
219
+ $exporter->set_order( ( isset( $_POST['order'] ) && !empty( $_POST['order'] ) ) ? sanitize_text_field( $_POST['order'] ) : 'ASC' );
220
+ $exporter->load_columns();
221
+
222
+ $exporter->generate_file();
223
+
224
+ if ( 100 <= $exporter->get_percent_complete() ) {
225
+ $query_args = array(
226
+ 'nonce' => wp_create_nonce( 'codection-security' ),
227
+ 'action' => 'download_user_csv',
228
+ 'filename' => $exporter->get_filename()
229
+ );
230
+
231
+ wp_send_json_success(
232
+ array(
233
+ 'step' => 'done',
234
+ 'percentage' => 100,
235
+ 'url' => add_query_arg( $query_args, admin_url( 'tools.php?page=acui&tab=export' ) ),
236
+ )
237
+ );
238
+ } else {
239
+ wp_send_json_success(
240
+ array(
241
+ 'step' => ++$step,
242
+ 'total_steps' => $exporter->get_total_steps(),
243
+ 'percentage' => $exporter->get_percent_complete(),
244
+ )
245
+ );
246
+ }
247
+ }
248
+ }
249
+
250
+ $acui_exporter = new ACUI_Exporter();
trunk/classes/force-reset-password.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_Force_Reset_Password{
6
+ function __construct(){
7
+ }
8
+
9
+ function hooks(){
10
+ add_action( 'post_acui_import_single_user', array( $this, 'new_user' ), 10, 9 );
11
+ add_action( 'personal_options_update', array( $this, 'updated' ) );
12
+ add_action( 'template_redirect', array( $this, 'redirect' ) );
13
+ add_action( 'current_screen', array( $this, 'redirect' ) );
14
+ add_action( 'admin_notices', array( $this, 'notice' ) );
15
+ }
16
+
17
+ function new_user( $headers, $data, $user_id, $role, $positions, $form_data, $is_frontend, $is_cron, $password_changed ){
18
+ if( isset( $form_data["force_user_reset_password"] ) && in_array( $form_data["force_user_reset_password"], array( 'yes', 1 ) ) && $password_changed )
19
+ update_user_meta( $user_id, 'acui_force_reset_password', 1 );
20
+ }
21
+
22
+ function updated( $user_id ){
23
+ $pass1 = $pass2 = '';
24
+
25
+ if ( isset( $_POST['pass1'] ) )
26
+ $pass1 = $_POST['pass1'];
27
+
28
+ if ( isset( $_POST['pass2'] ) )
29
+ $pass2 = $_POST['pass2'];
30
+
31
+ if ( $pass1 != $pass2 || empty( $pass1 ) || empty( $pass2 ) || false !== strpos( stripslashes( $pass1 ), "\\" ) )
32
+ return;
33
+
34
+ delete_user_meta( $user_id, 'acui_force_reset_password' );
35
+ }
36
+
37
+ function redirect() {
38
+ if( is_admin() ) {
39
+ $screen = get_current_screen();
40
+
41
+ if ( in_array( $screen->base, array( 'profile', 'plugins' ) ) )
42
+ return;
43
+ }
44
+
45
+ if( !is_user_logged_in() )
46
+ return;
47
+
48
+ if( apply_filters( 'acui_force_reset_password_redirect_condition', false ) )
49
+ return;
50
+
51
+ if( get_user_meta( get_current_user_id(), 'acui_force_reset_password', true ) ) {
52
+ wp_redirect( apply_filters( 'acui_force_reset_password_edit_profile_url', admin_url( 'profile.php' ) ) );
53
+ die();
54
+ }
55
+ }
56
+
57
+ function notice(){
58
+ if ( get_user_meta( get_current_user_id(), 'acui_force_reset_password', true ) ) {
59
+ printf( '<div class="error"><p>%s</p></div>', apply_filters( 'acui_force_reset_password_message', __( 'Please change your password', 'import-users-from-csv-with-meta' ) ) );
60
+ }
61
+ }
62
+ }
63
+
64
+ $acui_force_reset_password = new ACUI_Force_Reset_Password();
65
+ $acui_force_reset_password->hooks();
trunk/classes/frontend.php ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_Frontend{
6
+ function __construct(){
7
+ }
8
+
9
+ function hooks(){
10
+ add_action( 'acui_frontend_save_settings', array( $this, 'save_settings' ), 10, 1 );
11
+ add_action( 'acui_post_frontend_import', array( $this, 'email_admin' ) );
12
+ add_shortcode( 'import-users-from-csv-with-meta', array( $this, 'shortcode_import' ) );
13
+ add_shortcode( 'export-users', array( $this, 'shortcode_export' ) );
14
+ }
15
+
16
+ static function admin_gui(){
17
+ $send_mail_frontend = get_option( "acui_frontend_send_mail" );
18
+ $send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated" );
19
+ $send_mail_admin_frontend = get_option( "acui_frontend_mail_admin" );
20
+ $send_mail_admin_adress_list_frontend = get_option( "acui_frontend_send_mail_admin_address_list" );
21
+ $delete_users_frontend = get_option( "acui_frontend_delete_users" );
22
+ $delete_users_assign_posts_frontend = get_option( "acui_frontend_delete_users_assign_posts" );
23
+ $change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
24
+ $change_role_not_present_role_frontend = get_option( "acui_frontend_change_role_not_present_role" );
25
+ $role = get_option( "acui_frontend_role" );
26
+ $update_existing_users = get_option( "acui_frontend_update_existing_users" );
27
+ $update_roles_existing_users = get_option( "acui_frontend_update_roles_existing_users" );
28
+ $activate_users_wp_members = get_option( "acui_frontend_activate_users_wp_members" );
29
+
30
+ if( empty( $send_mail_frontend ) )
31
+ $send_mail_frontend = false;
32
+
33
+ if( empty( $send_mail_updated_frontend ) )
34
+ $send_mail_updated_frontend = false;
35
+
36
+ if( empty( $send_mail_admin_frontend ) )
37
+ $send_mail_admin_frontend = false;
38
+
39
+ if( empty( $update_existing_users ) )
40
+ $update_existing_users = 'no';
41
+
42
+ if( empty( $update_roles_existing_users ) )
43
+ $update_roles_existing_users = 'no';
44
+ ?>
45
+ <h3><?php _e( "Execute an import of users in the frontend", 'import-users-from-csv-with-meta' ); ?> <em><a href="#export_frontend">(<?php _e( "you can also do an export in the frontend", 'import-users-from-csv-with-meta' ); ?>)</a></em></h3>
46
+
47
+ <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8">
48
+ <table class="form-table">
49
+ <tbody>
50
+
51
+ <tr class="form-field">
52
+ <th scope="row"><label for=""><?php _e( 'Use this shortcode in any page or post', 'import-users-from-csv-with-meta' ); ?></label></th>
53
+ <td>
54
+ <pre>[import-users-from-csv-with-meta]</pre>
55
+ <input class="button-primary" type="button" id="copy_to_clipboard" value="<?php _e( 'Copy to clipboard', 'import-users-from-csv-with-meta'); ?>"/>
56
+ </td>
57
+ </tr>
58
+
59
+ <tr class="form-field">
60
+ <th scope="row"><label for=""><?php _e( 'Attribute role', 'import-users-from-csv-with-meta' ); ?></label></th>
61
+ <td><?php _e( 'You can use role as attribute to choose directly in the shortcode the role to use during the import. Remind that you must use the role slug, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta role="editor"]</pre>
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="form-field">
66
+ <th scope="row"><label for=""><?php _e( 'Attribute delete-only-specified-role', 'import-users-from-csv-with-meta' ); ?></label></th>
67
+ <td><?php _e( 'You can use this attribute to make delete only users of the specified role that are not present in the CSV, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[import-users-from-csv-with-meta role="editor" delete-only-specified-role="true"]</pre> <?php _e( 'will only delete (if the deletion is active) the users not present in the CSV with are editors', 'import-users-from-csv-with-meta' ); ?>
68
+ </td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+
73
+ <h2 id="acui_roles_header"><?php _e( 'Roles', 'import-users-from-csv-with-meta'); ?></h2>
74
+ <table class="form-table">
75
+ <tbody>
76
+ <tr class="form-field form-required">
77
+ <th scope="row"><label for="role"><?php _e( 'Default role', 'import-users-from-csv-with-meta' ); ?></label></th>
78
+ <td>
79
+ <?php ACUIHTML()->select( array(
80
+ 'options' => ACUI_Helper::get_editable_roles(),
81
+ 'name' => 'role-frontend',
82
+ 'selected' => $role,
83
+ 'show_option_all' => false,
84
+ 'show_option_none' => __( 'Disable role assignment in frontend import', 'import-users-from-csv-with-meta' ),
85
+ )); ?>
86
+ <p class="description"><?php _e( 'Which role would be used to import users?', 'import-users-from-csv-with-meta' ); ?></p>
87
+ </td>
88
+ </tr>
89
+ </tbody>
90
+ </table>
91
+
92
+ <h2 id="acui_options_header"><?php _e( 'Options', 'import-users-from-csv-with-meta'); ?></h2>
93
+ <table class="form-table">
94
+ <tbody>
95
+
96
+ <tr id="acui_send_email_wrapper" class="form-field">
97
+ <th scope="row"><label for="user_login"><?php _e( 'Send mail', 'import-users-from-csv-with-meta' ); ?></label></th>
98
+ <td>
99
+ <p id="sends_email_wrapper">
100
+ <?php ACUIHTML()->checkbox( array( 'name' => 'send-mail-frontend', 'label' => __( 'Do you wish to send a mail with credentials and other data?', 'import-users-from-csv-with-meta' ), 'compare_value' => $send_mail_frontend ) ); ?>
101
+ </p>
102
+ <p id="send_email_updated_wrapper">
103
+ <?php ACUIHTML()->checkbox( array( 'name' => 'send-mail-updated-frontend', 'label' => __( 'Do you wish to send this mail also to users that are being updated? (not only to the one which are being created)', 'import-users-from-csv-with-meta' ), 'compare_value' => $send_mail_updated_frontend ) ); ?>
104
+ </p>
105
+ </td>
106
+ </tr>
107
+
108
+ <tr class="form-field form-required">
109
+ <th scope="row"><label for=""><?php _e( 'Force users to reset their passwords?', 'import-users-from-csv-with-meta' ); ?></label></th>
110
+ <td>
111
+ <?php ACUIHTML()->checkbox( array( 'name' => 'force_user_reset_password', 'compare_value' => get_option( 'acui_frontend_force_user_reset_password' ) ) ); ?>
112
+ <p class="description"><?php _e( 'If a password is set to an user and you activate this option, the user will be forced to reset their password in their first login', 'import-users-from-csv-with-meta' ); ?></p>
113
+ </td>
114
+ </tr>
115
+
116
+ <tr class="form-field form-required">
117
+ <th scope="row"><label for="send_mail_admin_frontend"><?php _e( 'Send notification to admin when the frontend importer is used?', 'import-users-from-csv-with-meta' ); ?></label></th>
118
+ <td>
119
+ <div style="float:left; margin-top: 10px;">
120
+ <?php ACUIHTML()->checkbox( array( 'name' => 'send_mail_admin_frontend', 'compare_value' => $send_mail_admin_frontend ) ); ?>
121
+ </div>
122
+ <div style="margin-left:25px;">
123
+ <?php ACUIHTML()->text( array( 'name' => 'send_mail_admin_frontend_address_list', 'value' => $send_mail_admin_adress_list_frontend, 'class' => '', 'placeholder' => __( 'Include a list of emails where notification will be sent, use commas to separate addresses', 'import-users-from-csv-with-meta' ) ) ); ?>
124
+ <p class="description"><?php _e( 'If list is empty, the admin email will be used', 'import-users-from-csv-with-meta' ); ?></p>
125
+ </div>
126
+ </td>
127
+ </tr>
128
+ </tbody>
129
+ </table>
130
+
131
+ <h2><?php _e( 'Update users', 'import-users-from-csv-with-meta'); ?></h2>
132
+
133
+ <table class="form-table">
134
+ <tbody>
135
+ <tr class="form-field form-required">
136
+ <th scope="row"><label><?php _e( 'Update existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
137
+ <td>
138
+ <?php ACUIHTML()->select( array(
139
+ 'options' => array( 'yes' => __( 'Yes', 'import-users-from-csv-with-meta' ), 'no' => __( 'No', 'import-users-from-csv-with-meta' ) ),
140
+ 'name' => 'update_existing_users',
141
+ 'selected' => $update_existing_users,
142
+ 'show_option_all' => false,
143
+ 'show_option_none' => false,
144
+ )); ?>
145
+ </td>
146
+ </tr>
147
+
148
+ <tr class="form-field form-required">
149
+ <th scope="row"><label><?php _e( 'Update roles for existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
150
+ <td>
151
+ <?php ACUIHTML()->select( array(
152
+ 'options' => array( 'yes' => __( 'Yes', 'import-users-from-csv-with-meta' ), 'no' => __( 'No', 'import-users-from-csv-with-meta' ), 'yes_no_override' => __( 'Yes, add new roles and not override existing ones', 'import-users-from-csv-with-meta' ) ),
153
+ 'name' => 'update_roles_existing_users',
154
+ 'selected' => $update_roles_existing_users,
155
+ 'show_option_all' => false,
156
+ 'show_option_none' => false,
157
+ )); ?>
158
+ </td>
159
+ </tr>
160
+ </tbody>
161
+ </table>
162
+
163
+ <h2><?php _e( 'Users not present in CSV file', 'import-users-from-csv-with-meta'); ?></h2>
164
+ <table class="form-table">
165
+ <tbody>
166
+
167
+ <tr class="form-field form-required">
168
+ <th scope="row"><label for="delete_users_frontend"><?php _e( 'Delete users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
169
+ <td>
170
+ <div style="float:left; margin-top: 10px;">
171
+ <?php ACUIHTML()->checkbox( array( 'name' => 'delete_users_frontend', 'compare_value' => $delete_users_frontend ) ); ?>
172
+ </div>
173
+ <div style="margin-left:25px;">
174
+ <?php ACUIHTML()->select( array(
175
+ 'options' => ACUI_Helper::get_list_users_with_display_name(),
176
+ 'name' => 'delete-users-assign-posts-frontend',
177
+ 'selected' => $delete_users_assign_posts_frontend,
178
+ 'show_option_all' => false,
179
+ 'show_option_none' => __( 'Delete posts of deleted users without assigning to any user', 'import-users-from-csv-with-meta' ),
180
+ )); ?>
181
+ <p class="description"><?php _e( 'After delete users, we can choose if we want to assign their posts to another user. Please do not delete them or posts will be deleted.', 'import-users-from-csv-with-meta' ); ?></p>
182
+ </div>
183
+ </td>
184
+ </tr>
185
+
186
+ <tr class="form-field form-required">
187
+ <th scope="row"><label for="change_role_not_present_frontend"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
188
+ <td>
189
+ <div style="float:left; margin-top: 10px;">
190
+ <?php ACUIHTML()->checkbox( array( 'name' => 'change_role_not_present_frontend', 'compare_value' => $change_role_not_present_frontend ) ); ?>
191
+ </div>
192
+ <div style="margin-left:25px;">
193
+ <?php ACUIHTML()->select( array(
194
+ 'options' => ACUI_Helper::get_editable_roles(),
195
+ 'name' => 'change_role_not_present_role_frontend',
196
+ 'selected' => $change_role_not_present_role_frontend,
197
+ 'show_option_all' => false,
198
+ 'show_option_none' => false,
199
+ )); ?>
200
+ <p class="description"><?php _e( 'After import users which is not present in the CSV and can be changed to a different role.', 'import-users-from-csv-with-meta' ); ?></p>
201
+ </div>
202
+ </td>
203
+ </tr>
204
+ </tbody>
205
+ </table>
206
+
207
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
208
+ <input class="button-primary" type="submit" value="<?php _e( 'Save frontend import options', 'import-users-from-csv-with-meta'); ?>"/>
209
+ </form>
210
+
211
+ <h3 id="export_frontend"><?php _e( "Execute an export of users in the frontend", 'import-users-from-csv-with-meta' ); ?></h3>
212
+ <table class="form-table">
213
+ <tbody>
214
+
215
+ <tr class="form-field">
216
+ <th scope="row"><label for=""><?php _e( 'Use this shortcode in any page or post', 'import-users-from-csv-with-meta' ); ?></label></th>
217
+ <td>
218
+ <pre>[export-users]</pre>
219
+ <input class="button-primary" type="button" id="copy_to_clipboard_export" value="<?php _e( 'Copy to clipboard', 'import-users-from-csv-with-meta'); ?>"/>
220
+ </td>
221
+ </tr>
222
+
223
+ <tr class="form-field">
224
+ <th scope="row"><label for=""><?php _e( 'Attribute role', 'import-users-from-csv-with-meta' ); ?></label></th>
225
+ <td><?php _e( 'You can use role as attribute to choose directly in the shortcode the role to use during the export. Remind that you must use the role slug, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[export-users role="editor"]</pre>
226
+ </td>
227
+ </tr>
228
+
229
+ <tr class="form-field">
230
+ <th scope="row"><label for=""><?php _e( 'Attribute from', 'import-users-from-csv-with-meta' ); ?></label></th>
231
+ <td><?php _e( 'You can use from attribute to filter users created from a specified date. Date format has to be: Y-m-d, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[export-users from="<?php echo date( 'Y-m-d' ); ?>"]</pre>
232
+ </td>
233
+ </tr>
234
+
235
+ <tr class="form-field">
236
+ <th scope="row"><label for=""><?php _e( 'Attribute to', 'import-users-from-csv-with-meta' ); ?></label></th>
237
+ <td><?php _e( 'You can use from attribute to filter users created before a specified date. Date format has to be: Y-m-d, for example:', 'import-users-from-csv-with-meta' ); ?> <pre>[export-users to="<?php echo date( 'Y-m-d' ); ?>"]</pre>
238
+ </td>
239
+ </tr>
240
+
241
+ <tr class="form-field">
242
+ <th scope="row"><label for=""><?php _e( 'Attribute delimiter', 'import-users-from-csv-with-meta' ); ?></label></th>
243
+ <td><?php _e( 'You can use delimiter attribute to set which delimiter is going to be used, allowed values are:', 'import-users-from-csv-with-meta' ); ?> COMMA, COLON, SEMICOLON, TAB <pre>[export-users delimiter="SEMICOLON"]</pre>
244
+ </td>
245
+ </tr>
246
+
247
+ <tr class="form-field">
248
+ <th scope="row"><label for=""><?php _e( 'Attribute order-alphabetically', 'import-users-from-csv-with-meta' ); ?></label></th>
249
+ <td><?php _e( 'You can use order-alphabetically attribute to order alphabetically the fields, for example', 'import-users-from-csv-with-meta' ); ?> <pre>[export-users order-alphabetically]</pre>
250
+ </td>
251
+ </tr>
252
+
253
+ <tr class="form-field">
254
+ <th scope="row"><label for=""><?php _e( 'Attribute columns', 'import-users-from-csv-with-meta' ); ?></label></th>
255
+ <td><?php _e( 'You can use columns attribute to set which columns must be exported and in which order. Use a list of fields separated by commas, for example', 'import-users-from-csv-with-meta' ); ?> <pre>[export-users columns="user_email,first_name,last_name"]</pre>
256
+ </td>
257
+ </tr>
258
+
259
+ <tr class="form-field">
260
+ <th scope="row"><label for=""><?php _e( 'Attribute orderby', 'import-users-from-csv-with-meta' ); ?></label></th>
261
+ <td><?php _e( 'You can use orderby attribute to set the order in which users would be exported. You can use some of the next fields or a meta_key:', 'import-users-from-csv-with-meta' ); ?>
262
+ <ul style="list-style:disc outside none;margin-left:2em;">
263
+ <li><strong>ID</strong>: <?php _e( 'Order by user id', 'import-users-from-csv-with-meta' ); ?></li>
264
+ <li><strong>display_name</strong>: <?php _e( 'Order by user display name', 'import-users-from-csv-with-meta' ); ?></li>
265
+ <li><strong>name</strong> or <strong>user_name</strong>: <?php _e( 'Order by user name', 'import-users-from-csv-with-meta' ); ?></li>
266
+ <li><strong>login</strong> or <strong>user_login</strong>: <?php _e( 'Order by user login', 'import-users-from-csv-with-meta' ); ?></li>
267
+ <li><strong>nicename</strong> or <strong>user_nicename</strong>: <?php _e( 'Order by user nicename', 'import-users-from-csv-with-meta' ); ?></li>
268
+ <li><strong>email</strong> or <strong>user_email</strong>: <?php _e( 'Order by user email', 'import-users-from-csv-with-meta' ); ?></li>
269
+ <li><strong>url</strong> or <strong>user_url</strong>: <?php _e( 'Order by user url', 'import-users-from-csv-with-meta' ); ?></li>
270
+ <li><strong>registered</strong> or <strong>user_registered</strong>: <?php _e( 'Order by user registered date', 'import-users-from-csv-with-meta' ); ?></li>
271
+ <li><strong>post_count</strong>: <?php _e( 'Order by user post count', 'import-users-from-csv-with-meta' ); ?></li>
272
+ <li><strong><?php _e( 'Any meta_key', 'import-users-from-csv-with-meta' ); ?></strong>: <?php _e( 'Order by user meta value', 'import-users-from-csv-with-meta' ); ?></li>
273
+ </ul>
274
+ <?php _e( 'For example', 'import-users-from-csv-with-meta' ); ?> <pre style="display: inline-block;">[export-users orderby="user_email"]</pre>
275
+ </td>
276
+ </tr>
277
+
278
+ <tr class="form-field">
279
+ <th scope="row"><label for=""><?php _e( 'Attribute order', 'import-users-from-csv-with-meta' ); ?></label></th>
280
+ <td><?php _e( 'If you use orderby attrbute you can also use order attribute that designates the ascending or descending order of the "orderby" parameter, values can be "asc" or "desc", for example', 'import-users-from-csv-with-meta' ); ?> <pre>[export-users orderby="display_name" order="asc"]</pre>
281
+ </td>
282
+ </tr>
283
+
284
+ </tbody>
285
+ </table>
286
+
287
+ <script>
288
+ jQuery( document ).ready( function( $ ){
289
+ check_delete_users_checked();
290
+ check_send_mail_admin_frontend();
291
+
292
+ $( '#delete_users_frontend' ).on( 'click', function() {
293
+ check_delete_users_checked();
294
+ });
295
+
296
+ $( '#send_mail_admin_frontend' ).on( 'click', function() {
297
+ check_send_mail_admin_frontend();
298
+ });
299
+
300
+ $( '#copy_to_clipboard' ).click( function(){
301
+ var $temp = $("<input>");
302
+ $("body").append($temp);
303
+ $temp.val( '[import-users-from-csv-with-meta]' ).select();
304
+ document.execCommand("copy");
305
+ $temp.remove();
306
+ } );
307
+
308
+ $( '#copy_to_clipboard_export' ).click( function(){
309
+ var $temp = $("<input>");
310
+ $("body").append($temp);
311
+ $temp.val( '[export-users]' ).select();
312
+ document.execCommand("copy");
313
+ $temp.remove();
314
+ } );
315
+
316
+ function check_delete_users_checked(){
317
+ if( $('#delete_users_frontend').is(':checked') ){
318
+ $( '#change_role_not_present_role_frontend' ).prop( 'disabled', true );
319
+ $( '#change_role_not_present_frontend' ).prop( 'disabled', true );
320
+ } else {
321
+ $( '#change_role_not_present_role_frontend' ).prop( 'disabled', false );
322
+ $( '#change_role_not_present_frontend' ).prop( 'disabled', false );
323
+ }
324
+ }
325
+
326
+ function check_send_mail_admin_frontend(){
327
+ if( $('#send_mail_admin_frontend').is(':checked') ){
328
+ $( '#send_mail_admin_frontend_address_list' ).prop( 'disabled', false );
329
+ } else {
330
+ $( '#send_mail_admin_frontend_address_list' ).prop( 'disabled', true );
331
+ }
332
+ }
333
+ });
334
+ </script>
335
+ <?php
336
+ }
337
+
338
+ function save_settings( $form_data ){
339
+ if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
340
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
341
+ }
342
+
343
+ ACUI_Options::save_options( $form_data, false, true );
344
+ ?>
345
+ <div class="updated">
346
+ <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
347
+ </div>
348
+ <?php
349
+ }
350
+
351
+ function email_admin(){
352
+ $send_mail_admin_frontend = get_option( "acui_frontend_mail_admin" );
353
+ if( $send_mail_admin_frontend == false )
354
+ return;
355
+
356
+ $send_mail_admin_adress_list_frontend = get_option( "acui_frontend_send_mail_admin_address_list" );
357
+ if( empty( $send_mail_admin_adress_list_frontend ) )
358
+ $send_mail_admin_adress_list_frontend = get_option( 'admin_email' );
359
+
360
+ $current_user = wp_get_current_user();
361
+ $current_user_name = ( empty( $current_user ) ) ? 'User not logged in' : $current_user->user_login;
362
+
363
+ $body_mail = sprintf( __("User with username: %s has executed an import using the shortcode in the frontend.", 'import-users-from-csv-with-meta'), $current_user_name );
364
+
365
+ wp_mail( $send_mail_admin_adress_list_frontend, '[Import and export users and customers] Frontend import has been executed', $body_mail, array( 'Content-Type: text/html; charset=UTF-8' ) );
366
+ }
367
+
368
+ function shortcode_import( $atts ) {
369
+ $atts = shortcode_atts( array( 'role' => '', 'delete-only-specified-role' => false ), $atts );
370
+
371
+ ob_start();
372
+
373
+ if( !current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
374
+ wp_die( __( 'Only users who are able to create users can manage this form.', 'import-users-from-csv-with-meta' ) );
375
+
376
+ if ( $_FILES && !empty( $_POST ) ):
377
+ if ( !wp_verify_nonce( $_POST['security'], 'codection-security' ) ){
378
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
379
+ }
380
+
381
+ do_action( 'acui_pre_frontend_import' );
382
+
383
+ $file = array_keys( $_FILES );
384
+ $csv_file_id = $this->upload_file( $file[0] );
385
+
386
+ // start
387
+ $form_data = array();
388
+ $form_data["path_to_file"] = get_attached_file( $csv_file_id );
389
+
390
+ // emails
391
+ $form_data["sends_email"] = get_option( "acui_frontend_send_mail" );
392
+ $form_data["send_email_updated"] = get_option( "acui_frontend_send_mail_updated" );
393
+ $form_data["force_user_reset_password"] = get_option( "acui_frontend_force_user_reset_password" );
394
+
395
+ // roles
396
+ $form_data["role"] = empty( $atts["role"] ) ? get_option( "acui_frontend_role") : $atts["role"];
397
+
398
+ // update
399
+ $form_data["update_existing_users"] = empty( get_option( "acui_frontend_update_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_existing_users" );
400
+ $form_data["update_roles_existing_users"] = empty( get_option( "acui_frontend_update_roles_existing_users" ) ) ? 'no' : get_option( "acui_frontend_update_roles_existing_users" );
401
+
402
+ // delete
403
+ $form_data["delete_users"] = ( get_option( "acui_frontend_delete_users" ) ) ? 'yes' : 'no';
404
+ $form_data["delete_users_assign_posts"] = get_option( "acui_frontend_delete_users_assign_posts" );
405
+ $form_data["delete_users_only_specified_role"] = empty( $form_data[ "role" ] ) ? false : $atts['delete-only-specified-role'];
406
+
407
+ // others
408
+ $form_data["empty_cell_action"] = "leave";
409
+ $form_data["activate_users_wp_members"] = empty( get_option( "acui_frontend_activate_users_wp_members" ) ) ? 'no_activate' : get_option( "acui_frontend_activate_users_wp_members" );
410
+ $form_data["security"] = wp_create_nonce( "codection-security" );
411
+
412
+ $form_data = apply_filters( 'acui_frontend_import_form_data', $form_data );
413
+
414
+ $acui_import = new ACUI_Import();
415
+ $acui_import->fileupload_process( $form_data, false, true );
416
+
417
+ wp_delete_attachment( $csv_file_id, true );
418
+
419
+ do_action( 'acui_post_frontend_import' );
420
+ else:
421
+ ?>
422
+
423
+ <?php do_action( 'acui_frontend_import_before_form' ); ?>
424
+
425
+ <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" class="acui_frontend_form">
426
+ <?php do_action( 'acui_frontend_import_before_input_file' ); ?>
427
+
428
+ <label><?php _e( 'CSV file <span class="description">(required)</span>', 'import-users-from-csv-with-meta' ); ?></label></th>
429
+ <input class="acui_frontend_file" type="file" name="uploadfile" id="uploadfile" size="35" class="uploadfile" />
430
+
431
+ <?php do_action( 'acui_frontend_import_after_input_file' ); ?>
432
+
433
+ <input class="acui_frontend_submit" type="submit" value="<?php apply_filters( 'acui_import_shortcode_button_text', _e( 'Upload and process', 'import-users-from-csv-with-meta' ) ); ?>"/>
434
+
435
+ <?php do_action( 'acui_frontend_import_after_submit' ); ?>
436
+
437
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
438
+ </form>
439
+
440
+ <?php do_action( 'acui_frontend_import_after_form' ); ?>
441
+
442
+ <?php endif; ?>
443
+
444
+ <?php
445
+ return ob_get_clean();
446
+ }
447
+
448
+ function upload_file( $file_handler ) {
449
+ if ( $_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK ) {
450
+ __return_false();
451
+ }
452
+ require_once( ABSPATH . "wp-admin" . '/includes/image.php' );
453
+ require_once( ABSPATH . "wp-admin" . '/includes/file.php' );
454
+ require_once( ABSPATH . "wp-admin" . '/includes/media.php' );
455
+ $attach_id = media_handle_upload( $file_handler, 0 );
456
+ return $attach_id;
457
+ }
458
+
459
+ function shortcode_export( $atts ) {
460
+ $atts = shortcode_atts( array( 'role' => '', 'from' => '', 'to' => '', 'delimiter' => '', 'order-alphabetically' => '', 'columns' => '', 'orderby' => '', 'order' => '' ), $atts );
461
+
462
+ ob_start();
463
+
464
+ if( !current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
465
+ wp_die( __( 'Only users who are able to create users can export them.', 'import-users-from-csv-with-meta' ) );
466
+
467
+ ACUI_Exporter::enqueue();
468
+ ACUI_Exporter::styles();
469
+ ?>
470
+
471
+ <form method="POST" class="acui_frontend_form" id="acui_exporter">
472
+ <input type="hidden" name="acui_frontend_export" value="1"/>
473
+
474
+ <?php foreach( $atts as $key => $value ): ?>
475
+ <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"/>
476
+ <?php endforeach; ?>
477
+
478
+ <input class="acui_frontend_submit" type="submit" value="<?php apply_filters( 'acui_export_shortcode_button_text', _e( 'Export', 'import-users-from-csv-with-meta' ) ); ?>"/>
479
+
480
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
481
+
482
+ <div class="user-exporter-progress-wrapper">
483
+ <progress class="user-exporter-progress" value="0" max="100"></progress>
484
+ <span class="user-exporter-progress-value">0%</span>
485
+ </div>
486
+ </form>
487
+ <?php
488
+ return ob_get_clean();
489
+ }
490
+ }
491
+ $acui_frontend = new ACUI_Frontend();
492
+ $acui_frontend->hooks();
trunk/classes/help.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_Help{
6
+ public static function message(){
7
+ ?>
8
+ <div class="postbox">
9
+ <h3 class="hndle"><span>&nbsp;<?php _e( 'Need proffessional help with WordPress or WooCommerce?', 'import-users-from-csv-with-meta' ); ?></span></h3>
10
+
11
+ <div class="inside" style="display: block;">
12
+ <p><?php _e( 'Hi! we are', 'import-users-from-csv-with-meta' ); ?> <a href="https://twitter.com/fjcarazo" target="_blank" title="Javier Carazo">Javier Carazo</a> <?php _e( 'and the team of', 'import-users-from-csv-with-meta' ) ?> <a href="http://codection.com">Codection</a>, <?php _e( 'developers of this plugin.', 'import-users-from-csv-with-meta' ); ?></p>
13
+ <p><?php _e( 'We work everyday with WordPress and WooCommerce, if you need proffessional help, hire us. You can send us a message to', 'import-users-from-csv-with-meta' ); ?> <a href="mailto:contacto@codection.com">contacto@codection.com</a>.</p>
14
+ <div style="clear:both;"></div>
15
+ </div>
16
+ </div>
17
+ <?php
18
+ }
19
+ }
trunk/classes/helper.php ADDED
@@ -0,0 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ACUI_Helper{
4
+ function detect_delimiter( $file ) {
5
+ $delimiters = array(
6
+ ';' => 0,
7
+ ',' => 0,
8
+ "\t" => 0,
9
+ "|" => 0
10
+ );
11
+
12
+ $handle = @fopen($file, "r");
13
+ $firstLine = fgets($handle);
14
+ fclose($handle);
15
+ foreach ($delimiters as $delimiter => &$count) {
16
+ $count = count(str_getcsv($firstLine, $delimiter));
17
+ }
18
+
19
+ return array_search(max($delimiters), $delimiters);
20
+ }
21
+
22
+ function user_id_exists( $user_id ){
23
+ if ( get_userdata( $user_id ) === false )
24
+ return false;
25
+ else
26
+ return true;
27
+ }
28
+
29
+ function get_roles_by_user_id( $user_id ){
30
+ $roles = array();
31
+ $user = new WP_User( $user_id );
32
+
33
+ if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
34
+ foreach ( $user->roles as $role )
35
+ $roles[] = $role;
36
+ }
37
+
38
+ return $roles;
39
+ }
40
+
41
+ static function get_editable_roles() {
42
+ global $wp_roles;
43
+
44
+ $all_roles = $wp_roles->roles;
45
+ $editable_roles = apply_filters('editable_roles', $all_roles);
46
+ $list_editable_roles = array();
47
+
48
+ foreach ($editable_roles as $key => $editable_role)
49
+ $list_editable_roles[$key] = $editable_role["name"];
50
+
51
+ return $list_editable_roles;
52
+ }
53
+
54
+ static function get_csv_delimiters_titles(){
55
+ return array(
56
+ 'COMMA' => __( 'Comma', 'import-users-from-csv-with-meta' ),
57
+ 'COLON' => __( 'Colon', 'import-users-from-csv-with-meta' ),
58
+ 'SEMICOLON' => __( 'Semicolon', 'import-users-from-csv-with-meta' ),
59
+ 'TAB' => __( 'Tab', 'import-users-from-csv-with-meta' ),
60
+ );
61
+ }
62
+
63
+ static function get_list_users_with_display_name(){
64
+ $blogusers = get_users( array( 'fields' => array( 'ID', 'display_name' ) ) );
65
+ $result = array();
66
+
67
+ foreach ( $blogusers as $bloguser )
68
+ $result[ $bloguser->ID ] = $bloguser->display_name;
69
+
70
+ return $result;
71
+ }
72
+
73
+ static function get_loaded_periods(){
74
+ $loaded_periods = wp_get_schedules();
75
+ $result = array();
76
+
77
+ foreach ( $loaded_periods as $key => $value )
78
+ $result[ $key ] = $value['display'];
79
+
80
+ return $result;
81
+ }
82
+
83
+ static function get_errors_by_row( $errors, $row, $type = 'error' ){
84
+ $errors_found = array();
85
+
86
+ foreach( $errors as $error ){
87
+ if( $error['row'] == $row && ( $error['type'] == $type || 'any' == $type ) ){
88
+ $errors_found[] = $error['message'];
89
+ }
90
+ }
91
+
92
+ return $errors_found;
93
+ }
94
+
95
+ function string_conversion( $string ){
96
+ if(!preg_match('%(?:
97
+ [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
98
+ |\xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
99
+ |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
100
+ |\xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
101
+ |\xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
102
+ |[\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
103
+ |\xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
104
+ )+%xs', $string)){
105
+ return utf8_encode($string);
106
+ }
107
+ else
108
+ return $string;
109
+ }
110
+
111
+ function get_wp_users_fields(){
112
+ return array( "id", "user_email", "user_nicename", "user_url", "display_name", "nickname", "first_name", "last_name", "description", "jabber", "aim", "yim", "user_registered", "password", "user_pass", "locale", "show_admin_bar_front", "user_login" );
113
+ }
114
+
115
+ function get_restricted_fields(){
116
+ $wp_users_fields = $this->get_wp_users_fields();
117
+ $wp_min_fields = array( "Username", "Email", "role" );
118
+ $acui_restricted_fields = array_merge( $wp_users_fields, $wp_min_fields );
119
+
120
+ return apply_filters( 'acui_restricted_fields', $acui_restricted_fields );
121
+ }
122
+
123
+ function get_not_meta_fields(){
124
+ return apply_filters( 'acui_not_meta_fields', array() );
125
+ }
126
+
127
+ function get_random_unique_username( $prefix = '' ){
128
+ do {
129
+ $rnd_str = sprintf("%06d", mt_rand(1, 999999));
130
+ } while( username_exists( $prefix . $rnd_str ) );
131
+
132
+ return $prefix . $rnd_str;
133
+ }
134
+
135
+ function new_error( $row, &$errors_totals, $message = '', $type = 'error' ){
136
+ switch( $type ){
137
+ case 'error':
138
+ $errors_totals['errors']++;
139
+ break;
140
+
141
+ case 'warning':
142
+ $errors_totals['warnings']++;
143
+ break;
144
+
145
+ case 'notice':
146
+ $errors_totals['notices']++;
147
+ break;
148
+ }
149
+ return array( 'row' => $row, 'message' => $message, 'type' => $type );
150
+ }
151
+
152
+ function maybe_update_email( $user_id, $email, $password, $update_emails_existing_users ){
153
+ $user_object = get_user_by( 'id', $user_id );
154
+
155
+ if( $user_object->user_email == $email )
156
+ return $user_id;
157
+
158
+ switch( $update_emails_existing_users ){
159
+ case 'yes':
160
+ $user_id = wp_update_user( array( 'ID' => $user_id, 'user_email' => $email ) );
161
+ break;
162
+
163
+ case 'no':
164
+ $user_id = 0;
165
+ break;
166
+
167
+ case 'create':
168
+ $user_id = wp_insert_user( array(
169
+ 'user_login' => $this->get_random_unique_username( 'duplicated_username_' ),
170
+ 'user_email' => $email,
171
+ 'user_pass' => $password
172
+ ) );
173
+ break;
174
+
175
+ }
176
+
177
+ return $user_id;
178
+ }
179
+
180
+ static function get_attachment_id_by_url( $url ) {
181
+ $wp_upload_dir = wp_upload_dir();
182
+ $dir = set_url_scheme( trailingslashit( $wp_upload_dir['baseurl'] ), 'relative' );
183
+
184
+ if ( false !== strpos( $url, $dir ) ) {
185
+ $file = basename( $url );
186
+
187
+ $query_args = array(
188
+ 'post_type' => 'attachment',
189
+ 'post_status' => 'inherit',
190
+ 'fields' => 'ids',
191
+ 'meta_query' => array(
192
+ array(
193
+ 'key' => '_wp_attachment_metadata',
194
+ 'compare' => 'LIKE',
195
+ 'value' => $file,
196
+ ),
197
+ ),
198
+ );
199
+
200
+ $query = new WP_Query( $query_args );
201
+
202
+ if ( $query->have_posts() ) {
203
+ foreach ( $query->posts as $attachment_id ) {
204
+ $meta = wp_get_attachment_metadata( $attachment_id );
205
+ $original_file = basename( $meta['file'] );
206
+ $cropped_files = wp_list_pluck( $meta['sizes'], 'file' );
207
+
208
+ if ( $original_file === $file || in_array( $file, $cropped_files ) ) {
209
+ return (int) $attachment_id;
210
+ }
211
+ }
212
+ }
213
+ }
214
+
215
+ return false;
216
+ }
217
+
218
+ static function get_post_id_by_slug( $slug ){
219
+ global $wpdb;
220
+
221
+ $page_path = rawurlencode( urldecode( $slug ) );
222
+ $page_path = str_replace( '%2F', '/', $page_path );
223
+ $page_path = str_replace( '%20', ' ', $page_path );
224
+ $parts = explode( '/', trim( $page_path, '/' ) );
225
+ $parts = array_map( 'sanitize_title_for_query', $parts );
226
+ $escaped_parts = esc_sql( $parts );
227
+
228
+ $in_string = "'" . implode( "','", $escaped_parts ) . "'";
229
+
230
+ $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent, post_type FROM $wpdb->posts WHERE post_name IN (%s)", $in_string ), OBJECT_K );
231
+ $revparts = array_reverse( $parts );
232
+
233
+ $foundid = 0;
234
+
235
+ foreach ( (array) $pages as $page ) {
236
+ if ( $page->post_name == $revparts[0] ) {
237
+ $count = 0;
238
+ $p = $page;
239
+
240
+ while ( 0 != $p->post_parent && isset( $pages[ $p->post_parent ] ) ) {
241
+ $count++;
242
+ $parent = $pages[ $p->post_parent ];
243
+ if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] ) {
244
+ break;
245
+ }
246
+ $p = $parent;
247
+ }
248
+
249
+ if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) {
250
+ $foundid = $page->ID;
251
+ if ( $page->post_type == $p->post_type ) {
252
+ break;
253
+ }
254
+ }
255
+ }
256
+ }
257
+
258
+ return $foundid;
259
+ }
260
+
261
+ function print_table_header_footer( $headers ){
262
+ ?>
263
+ <h3><?php echo apply_filters( 'acui_log_inserting_updating_data_title', __( 'Inserting and updating data', 'import-users-from-csv-with-meta' ) ); ?></h3>
264
+ <table id="acui_results">
265
+ <thead>
266
+ <tr>
267
+ <th><?php _e( 'Row', 'import-users-from-csv-with-meta' ); ?></th>
268
+ <?php foreach( $headers as $element ):
269
+ echo "<th>" . $element . "</th>";
270
+ endforeach; ?>
271
+ <?php do_action( 'acui_header_table_extra_rows' ); ?>
272
+ </tr>
273
+ </thead>
274
+ <tfoot>
275
+ <tr>
276
+ <th><?php _e( 'Row', 'import-users-from-csv-with-meta' ); ?></th>
277
+ <?php foreach( $headers as $element ):
278
+ echo "<th>" . $element . "</th>";
279
+ endforeach; ?>
280
+ <?php do_action( 'acui_header_table_extra_rows' ); ?>
281
+ </tr>
282
+ </tfoot>
283
+ <tbody>
284
+ <?php
285
+ }
286
+
287
+ function print_table_end(){
288
+ ?>
289
+ </tbody>
290
+ </table>
291
+ <?php
292
+ }
293
+
294
+ function print_row_imported( $row, $data, $errors ){
295
+ $styles = "";
296
+
297
+ if( !empty( ACUI_Helper::get_errors_by_row( $errors, $row, 'any' ) ) )
298
+ $styles = "background-color:red; color:white;";
299
+
300
+ echo "<tr style='$styles' ><td>" . ($row - 1) . "</td>";
301
+ foreach ( $data as $element ){
302
+ if( is_wp_error( $element ) )
303
+ $element = $element->get_error_message();
304
+ elseif( is_object( $element ) ){
305
+ $element = serialize( $element );
306
+ }
307
+ elseif( is_array( $element ) ){
308
+ $element_string = '';
309
+ $i = 0;
310
+
311
+ foreach( $element as $it => $el ){
312
+ if( is_wp_error( $el ) )
313
+ $element_string .= $el->get_error_message();
314
+ elseif( is_array( $el ) || is_object( $el ) )
315
+ $element_string .= serialize( $el );
316
+ elseif( !is_int( $it ) )
317
+ $element_string .= $it . "=>" . $el;
318
+ else
319
+ $element_string .= $el;
320
+
321
+ if(++$i !== count( $element ) ){
322
+ $element_string .= ',';
323
+ }
324
+ }
325
+
326
+ $element = $element_string;
327
+ }
328
+
329
+ $element = wp_kses_post( $element );
330
+ echo "<td>$element</td>";
331
+ }
332
+
333
+ echo "</tr>\n";
334
+
335
+ flush();
336
+ }
337
+
338
+ function print_errors( $errors ){
339
+ if( empty( $errors ) )
340
+ return;
341
+ ?>
342
+ <h3><?php _e( 'Errors, warnings and notices', 'import-users-from-csv-with-meta' ); ?></h3>
343
+ <table id="acui_errors">
344
+ <thead>
345
+ <tr>
346
+ <th><?php _e( 'Row', 'import-users-from-csv-with-meta' ); ?></th>
347
+ <th><?php _e( 'Details', 'import-users-from-csv-with-meta' ); ?></th>
348
+ <th><?php _e( 'Type', 'import-users-from-csv-with-meta' ); ?></th>
349
+ </tr>
350
+ </thead>
351
+ <tfoot>
352
+ <tr>
353
+ <th><?php _e( 'Row', 'import-users-from-csv-with-meta' ); ?></th>
354
+ <th><?php _e( 'Details', 'import-users-from-csv-with-meta' ); ?></th>
355
+ <th><?php _e( 'Type', 'import-users-from-csv-with-meta' ); ?></th>
356
+ </tr>
357
+ </tfoot>
358
+ <tbody>
359
+ <?php foreach( $errors as $error ): ?>
360
+ <tr>
361
+ <td><?php echo $error['row']; ?></td>
362
+ <td><?php echo $error['message']; ?></td>
363
+ <td><?php echo $error['type']; ?></td>
364
+ </tr>
365
+ <?php endforeach; ?>
366
+ </tbody>
367
+ </table>
368
+ <?php
369
+ }
370
+
371
+ function print_results( $results, $errors ){
372
+ ?>
373
+ <h3><?php _e( 'Results', 'import-users-from-csv-with-meta' ); ?></h3>
374
+ <table id="acui_results">
375
+ <tbody>
376
+ <tr>
377
+ <th><?php _e( 'Users processed', 'import-users-from-csv-with-meta' ); ?></th>
378
+ <td><?php echo $results['created'] + $results['updated']; ?></td>
379
+ </tr>
380
+ <tr>
381
+ <th><?php _e( 'Users created', 'import-users-from-csv-with-meta' ); ?></th>
382
+ <td><?php echo $results['created']; ?></td>
383
+ </tr>
384
+ <tr>
385
+ <th><?php _e( 'Users updated', 'import-users-from-csv-with-meta' ); ?></th>
386
+ <td><?php echo $results['updated']; ?></td>
387
+ </tr>
388
+ <tr>
389
+ <th><?php _e( 'Users deleted', 'import-users-from-csv-with-meta' ); ?></th>
390
+ <td><?php echo $results['deleted']; ?></td>
391
+ </tr>
392
+ <tr>
393
+ <th><?php _e( 'Errors, warnings and notices found', 'import-users-from-csv-with-meta' ); ?></td>
394
+ <td><?php echo count( $errors ); ?></td>
395
+ </tr>
396
+ </tbody>
397
+ </table>
398
+ <?php
399
+ }
400
+
401
+ function print_end_of_process(){
402
+ ?>
403
+ <br/>
404
+ <p><?php printf( __( 'Process finished you can go <a href="%s">here to see results</a> or you can do <a href="%s">a new import</a>.', 'import-users-from-csv-with-meta' ), get_admin_url( null, 'users.php' ), get_admin_url( null, 'tools.php?page=acui&tab=homepage' ) ); ?></p>
405
+ <?php
406
+ }
407
+
408
+ function execute_datatable(){
409
+ ?>
410
+ <script>
411
+ jQuery( document ).ready( function( $ ){
412
+ $( '#acui_results,#acui_errors' ).DataTable({
413
+ "scrollX": true,
414
+ });
415
+ } )
416
+ </script>
417
+ <?php
418
+ }
419
+
420
+ function basic_css(){
421
+ ?>
422
+ <style type="text/css">
423
+ .wrap{
424
+ overflow-x:auto!important;
425
+ }
426
+
427
+ .wrap table{
428
+ min-width:800px!important;
429
+ }
430
+
431
+ .wrap table th,
432
+ .wrap table td{
433
+ width:200px!important;
434
+ }
435
+ </style>
436
+ <?php
437
+ }
438
+
439
+ static function get_array_from_cell( $value ){
440
+ if( strpos( $value, "=>" ) === false )
441
+ return explode( "::", $value );
442
+
443
+ $array_prepared = array();
444
+
445
+ foreach( explode( "::", $value ) as $data ){
446
+ $key_value = explode( "=>", $data );
447
+ $array_prepared[ $key_value[0] ] = $key_value[1];
448
+ }
449
+
450
+ return $array_prepared;
451
+ }
452
+
453
+ static function get_value_from_row( $key, $headers, $row, $user_id = 0 ){
454
+ $pos = array_search( $key, $headers );
455
+
456
+ if( $pos === false ){
457
+ return ( $user_id == 0 ) ? false : get_user_meta( $user_id, $key, true );
458
+ }
459
+
460
+ return $row[ $pos ];
461
+ }
462
+
463
+ static function show_meta( $user_id, $meta_key ){
464
+ $user_meta = get_user_meta( $user_id, $meta_key, true );
465
+ return is_array( $user_meta ) ? var_export( $user_meta, true ) : $user_meta;
466
+ }
467
+ }
trunk/classes/homepage.php ADDED
@@ -0,0 +1,502 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) )
3
+ exit;
4
+
5
+ class ACUI_Homepage{
6
+ function __construct(){
7
+ }
8
+
9
+ function hooks(){
10
+ add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ), 10, 1 );
11
+ add_action( 'acui_homepage_start', array( $this, 'maybe_remove_old_csv' ) );
12
+ add_action( 'wp_ajax_acui_delete_attachment', array( $this, 'delete_attachment' ) );
13
+ add_action( 'wp_ajax_acui_bulk_delete_attachment', array( $this, 'bulk_delete_attachment' ) );
14
+ add_action( 'wp_ajax_acui_delete_users_assign_posts_data', array( $this, 'delete_users_assign_posts_data' ) );
15
+ }
16
+
17
+ function load_scripts( $hook ){
18
+ if( $hook != 'tools_page_acui' || isset( $_GET['tab'] ) )
19
+ return;
20
+
21
+ wp_enqueue_style( 'select2-css', '//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css' );
22
+ wp_enqueue_script( 'select2-js', '//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js' );
23
+ }
24
+
25
+ static function admin_gui(){
26
+ $last_roles_used = empty( get_option( 'acui_last_roles_used' ) ) ? array( 'subscriber' ) : get_option( 'acui_last_roles_used' );
27
+ ?>
28
+ <div class="wrap acui">
29
+
30
+ <?php do_action( 'acui_homepage_start' ); ?>
31
+
32
+ <div id='message' class='updated'><?php _e( 'File must contain at least <strong>2 columns: username and email</strong>. These should be the first two columns and it should be placed <strong>in this order: username and email</strong>. If there are more columns, this plugin will manage it automatically.', 'import-users-from-csv-with-meta' ); ?></div>
33
+ <div id='message-password' class='error'><?php _e( 'Please, read carefully how <strong>passwords are managed</strong> and also take note about capitalization, this plugin is <strong>case sensitive</strong>.', 'import-users-from-csv-with-meta' ); ?></div>
34
+
35
+ <div>
36
+ <h2><?php _e( 'Import users and customers from CSV','import-users-from-csv-with-meta' ); ?></h2>
37
+ </div>
38
+
39
+ <div style="clear:both;"></div>
40
+
41
+ <div id="acui_form_wrapper" class="main_bar">
42
+ <form method="POST" id="acui_form" enctype="multipart/form-data" action="" accept-charset="utf-8">
43
+ <h2 id="acui_file_header"><?php _e( 'File', 'import-users-from-csv-with-meta'); ?></h2>
44
+ <table id="acui_file_wrapper" class="form-table">
45
+ <tbody>
46
+
47
+ <?php do_action( 'acui_homepage_before_file_rows' ); ?>
48
+
49
+ <tr class="form-field form-required">
50
+ <th scope="row"><label for="uploadfile"><?php _e( 'CSV file <span class="description">(required)</span></label>', 'import-users-from-csv-with-meta' ); ?></th>
51
+ <td>
52
+ <div id="upload_file">
53
+ <input type="file" name="uploadfile" id="uploadfile" size="35" class="uploadfile" />
54
+ <?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>
55
+ </div>
56
+ <div id="introduce_path" style="display:none;">
57
+ <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%;" />
58
+ <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>
59
+ </div>
60
+ </td>
61
+ </tr>
62
+
63
+ <?php do_action( 'acui_homepage_after_file_rows' ); ?>
64
+
65
+ </tbody>
66
+ </table>
67
+
68
+ <h2 id="acui_roles_header"><?php _e( 'Roles', 'import-users-from-csv-with-meta'); ?></h2>
69
+ <table id="acui_roles_wrapper" class="form-table">
70
+ <tbody>
71
+
72
+ <?php do_action( 'acui_homepage_before_roles_rows' ); ?>
73
+
74
+ <tr class="form-field">
75
+ <th scope="row"><label for="role"><?php _e( 'Default role', 'import-users-from-csv-with-meta' ); ?></label></th>
76
+ <td>
77
+ <?php
78
+ foreach ( ACUI_Helper::get_editable_roles() as $key => $value )
79
+ ACUIHTML()->checkbox( array( 'label' => $value, 'name' => 'role[]', 'compare_value' => $last_roles_used, 'current' => $key, 'array' => true, 'class' => 'roles' ) );
80
+ ?>
81
+ <p class="description"><?php _e( 'You can also import roles from a CSV column. Please read documentation tab to see how it can be done. If you choose more than one role, the roles would be assigned correctly but you should use some plugin like <a href="https://wordpress.org/plugins/user-role-editor/">User Role Editor</a> to manage them.', 'import-users-from-csv-with-meta' ); ?></p>
82
+ </td>
83
+ </tr>
84
+
85
+ <?php do_action( 'acui_homepage_after_roles_rows' ); ?>
86
+
87
+ </tbody>
88
+ </table>
89
+
90
+ <h2 id="acui_options_header"><?php _e( 'Options', 'import-users-from-csv-with-meta'); ?></h2>
91
+ <table id="acui_options_wrapper" class="form-table">
92
+ <tbody>
93
+
94
+ <?php do_action( 'acui_homepage_before_options_rows' ); ?>
95
+
96
+ <tr id="acui_empty_cell_wrapper" class="form-field form-required">
97
+ <th scope="row"><label for="empty_cell_action"><?php _e( 'What should the plugin do with empty cells?', 'import-users-from-csv-with-meta' ); ?></label></th>
98
+ <td>
99
+ <?php ACUIHTML()->select( array(
100
+ 'options' => array( 'leave' => __( 'Leave the old value for this metadata', 'import-users-from-csv-with-meta' ), 'delete' => __( 'Delete the metadata', 'import-users-from-csv-with-meta' ) ),
101
+ 'name' => 'empty_cell_action',
102
+ 'show_option_all' => false,
103
+ 'show_option_none' => false,
104
+ )); ?>
105
+ </td>
106
+ </tr>
107
+
108
+ <tr id="acui_send_email_wrapper" class="form-field">
109
+ <th scope="row"><label for="user_login"><?php _e( 'Send mail', 'import-users-from-csv-with-meta' ); ?></label></th>
110
+ <td>
111
+ <p id="sends_email_wrapper">
112
+ <?php ACUIHTML()->checkbox( array( 'name' => 'sends_email', 'label' => __( 'Do you wish to send a mail from this plugin with credentials and other data? <a href="' . admin_url( 'tools.php?page=acui&tab=mail-options' ) . '">(email template found here)</a>', 'import-users-from-csv-with-meta' ), 'current' => 'yes', 'compare_value' => get_option( 'acui_manually_send_mail' ) ) ); ?>
113
+ </p>
114
+ <p id="send_email_updated_wrapper">
115
+ <?php ACUIHTML()->checkbox( array( 'name' => 'send_email_updated', 'label' => __( 'Do you wish to send this mail also to users that are being updated? (not only to the one which are being created)', 'import-users-from-csv-with-meta' ), 'current' => 'yes', 'compare_value' => get_option( 'acui_manually_send_mail_updated' ) ) ); ?>
116
+ </p>
117
+ </td>
118
+ </tr>
119
+
120
+ <tr class="form-field form-required">
121
+ <th scope="row"><label for=""><?php _e( 'Force users to reset their passwords?', 'import-users-from-csv-with-meta' ); ?></label></th>
122
+ <td>
123
+ <?php ACUIHTML()->checkbox( array( 'name' => 'force_user_reset_password', 'label' => __( 'If a password is set to an user and you activate this option, the user will be forced to reset their password in their first login', 'import-users-from-csv-with-meta' ), 'current' => 'yes', 'compare_value' => get_option( 'acui_manually_force_user_reset_password' ) ) ); ?>
124
+ </td>
125
+ </tr>
126
+
127
+ <?php do_action( 'acui_homepage_after_options_rows' ); ?>
128
+
129
+ </tbody>
130
+ </table>
131
+
132
+ <h2 id="acui_update_users_header"><?php _e( 'Update users', 'import-users-from-csv-with-meta'); ?></h2>
133
+
134
+ <table id="acui_update_users_wrapper" class="form-table">
135
+ <tbody>
136
+
137
+ <?php do_action( 'acui_homepage_before_update_users_rows' ); ?>
138
+
139
+ <tr id="acui_update_existing_users_wrapper" class="form-field form-required">
140
+ <th scope="row"><label for="update_existing_users"><?php _e( 'Update existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
141
+ <td>
142
+ <?php ACUIHTML()->select( array(
143
+ 'options' => array( 'yes' => __( 'Yes', 'import-users-from-csv-with-meta' ), 'no' => __( 'No', 'import-users-from-csv-with-meta' ) ),
144
+ 'name' => 'update_existing_users',
145
+ 'show_option_all' => false,
146
+ 'show_option_none' => false,
147
+ )); ?>
148
+ </td>
149
+ </tr>
150
+
151
+ <tr id="acui_update_emails_existing_users_wrapper" class="form-field form-required">
152
+ <th scope="row"><label for="update_emails_existing_users"><?php _e( 'Update emails?', 'import-users-from-csv-with-meta' ); ?></label></th>
153
+ <td>
154
+ <?php ACUIHTML()->select( array(
155
+ 'options' => array( 'yes' => __( 'Yes', 'import-users-from-csv-with-meta' ), 'create' => __( 'No, but create a new user with a prefix in the username', 'import-users-from-csv-with-meta' ), 'no' => __( 'No', 'import-users-from-csv-with-meta' ) ),
156
+ 'name' => 'update_emails_existing_users',
157
+ 'show_option_all' => false,
158
+ 'show_option_none' => false,
159
+ )); ?>
160
+ <p class="description"><?php _e( 'What the plugin should do if the plugin find an user, identified by their username, with a different email', 'import-users-from-csv-with-meta' ); ?></p>
161
+ </td>
162
+ </tr>
163
+
164
+ <tr id="acui_update_roles_existing_users_wrapper" class="form-field form-required">
165
+ <th scope="row"><label for="update_roles_existing_users"><?php _e( 'Update roles for existing users?', 'import-users-from-csv-with-meta' ); ?></label></th>
166
+ <td>
167
+ <?php ACUIHTML()->select( array(
168
+ 'options' => array( 'no' => __( 'No', 'import-users-from-csv-with-meta' ), 'yes' => __( 'Yes, update and override existing roles', 'import-users-from-csv-with-meta' ), 'yes_no_override' => __( 'Yes, add new roles and not override existing ones', 'import-users-from-csv-with-meta' ) ),
169
+ 'name' => 'update_roles_existing_users',
170
+ 'show_option_all' => false,
171
+ 'show_option_none' => false,
172
+ )); ?>
173
+ </td>
174
+ </tr>
175
+
176
+ <tr id="acui_update_allow_update_passwords_wrapper" class="form-field form-required">
177
+ <th scope="row"><label for="update_allow_update_passwords"><?php _e( 'Never update passwords?', 'import-users-from-csv-with-meta' ); ?></label></th>
178
+ <td>
179
+ <?php ACUIHTML()->select( array(
180
+ 'options' => array( 'yes' => __( 'Update passwords as it is described in documentation', 'import-users-from-csv-with-meta' ), 'no' => __( 'Never update passwords when updating a user', 'import-users-from-csv-with-meta' ), 'yes_no_override' => __( 'Yes, add new roles and not override existing ones', 'import-users-from-csv-with-meta' ) ),
181
+ 'name' => 'update_allow_update_passwords',
182
+ 'show_option_all' => false,
183
+ 'show_option_none' => false,
184
+ )); ?>
185
+ </td>
186
+ </tr>
187
+
188
+ <?php do_action( 'acui_homepage_after_update_users_rows' ); ?>
189
+
190
+ </tbody>
191
+ </table>
192
+
193
+ <h2 id="acui_users_not_present_header"><?php _e( 'Users not present in CSV file', 'import-users-from-csv-with-meta'); ?></h2>
194
+
195
+ <table id="acui_users_not_present_wrapper" class="form-table">
196
+ <tbody>
197
+
198
+ <?php do_action( 'acui_homepage_before_users_not_present_rows' ); ?>
199
+
200
+ <tr id="acui_delete_users_wrapper" class="form-field form-required">
201
+ <th scope="row"><label for="delete_users"><?php _e( 'Delete users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
202
+ <td>
203
+ <div style="float:left; margin-top: 10px;">
204
+ <?php ACUIHTML()->checkbox( array( 'name' => 'delete_users', 'current' => 'yes' ) ); ?>
205
+ </div>
206
+ <div style="margin-left:25px;">
207
+ <?php ACUIHTML()->select( array(
208
+ 'options' => array( 'no' => __( 'Never update passwords when updating a user', 'import-users-from-csv-with-meta' ), 'yes_no_override' => __( 'Yes, add new roles and not override existing ones', 'import-users-from-csv-with-meta' ) ),
209
+ 'name' => 'delete_users_assign_posts',
210
+ 'show_option_all' => false,
211
+ 'show_option_none' => __( 'Delete posts of deleted users without assigning to any user or type to search a user', 'import-users-from-csv-with-meta' ),
212
+ )); ?>
213
+ <p class="description"><?php _e( 'Administrators will not be deleted anyway. After delete users, we can choose if we want to assign their posts to another user. If you do not choose some user, content will be deleted.', 'import-users-from-csv-with-meta' ); ?></p>
214
+ </div>
215
+ </td>
216
+ </tr>
217
+
218
+ <tr id="acui_not_present_wrapper" class="form-field form-required">
219
+ <th scope="row"><label for="change_role_not_present"><?php _e( 'Change role of users that are not present in the CSV?', 'import-users-from-csv-with-meta' ); ?></label></th>
220
+ <td>
221
+ <div style="float:left; margin-top: 10px;">
222
+ <?php ACUIHTML()->checkbox( array( 'name' => 'change_role_not_present', 'current' => 'yes' ) ); ?>
223
+ </div>
224
+ <div style="margin-left:25px;">
225
+ <?php ACUIHTML()->select( array(
226
+ 'options' => ACUI_Helper::get_editable_roles(),
227
+ 'name' => 'change_role_not_present_role',
228
+ 'show_option_all' => false,
229
+ 'show_option_none' => false,
230
+ )); ?>
231
+ <p class="description"><?php _e( 'After import users which is not present in the CSV and can be changed to a different role.', 'import-users-from-csv-with-meta' ); ?></p>
232
+ </div>
233
+ </td>
234
+ </tr>
235
+
236
+ <?php do_action( 'acui_homepage_after_users_not_present_rows' ); ?>
237
+
238
+ </tbody>
239
+ </table>
240
+
241
+ <?php do_action( 'acui_tab_import_before_import_button' ); ?>
242
+
243
+ <?php wp_nonce_field( 'codection-security', 'security' ); ?>
244
+
245
+ <input class="button-primary" type="submit" name="uploadfile" id="uploadfile_btn" value="<?php _e( 'Start importing', 'import-users-from-csv-with-meta' ); ?>"/>
246
+ </form>
247
+ </div>
248
+
249
+ <div class="sidebar">
250
+ <div class="sidebar_section become_patreon">
251
+ <a class="patreon" color="primary" type="button" name="become-a-patron" data-tag="become-patron-button" href="https://www.patreon.com/carazo" role="button" target="_blank">
252
+ <div><span><?php _e( 'Become a patron', 'import-users-from-csv-with-meta'); ?></span></div>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="sidebar_section buy_me_a_coffee">
257
+ <a class="ko-fi" color="primary" type="button" name="buy-me-a-coffee" data-tag="buy-me-a-button" href="https://ko-fi.com/codection" role="button" target="_blank">
258
+ <div><span><?php _e( 'Buy me a coffee', 'import-users-from-csv-with-meta'); ?></span></div>
259
+ </a>
260
+ </div>
261
+
262
+ <div class="sidebar_section vote_us">
263
+ <a class="vote-us" color="primary" type="button" name="vote-us" data-tag="vote_us" href="https://wordpress.org/support/plugin/import-users-from-csv-with-meta/reviews/" role="button" target="_blank">
264
+ <div><span><?php _e( 'If you like it', 'import-users-from-csv-with-meta'); ?> <?php _e( 'Please vote and support us', 'import-users-from-csv-with-meta'); ?></span></div>
265
+ </a>
266
+ </div>
267
+
268
+ <div class="sidebar_section donate">
269
+ <a class="donate-button" color="primary" type="button" name="donate-button" data-tag="donate" href="https://paypal.me/imalrod" role="button" target="_blank">
270
+ <div><span><?php _e( 'If you want to help us to continue developing it and give the best support you can donate', 'import-users-from-csv-with-meta'); ?></span></div>
271
+ </a>
272
+ </div>
273
+
274
+ <div class="sidebar_section">
275
+ <h3><?php _e( 'Having issues?', 'import-users-from-csv-with-meta'); ?></h3>
276
+ <ul>
277
+ <li><label><?php _e( 'You can create a ticket', 'import-users-from-csv-with-meta'); ?></label> <a target="_blank" href="http://wordpress.org/support/plugin/import-users-from-csv-with-meta"><label><?php _e( 'WordPress support forum', 'import-users-from-csv-with-meta'); ?></label></a></li>
278
+ <li><label><?php _e( 'You can ask for premium support', 'import-users-from-csv-with-meta'); ?></label> <a target="_blank" href="mailto:contacto@codection.com"><label>contacto@codection.com</label></a></li>
279
+ </ul>
280
+ </div>
281
+ </div>
282
+
283
+ </div>
284
+ <script type="text/javascript">
285
+ jQuery( document ).ready( function( $ ){
286
+ check_delete_users_checked();
287
+
288
+ $( '#acui_form' ).submit( function(){
289
+ if( $( '#uploadfile' ).val() == "" && $( '#upload_file' ).is( ':visible' ) ) {
290
+ alert("<?php _e( 'Please choose a file', 'import-users-from-csv-with-meta' ); ?>");
291
+ return false;
292
+ }
293
+
294
+ if( $( '#path_to_file' ).val() == "" && $( '#introduce_path' ).is( ':visible' ) ) {
295
+ alert("<?php _e( 'Please enter a path to the file', 'import-users-from-csv-with-meta' ); ?>");
296
+ return false;
297
+ }
298
+ } );
299
+
300
+ $( '#delete_users' ).on( 'click', function() {
301
+ check_delete_users_checked();
302
+ });
303
+
304
+ $( '.delete_attachment' ).click( function(){
305
+ var answer = confirm( "<?php _e( 'Are you sure to delete this file?', 'import-users-from-csv-with-meta' ); ?>" );
306
+ if( answer ){
307
+ var data = {
308
+ 'action': 'acui_delete_attachment',
309
+ 'attach_id': $( this ).attr( "attach_id" ),
310
+ 'security': '<?php echo wp_create_nonce( "codection-security" ); ?>'
311
+ };
312
+
313
+ $.post(ajaxurl, data, function(response) {
314
+ if( response != 1 )
315
+ alert( response );
316
+ else{
317
+ alert( "<?php _e( 'File successfully deleted', 'import-users-from-csv-with-meta' ); ?>" );
318
+ document.location.reload();
319
+ }
320
+ });
321
+ }
322
+ });
323
+
324
+ $( '#bulk_delete_attachment' ).click( function(){
325
+ var answer = confirm( "<?php _e( 'Are you sure to delete ALL CSV files uploaded? There can be CSV files from other plugins.', 'import-users-from-csv-with-meta' ); ?>" );
326
+ if( answer ){
327
+ var data = {
328
+ 'action': 'acui_bulk_delete_attachment',
329
+ 'security': '<?php echo wp_create_nonce( "codection-security" ); ?>'
330
+ };
331
+
332
+ $.post(ajaxurl, data, function(response) {
333
+ if( response != 1 )
334
+ alert( "<?php _e( 'There were problems deleting the files, please check files permissions', 'import-users-from-csv-with-meta' ); ?>" );
335
+ else{
336
+ alert( "<?php _e( 'Files successfully deleted', 'import-users-from-csv-with-meta' ); ?>" );
337
+ document.location.reload();
338
+ }
339
+ });
340
+ }
341
+ });
342
+
343
+ $( '.toggle_upload_path' ).click( function( e ){
344
+ e.preventDefault();
345
+ $( '#upload_file,#introduce_path' ).toggle();
346
+ } );
347
+
348
+ $( '#vote_us' ).click( function(){
349
+ var win=window.open( 'http://wordpress.org/support/view/plugin-reviews/import-users-from-csv-with-meta?free-counter?rate=5#postform', '_blank');
350
+ win.focus();
351
+ } );
352
+
353
+ $( '#change_role_not_present_role' ).select2();
354
+
355
+ $( '#delete_users_assign_posts' ).select2({
356
+ ajax: {
357
+ url: '<?php echo admin_url( 'admin-ajax.php' ) ?>',
358
+ cache: true,
359
+ dataType: 'json',
360
+ minimumInputLength: 3,
361
+ allowClear: true,
362
+ placeholder: { id: '', title: '<?php _e( 'Delete posts of deleted users without assigning to any user', 'import-users-from-csv-with-meta' ) ?>' },
363
+ data: function( params ) {
364
+ if (params.term.trim().length < 3)
365
+ throw false;
366
+
367
+ var query = {
368
+ search: params.term,
369
+ _wpnonce: '<?php echo wp_create_nonce( 'codection-security' ); ?>',
370
+ action: 'acui_delete_users_assign_posts_data',
371
+ }
372
+
373
+ return query;
374
+ }
375
+ }
376
+ });
377
+
378
+ function check_delete_users_checked(){
379
+ if( $( '#delete_users' ).is( ':checked' ) ){
380
+ $( '#delete_users_assign_posts' ).prop( 'disabled', false );
381
+ $( '#change_role_not_present' ).prop( 'disabled', true );
382
+ $( '#change_role_not_present_role' ).prop( 'disabled', true );
383
+ } else {
384
+ $( '#delete_users_assign_posts' ).prop( 'disabled', true );
385
+ $( '#change_role_not_present' ).prop( 'disabled', false );
386
+ $( '#change_role_not_present_role' ).prop( 'disabled', false );
387
+ }
388
+ }
389
+ } );
390
+ </script>
391
+ <?php
392
+ }
393
+
394
+ function maybe_remove_old_csv(){
395
+ $args_old_csv = array( 'post_type'=> 'attachment', 'post_mime_type' => 'text/csv', 'post_status' => 'inherit', 'posts_per_page' => -1 );
396
+ $old_csv_files = new WP_Query( $args_old_csv );
397
+
398
+ if( $old_csv_files->found_posts > 0 ): ?>
399
+ <div class="postbox">
400
+ <div title="<?php _e( 'Click to open/close', 'import-users-from-csv-with-meta' ); ?>" class="handlediv">
401
+ <br>
402
+ </div>
403
+
404
+ <h3 class="hndle"><span>&nbsp;&nbsp;&nbsp;<?php _e( 'Old CSV files uploaded', 'import-users-from-csv-with-meta' ); ?></span></h3>
405
+
406
+ <div class="inside" style="display: block;">
407
+ <p><?php _e( 'For security reasons you should delete this files, probably they would be visible in the Internet if a bot or someone discover the URL. You can delete each file or maybe you want delete all CSV files you have uploaded:', 'import-users-from-csv-with-meta' ); ?></p>
408
+ <input type="button" value="<?php _e( 'Delete all CSV files uploaded', 'import-users-from-csv-with-meta' ); ?>" id="bulk_delete_attachment" style="float:right;" />
409
+ <ul>
410
+ <?php while($old_csv_files->have_posts()) :
411
+ $old_csv_files->the_post();
412
+
413
+ if( get_the_date() == "" )
414
+ $date = "undefined";
415
+ else
416
+ $date = get_the_date();
417
+ ?>
418
+ <li><a href="<?php echo wp_get_attachment_url( get_the_ID() ); ?>"><?php the_title(); ?></a> <?php _e( 'uploaded on', 'import-users-from-csv-with-meta' ) . ' ' . $date; ?> <input type="button" value="<?php _e( 'Delete', 'import-users-from-csv-with-meta' ); ?>" class="delete_attachment" attach_id="<?php the_ID(); ?>" /></li>
419
+ <?php endwhile; ?>
420
+ <?php wp_reset_postdata(); ?>
421
+ </ul>
422
+ <div style="clear:both;"></div>
423
+ </div>
424
+ </div>
425
+ <?php endif;
426
+ }
427
+
428
+ function delete_attachment() {
429
+ check_ajax_referer( 'codection-security', 'security' );
430
+
431
+ if( ! current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
432
+ wp_die( __( 'Only users who are able to create users can delete CSV attachments.', 'import-users-from-csv-with-meta' ) );
433
+
434
+ $attach_id = absint( $_POST['attach_id'] );
435
+ $mime_type = (string) get_post_mime_type( $attach_id );
436
+
437
+ if( $mime_type != 'text/csv' )
438
+ _e('This plugin only can delete the type of file it manages, CSV files.', 'import-users-from-csv-with-meta' );
439
+
440
+ $result = wp_delete_attachment( $attach_id, true );
441
+
442
+ if( $result === false )
443
+ _e( 'There were problems deleting the file, please check file permissions', 'import-users-from-csv-with-meta' );
444
+ else
445
+ echo 1;
446
+
447
+ wp_die();
448
+ }
449
+
450
+ function bulk_delete_attachment(){
451
+ check_ajax_referer( 'codection-security', 'security' );
452
+
453
+ if( ! current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
454
+ wp_die( __( 'Only users who are able to create users can bulk delete CSV attachments.', 'import-users-from-csv-with-meta' ) );
455
+
456
+ $args_old_csv = array( 'post_type'=> 'attachment', 'post_mime_type' => 'text/csv', 'post_status' => 'inherit', 'posts_per_page' => -1 );
457
+ $old_csv_files = new WP_Query( $args_old_csv );
458
+ $result = 1;
459
+
460
+ while($old_csv_files->have_posts()) :
461
+ $old_csv_files->the_post();
462
+
463
+ $mime_type = (string) get_post_mime_type( get_the_ID() );
464
+ if( $mime_type != 'text/csv' )
465
+ wp_die( __('This plugin only can delete the type of file it manages, CSV files.', 'import-users-from-csv-with-meta' ) );
466
+
467
+ if( wp_delete_attachment( get_the_ID(), true ) === false )
468
+ $result = 0;
469
+ endwhile;
470
+
471
+ wp_reset_postdata();
472
+
473
+ echo $result;
474
+
475
+ wp_die();
476
+ }
477
+
478
+ function delete_users_assign_posts_data(){
479
+ check_ajax_referer( 'codection-security', 'security' );
480
+
481
+ if( ! current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) )
482
+ wp_die( __( 'Only users who are able to create users can manage this option.', 'import-users-from-csv-with-meta' ) );
483
+
484
+ $results = array( array( 'id' => '', 'value' => __( 'Delete posts of deleted users without assigning to any user', 'import-users-from-csv-with-meta' ) ) );
485
+ $search = sanitize_text_field( $_GET['search'] );
486
+
487
+ if( strlen( $search ) >= 3 ){
488
+ $blogusers = get_users( array( 'fields' => array( 'ID', 'display_name' ), 'search' => '*' . $search . '*' ) );
489
+
490
+ foreach ( $blogusers as $bloguser ) {
491
+ $results[] = array( 'id' => $bloguser->ID, 'text' => $bloguser->display_name );
492
+ }
493
+ }
494
+
495
+ echo json_encode( array( 'results' => $results, 'more' => 'false' ) );
496
+
497
+ wp_die();
498
+ }
499
+ }
500
+
501
+ $acui_homepage = new ACUI_Homepage();
502
+ $acui_homepage->hooks();
trunk/classes/html.php ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_HTML{
5
+ private static $instance;
6
+ var $settings;
7
+
8
+ function __construct(){
9
+ $settings = array(
10
+ 'common' => array(
11
+ 'default_role',
12
+
13
+ )
14
+ );
15
+ }
16
+
17
+ private static function is_instantiated() {
18
+ if ( ! empty( self::$instance ) && ( self::$instance instanceof ACUI_HTML ) ) {
19
+ return true;
20
+ }
21
+
22
+ return false;
23
+ }
24
+
25
+ private static function setup_instance() {
26
+ self::$instance = new ACUI_HTML;
27
+ }
28
+
29
+ static function instance() {
30
+ if ( self::is_instantiated() ) {
31
+ return self::$instance;
32
+ }
33
+
34
+ self::setup_instance();
35
+
36
+ return self::$instance;
37
+ }
38
+
39
+
40
+ function sanitize_key( $key ) {
41
+ $raw_key = $key;
42
+ return preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
43
+ }
44
+
45
+ function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
46
+ $current = date( 'Y' );
47
+ $start_year = $current - absint( $years_before );
48
+ $end_year = $current + absint( $years_after );
49
+ $selected = empty( $selected ) ? date( 'Y' ) : $selected;
50
+ $options = array();
51
+
52
+ while ( $start_year <= $end_year ) {
53
+ $options[ absint( $start_year ) ] = $start_year;
54
+ $start_year++;
55
+ }
56
+
57
+ $output = $this->select( array(
58
+ 'name' => $name,
59
+ 'selected' => $selected,
60
+ 'options' => $options,
61
+ 'show_option_all' => false,
62
+ 'show_option_none' => false
63
+ ) );
64
+
65
+ return $output;
66
+ }
67
+
68
+ function month_dropdown( $name = 'month', $selected = 0 ) {
69
+ $month = 1;
70
+ $options = array();
71
+ $selected = empty( $selected ) ? date( 'n' ) : $selected;
72
+
73
+ while ( $month <= 12 ) {
74
+ $options[ absint( $month ) ] = edd_month_num_to_name( $month );
75
+ $month++;
76
+ }
77
+
78
+ $output = $this->select( array(
79
+ 'name' => $name,
80
+ 'selected' => $selected,
81
+ 'options' => $options,
82
+ 'show_option_all' => false,
83
+ 'show_option_none' => false
84
+ ) );
85
+
86
+ return $output;
87
+ }
88
+
89
+ function select( $args = array() ) {
90
+ $defaults = array(
91
+ 'echo' => true,
92
+ 'options' => array(),
93
+ 'name' => null,
94
+ 'class' => '',
95
+ 'id' => '',
96
+ 'selected' => array(),
97
+ 'chosen' => false,
98
+ 'placeholder' => null,
99
+ 'multiple' => false,
100
+ 'show_option_all' => _x( 'All', 'all dropdown items', 'import-users-from-csv-with-meta' ),
101
+ 'show_option_none' => _x( 'None', 'no dropdown items', 'import-users-from-csv-with-meta' ),
102
+ 'data' => array(),
103
+ 'readonly' => false,
104
+ 'disabled' => false,
105
+ );
106
+
107
+ $args = wp_parse_args( $args, $defaults );
108
+
109
+ if( empty( $args['id'] ) )
110
+ $args['id'] = $args['name'];
111
+
112
+ $data_elements = '';
113
+ foreach ( $args['data'] as $key => $value ) {
114
+ $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
115
+ }
116
+
117
+ if( $args['multiple'] ) {
118
+ $multiple = ' MULTIPLE';
119
+ } else {
120
+ $multiple = '';
121
+ }
122
+
123
+ if( $args['placeholder'] ) {
124
+ $placeholder = $args['placeholder'];
125
+ } else {
126
+ $placeholder = '';
127
+ }
128
+
129
+ if ( isset( $args['readonly'] ) && $args['readonly'] ) {
130
+ $readonly = ' readonly="readonly"';
131
+ } else {
132
+ $readonly = '';
133
+ }
134
+
135
+ if ( isset( $args['disabled'] ) && $args['disabled'] ) {
136
+ $disabled = ' disabled="disabled"';
137
+ } else {
138
+ $disabled = '';
139
+ }
140
+
141
+ $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
142
+ $output = '<select' . $disabled . $readonly . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $this->sanitize_key( $args['id'] ) ) . '" class="acui-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>';
143
+
144
+ if ( ! isset( $args['selected'] ) || ( is_array( $args['selected'] ) && empty( $args['selected'] ) ) || ! $args['selected'] ) {
145
+ $selected = "";
146
+ }
147
+
148
+ if ( $args['show_option_all'] ) {
149
+ if ( $args['multiple'] && ! empty( $args['selected'] ) ) {
150
+ $selected = selected( true, in_array( 0, (array) $args['selected'] ), false );
151
+ } else {
152
+ $selected = selected( $args['selected'], 0, false );
153
+ }
154
+ $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
155
+ }
156
+
157
+ if ( ! empty( $args['options'] ) ) {
158
+ if ( $args['show_option_none'] ) {
159
+ if ( $args['multiple'] ) {
160
+ $selected = selected( true, in_array( "", $args['selected'] ), false );
161
+ } elseif ( isset( $args['selected'] ) && ! is_array( $args['selected'] ) && ! empty( $args['selected'] ) ) {
162
+ $selected = selected( $args['selected'], "", false );
163
+ }
164
+ $output .= '<option value=""' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
165
+ }
166
+
167
+ foreach ( $args['options'] as $key => $option ) {
168
+ if ( $args['multiple'] && is_array( $args['selected'] ) ) {
169
+ $selected = selected( true, in_array( (string) $key, $args['selected'] ), false );
170
+ } elseif ( isset( $args['selected'] ) && ! is_array( $args['selected'] ) ) {
171
+ $selected = selected( $args['selected'], $key, false );
172
+ }
173
+
174
+ $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
175
+ }
176
+ }
177
+
178
+ $output .= '</select>';
179
+
180
+ if( $args['echo'] )
181
+ echo $output;
182
+
183
+ return $output;
184
+ }
185
+
186
+ function checkbox( $args = array() ) {
187
+ $defaults = array(
188
+ 'label' => '',
189
+ 'echo' => true,
190
+ 'array' => false,
191
+ 'compare_value' => 1,
192
+ 'name' => null,
193
+ 'current' => 1,
194
+ 'class' => '',
195
+ 'options' => array(
196
+ 'disabled' => false,
197
+ 'readonly' => false
198
+ )
199
+ );
200
+
201
+ $args = wp_parse_args( $args, $defaults );
202
+ $output = '';
203
+
204
+ $class = 'acui-checkbox ' . implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
205
+ $options = '';
206
+ if ( ! empty( $args['options']['disabled'] ) ) {
207
+ $options .= ' disabled="disabled"';
208
+ } elseif ( ! empty( $args['options']['readonly'] ) ) {
209
+ $options .= ' readonly';
210
+ }
211
+
212
+ if( !empty( $args['label'] ) ){
213
+ $output .= '<label class="' . $class . '"';
214
+
215
+ if( !$args['array'] )
216
+ $output .= ' for="' . esc_attr( $args['name'] ) . '"';
217
+
218
+ $output .= '>' . $args['label'];
219
+ }
220
+
221
+ if( $args['array'] )
222
+ $output .= '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" class="' . $class . '" value="' . $args['current'] .'" ' . checked( in_array( $args['current'], $args['compare_value'] ), 1, false ) . ' />';
223
+ else
224
+ $output .= '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $class . '" value="' . $args['current'] . '" ' . checked( $args['compare_value'], $args['current'], false ) . ' />';
225
+
226
+ if( !empty( $args['label'] ) )
227
+ $output .= '</label>';
228
+
229
+ if( $args['echo'] )
230
+ echo $output;
231
+
232
+ return $output;
233
+ }
234
+
235
+ function text( $args = array() ) {
236
+ $defaults = array(
237
+ 'echo' => true,
238
+ 'id' => '',
239
+ 'name' => isset( $name ) ? $name : 'text',
240
+ 'value' => isset( $value ) ? $value : null,
241
+ 'label' => isset( $label ) ? $label : null,
242
+ 'desc' => isset( $desc ) ? $desc : null,
243
+ 'placeholder' => '',
244
+ 'class' => 'regular-text',
245
+ 'disabled' => false,
246
+ 'autocomplete' => '',
247
+ 'data' => false,
248
+ 'type' => 'text',
249
+ 'readonly' => false,
250
+ 'required' => false,
251
+ );
252
+
253
+ $args = wp_parse_args( $args, $defaults );
254
+
255
+ if( empty( $args['id'] ) )
256
+ $args['id'] = $args['name'];
257
+
258
+ if ( isset( $args['readonly'] ) && $args['readonly'] ) {
259
+ $readonly = ' readonly="readonly"';
260
+ } else {
261
+ $readonly = '';
262
+ }
263
+
264
+ if ( isset( $args['required'] ) && $args['required'] ) {
265
+ $required = ' required="required"';
266
+ } else {
267
+ $required = '';
268
+ }
269
+
270
+ $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
271
+ $disabled = '';
272
+ if( $args['disabled'] ) {
273
+ $disabled = ' disabled="disabled"';
274
+ }
275
+
276
+ $data = '';
277
+ if ( ! empty( $args['data'] ) ) {
278
+ foreach ( $args['data'] as $key => $value ) {
279
+ $data .= 'data-' . $this->sanitize_key( $key ) . '="' . esc_attr( $value ) . '" ';
280
+ }
281
+ }
282
+
283
+ $output = '<span id="acui-' . $this->sanitize_key( $args['name'] ) . '-wrap">';
284
+ if ( ! empty( $args['label'] ) ) {
285
+ $output .= '<label class="acui-label" for="' . $this->sanitize_key( $args['id'] ) . '">' . esc_html( $args['label'] ) . '</label>';
286
+ }
287
+
288
+ if ( ! empty( $args['desc'] ) ) {
289
+ $output .= '<span class="acui-description">' . esc_html( $args['desc'] ) . '</span>';
290
+ }
291
+
292
+ $output .= '<input type="' . esc_attr( $args['type'] ) . '" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . '' . $disabled . '' . $readonly . '' . $required . '/>';
293
+
294
+ $output .= '</span>';
295
+
296
+ if( $args['echo'] )
297
+ echo $output;
298
+
299
+ return $output;
300
+ }
301
+
302
+ function textarea( $args = array() ) {
303
+ $defaults = array(
304
+ 'echo' => true,
305
+ 'name' => 'textarea',
306
+ 'value' => null,
307
+ 'label' => null,
308
+ 'desc' => null,
309
+ 'class' => 'large-text',
310
+ 'disabled' => false
311
+ );
312
+
313
+ $args = wp_parse_args( $args, $defaults );
314
+
315
+ $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
316
+ $disabled = '';
317
+ if( $args['disabled'] ) {
318
+ $disabled = ' disabled="disabled"';
319
+ }
320
+
321
+ $output = '<span id="acui-' . $this->sanitize_key( $args['name'] ) . '-wrap">';
322
+
323
+ if ( ! empty( $args['label'] ) ) {
324
+ $output .= '<label class="acui-label" for="' . $this->sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
325
+ }
326
+
327
+ $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . $this->sanitize_key( $args['name'] ) . '" class="' . $class . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
328
+
329
+ if ( ! empty( $args['desc'] ) ) {
330
+ $output .= '<span class="acui-description">' . esc_html( $args['desc'] ) . '</span>';
331
+ }
332
+
333
+ $output .= '</span>';
334
+
335
+ if( $args['echo'] )
336
+ echo $output;
337
+
338
+ return $output;
339
+ }
340
+ }
341
+
342
+ function ACUIHTML(){
343
+ return ACUI_HTML::instance();
344
+ }
trunk/classes/import-filters.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Import_Filters{
5
+ function __construct(){
6
+ }
7
+
8
+ function hooks(){
9
+ add_filter( 'pre_acui_import_single_user_username', array( $this, 'pre_import_single_user_username' ) );
10
+ }
11
+
12
+ function pre_import_single_user_username( $username ){
13
+ $acui_helper = new ACUI_Helper();
14
+ return empty( $username ) ? $acui_helper->get_random_unique_username( 'user_' ) : $username;
15
+ }
16
+ }
17
+
18
+ $acui_import_filters = new ACUI_Import_Filters();
19
+ $acui_import_filters->hooks();
trunk/classes/import.php ADDED
@@ -0,0 +1,827 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ACUI_Import{
4
+ function __construct(){
5
+ }
6
+
7
+ function show(){
8
+ if ( !current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) ) {
9
+ wp_die( __( 'You are not allowed to see this content.', 'import-users-from-csv-with-meta' ));
10
+ }
11
+
12
+ $tab = ( isset ( $_GET['tab'] ) ) ? $_GET['tab'] : 'homepage';
13
+ $sections = $this->get_sections_from_tab( $tab );
14
+ $section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : 'main';
15
+
16
+ if( isset( $_POST ) && !empty( $_POST ) ):
17
+ if ( !wp_verify_nonce( $_POST['security'], 'codection-security' ) ) {
18
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
19
+ }
20
+
21
+ switch ( $tab ){
22
+ case 'homepage':
23
+ ACUI_Options::update( 'last_roles_used', ( empty( $_POST['role'] ) ? '' : array_map( 'sanitize_text_field', $_POST['role'] ) ) );
24
+ ACUI_Options::update( 'path_to_file', sanitize_text_field( $_POST['path_to_file'] ) );
25
+ ACUI_Options::save_options( $_POST );
26
+ $this->fileupload_process( $_POST, false );
27
+ return;
28
+ break;
29
+
30
+ case 'frontend':
31
+ do_action( 'acui_frontend_save_settings', $_POST );
32
+ break;
33
+
34
+ case 'columns':
35
+ do_action( 'acui_columns_save_settings', $_POST );
36
+ break;
37
+
38
+ case 'mail-options':
39
+ do_action( 'acui_mail_options_save_settings', $_POST );
40
+ break;
41
+
42
+ case 'cron':
43
+ do_action( 'acui_cron_save_settings', $_POST );
44
+ break;
45
+ }
46
+ endif;
47
+
48
+ $this->admin_tabs( $tab );
49
+ $this->secondary_admin_tabs( $tab, $section, $sections );
50
+
51
+ switch ( $tab ){
52
+ case 'homepage' :
53
+ ACUI_Homepage::admin_gui();
54
+ break;
55
+
56
+ case 'export' :
57
+ ACUI_Exporter::admin_gui();
58
+ break;
59
+
60
+ case 'frontend':
61
+ ACUI_Frontend::admin_gui();
62
+ break;
63
+
64
+ case 'columns':
65
+ ACUI_Columns::admin_gui();
66
+ break;
67
+
68
+ case 'meta-keys':
69
+ ACUI_MetaKeys::admin_gui();
70
+ break;
71
+
72
+ case 'doc':
73
+ ACUI_Doc::message();
74
+ break;
75
+
76
+ case 'mail-options':
77
+ ACUI_Email_Options::admin_gui();
78
+ break;
79
+
80
+ case 'cron':
81
+ ACUI_Cron::admin_gui();
82
+ break;
83
+
84
+ case 'donate':
85
+ ACUI_Donate::message();
86
+ break;
87
+
88
+ case 'help':
89
+ ACUI_Help::message();
90
+ break;
91
+
92
+ case 'new_features':
93
+ ACUI_NewFeatures::message();
94
+ break;
95
+
96
+ default:
97
+ do_action( 'acui_tab_action_' . $tab, $section );
98
+ break;
99
+ }
100
+ }
101
+
102
+ function admin_tabs( $current = 'homepage' ) {
103
+ $tabs = array(
104
+ 'homepage' => __( 'Import', 'import-users-from-csv-with-meta' ),
105
+ 'export' => __( 'Export', 'import-users-from-csv-with-meta' ),
106
+ 'frontend' => __( 'Frontend', 'import-users-from-csv-with-meta' ),
107
+ 'cron' => __( 'Cron import', 'import-users-from-csv-with-meta' ),
108
+ 'columns' => __( 'Extra profile fields', 'import-users-from-csv-with-meta' ),
109
+ 'meta-keys' => __( 'Meta keys', 'import-users-from-csv-with-meta' ),
110
+ 'mail-options' => __( 'Mail options', 'import-users-from-csv-with-meta' ),
111
+ 'doc' => __( 'Documentation', 'import-users-from-csv-with-meta' ),
112
+ 'donate' => __( 'Donate/Patreon', 'import-users-from-csv-with-meta' ),
113
+ 'shop' => __( 'Shop', 'import-users-from-csv-with-meta' ),
114
+ 'help' => __( 'Hire an expert', 'import-users-from-csv-with-meta' ),
115
+ // 'new_features' => __( 'New features', 'import-users-from-csv-with-meta' )
116
+ );
117
+
118
+ $tabs = apply_filters( 'acui_tabs', $tabs );
119
+
120
+ echo '<div id="icon-themes" class="icon32"><br></div>';
121
+ echo '<h2 class="nav-tab-wrapper">';
122
+ foreach( $tabs as $tab => $name ){
123
+ $class = ( $tab == $current ) ? ' nav-tab-active' : '';
124
+
125
+ if( $tab == "shop" ){
126
+ $href = "https://codection.com/tienda/";
127
+ $target = "_blank";
128
+ }
129
+ else{
130
+ $href = "?page=acui&tab=$tab";
131
+ $target = "_self";
132
+ }
133
+
134
+ echo "<a class='nav-tab$class' href='$href' target='$target'>$name</a>";
135
+
136
+ }
137
+ echo '</h2>';
138
+ }
139
+
140
+ static function secondary_admin_tabs( $active_tab = '', $section = '', $sections = array() ){
141
+ if( empty( $sections ) )
142
+ return;
143
+
144
+ $links = array();
145
+
146
+ foreach ( $sections as $section_id => $section_name ) {
147
+ $tab_url = add_query_arg(
148
+ array(
149
+ 'page' => 'acui',
150
+ 'tab' => $active_tab,
151
+ 'section' => $section_id,
152
+ ),
153
+ admin_url( 'tools.php' )
154
+ );
155
+
156
+ $class = ( $section === $section_id ) ? 'current' : '';
157
+ $links[ $section_id ] = '<li class="' . esc_attr( $class ) . '"><a class="' . esc_attr( $class ) . '" href="' . esc_url( $tab_url ) . '">' . esc_html( $section_name ) . '</a><li>';
158
+ } ?>
159
+
160
+ <div class="wp-clearfix">
161
+ <ul class="acui-subsubsub">
162
+ <?php echo implode( '', $links ); ?>
163
+ </ul>
164
+ </div>
165
+
166
+ <?php
167
+ }
168
+
169
+ function get_sections_from_tab( $tab ){
170
+ switch ( $tab ){
171
+ case 'homepage':
172
+ case 'export':
173
+ case 'frontend':
174
+ case 'columns':
175
+ case 'meta-keys':
176
+ case 'doc':
177
+ case 'mail-options':
178
+ case 'cron':
179
+ case 'donate':
180
+ case 'help':
181
+ case 'new_features':
182
+ return array();
183
+ break;
184
+
185
+ default:
186
+ return apply_filters( 'acui_tab_section_' . $tab, array() );
187
+ break;
188
+ }
189
+ }
190
+
191
+ function fileupload_process( $form_data, $is_cron = false, $is_frontend = false ) {
192
+ if ( !defined( 'DOING_CRON' ) && ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) ){
193
+ wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
194
+ }
195
+
196
+ if( empty( $_FILES['uploadfile']['name'] ) || $is_frontend ):
197
+ $path_to_file = wp_normalize_path( $form_data["path_to_file"] );
198
+
199
+ if( validate_file( $path_to_file ) !== 0 ){
200
+ wp_die( __( 'Error, path to file is not well written', 'import-users-from-csv-with-meta' ) . ": $path_to_file" );
201
+ }
202
+
203
+ if( !file_exists ( $path_to_file ) ){
204
+ wp_die( __( 'Error, we cannot find the file', 'import-users-from-csv-with-meta' ) . ": $path_to_file" );
205
+ }
206
+
207
+ $this->import_users( $path_to_file, $form_data, 0, $is_cron, $is_frontend );
208
+ else:
209
+ $uploadfile = wp_handle_upload( $_FILES['uploadfile'], array( 'test_form' => false, 'mimes' => array('csv' => 'text/csv') ) );
210
+
211
+ if ( !$uploadfile || isset( $uploadfile['error'] ) ) {
212
+ wp_die( __( 'Problem uploading file to import. Error details: ' . var_export( $uploadfile['error'], true ), 'import-users-from-csv-with-meta' ));
213
+ } else {
214
+ $this->import_users( $uploadfile['file'], $form_data, ACUI_Helper::get_attachment_id_by_url( $uploadfile['url'] ), $is_cron, $is_frontend );
215
+ }
216
+ endif;
217
+ }
218
+
219
+ function import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){
220
+ if ( ! function_exists( 'get_editable_roles' ) ) {
221
+ require_once ABSPATH . 'wp-admin/includes/user.php';
222
+ }
223
+ ?>
224
+ <div class="wrap">
225
+ <h2><?php echo apply_filters( 'acui_log_main_title', __('Importing users','import-users-from-csv-with-meta') ); ?></h2>
226
+ <?php
227
+ @set_time_limit( 0 );
228
+
229
+ do_action( 'before_acui_import_users' );
230
+
231
+ $acui_helper = new ACUI_Helper();
232
+ $restricted_fields = $acui_helper->get_restricted_fields();
233
+ $all_roles = array_keys( wp_roles()->roles );
234
+ $editable_roles = array_keys( get_editable_roles() );
235
+
236
+ $users_registered = array();
237
+ $headers = array();
238
+ $headers_filtered = array();
239
+ $is_backend = !$is_frontend && !$is_cron;
240
+
241
+ $update_existing_users = isset( $form_data["update_existing_users"] ) ? sanitize_text_field( $form_data["update_existing_users"] ) : '';
242
+
243
+ $role_default = isset( $form_data["role"] ) ? $form_data["role"] : array( '' );
244
+ if( !is_array( $role_default ) )
245
+ $role_default = array( $role_default );
246
+ array_walk( $role_default, 'sanitize_text_field' );
247
+
248
+ $update_emails_existing_users = isset( $form_data["update_emails_existing_users"] ) ? sanitize_text_field( $form_data["update_emails_existing_users"] ) : 'yes';
249
+ $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? sanitize_text_field( $form_data["update_roles_existing_users"] ) : '';
250
+ $update_allow_update_passwords = isset( $form_data["update_allow_update_passwords"] ) ? sanitize_text_field( $form_data["update_allow_update_passwords"] ) : 'yes';
251
+ $empty_cell_action = isset( $form_data["empty_cell_action"] ) ? sanitize_text_field( $form_data["empty_cell_action"] ) : '';
252
+ $delete_users = isset( $form_data["delete_users"] ) ? sanitize_text_field( $form_data["delete_users"] ) : '';
253
+ $delete_users_assign_posts = isset( $form_data["delete_users_assign_posts"] ) ? sanitize_text_field( $form_data["delete_users_assign_posts"] ) : '';
254
+ $delete_users_only_specified_role = isset( $form_data["delete_users_only_specified_role"] ) ? sanitize_text_field( $form_data["delete_users_only_specified_role"] ) : false;
255
+
256
+ $change_role_not_present = isset( $form_data["change_role_not_present"] ) ? sanitize_text_field( $form_data["change_role_not_present"] ) : '';
257
+ $change_role_not_present_role = isset( $form_data["change_role_not_present_role"] ) ? sanitize_text_field( $form_data["change_role_not_present_role"] ) : '';
258
+
259
+ if( $is_cron ){
260
+ $allow_multiple_accounts = ( get_option( "acui_cron_allow_multiple_accounts" ) == "allowed" ) ? "allowed" : "not_allowed";
261
+ }
262
+ else {
263
+ $allow_multiple_accounts = ( empty( $form_data["allow_multiple_accounts"] ) ) ? "not_allowed" : sanitize_text_field( $form_data["allow_multiple_accounts"] );
264
+ }
265
+
266
+ // disable WordPress default emails if this must be disabled
267
+ if( !get_option('acui_automatic_wordpress_email') ){
268
+ add_filter( 'send_email_change_email', function() { return false; }, 999 );
269
+ add_filter( 'send_password_change_email', function() { return false; }, 999 );
270
+ }
271
+
272
+ // action
273
+ echo apply_filters( "acui_log_header", "<h3>" . __('Ready to registers','import-users-from-csv-with-meta') . "</h3>" );
274
+ echo apply_filters( "acui_log_header_first_row_explanation", "<p>" . __('First row represents the form of sheet','import-users-from-csv-with-meta') . "</p>" );
275
+
276
+ $row = 0;
277
+ $positions = array();
278
+ $errors = array();
279
+ $errors_totals = array( 'notices' => 0, 'warnings' => 0, 'errors' => 0 );
280
+ $results = array( 'created' => 0, 'updated' => 0, 'deleted' => 0 );
281
+ $users_created = array();
282
+ $users_updated = array();
283
+ $users_deleted = array();
284
+ $users_ignored = array();
285
+
286
+ @ini_set( 'auto_detect_line_endings', TRUE );
287
+
288
+ $delimiter = $acui_helper->detect_delimiter( $file );
289
+
290
+ $manager = new SplFileObject( $file );
291
+ while ( $data = $manager->fgetcsv( $delimiter ) ):
292
+ $row++;
293
+
294
+ if( count( $data ) == 1 )
295
+ $data = $data[0];
296
+
297
+ if( $data == NULL ){
298
+ break;
299
+ }
300
+ elseif( !is_array( $data ) ){
301
+ echo apply_filters( 'acui_message_csv_file_bad_formed', __( 'CSV file seems to be bad formed. Please use LibreOffice to create and manage CSV to be sure the format is correct', 'import-users-from-csv-with-meta') );
302
+ break;
303
+ }
304
+
305
+ foreach ( $data as $key => $value ){
306
+ $data[ $key ] = preg_replace( '/<script\b[^>]*>(.*?)<\/script>/is', '', trim( $value ) );
307
+ }
308
+
309
+ for( $i = 0; $i < count($data); $i++ ){
310
+ $data[$i] = $acui_helper->string_conversion( $data[$i] );
311
+
312
+ if( is_serialized( $data[$i] ) ) // serialized
313
+ $data[$i] = maybe_unserialize( $data[$i] );
314
+ elseif( strpos( $data[$i], "::" ) !== false ) // list of items
315
+ $data[$i] = ACUI_Helper::get_array_from_cell( $data[$i] );
316
+ }
317
+
318
+ if( $row == 1 ):
319
+ $data = apply_filters( 'pre_acui_import_header', $data );
320
+
321
+ // check min columns username - email
322
+ if( count( $data ) < 2 ){
323
+ echo "<div id='message' class='error'>" . __( 'File must contain at least 2 columns: username and email', 'import-users-from-csv-with-meta' ) . "</div>";
324
+ break;
325
+ }
326
+
327
+ $i = 0;
328
+ $password_position = false;
329
+ $id_position = false;
330
+
331
+ foreach ( $restricted_fields as $acui_restricted_field ) {
332
+ $positions[ $acui_restricted_field ] = false;
333
+ }
334
+
335
+ foreach( $data as $element ){
336
+ $headers[] = $element;
337
+
338
+ if( in_array( strtolower( $element ) , $restricted_fields ) )
339
+ $positions[ strtolower( $element ) ] = $i;
340
+
341
+ if( !in_array( strtolower( $element ), $restricted_fields ) )
342
+ $headers_filtered[] = $element;
343
+
344
+ $i++;
345
+ }
346
+
347
+ $columns = count( $data );
348
+
349
+ update_option( "acui_columns", $headers_filtered );
350
+
351
+ $acui_helper->basic_css();
352
+
353
+ $acui_helper->print_table_header_footer( $headers );
354
+ else:
355
+ $data = apply_filters( 'pre_acui_import_single_user_data', $data, $headers );
356
+
357
+ if( count( $data ) != $columns ): // if number of columns is not the same that columns in header
358
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, __( 'Row does not have the same columns than the header, we are going to ignore this row', 'import-users-from-csv-with-meta') );
359
+ continue;
360
+ endif;
361
+
362
+ do_action( 'pre_acui_import_single_user', $headers, $data );
363
+
364
+ $data = apply_filters( 'pre_acui_import_single_user_data', $data, $headers );
365
+
366
+ $username = apply_filters( 'pre_acui_import_single_user_username', $data[0] );
367
+ $data[0] = ( $username == $data[0] ) ? $username : sprintf( __( '<em>Converted to: %s</em>', 'import-users-from-csv-with-meta' ), $username );
368
+ $email = apply_filters( 'pre_acui_import_single_user_email', $data[1] );
369
+ $data[1] = ( $email == $data[1] ) ? $email : sprintf( __( '<em>Converted to: %s</em>', 'import-users-from-csv-with-meta' ), $email );
370
+
371
+ $user_id = 0;
372
+ $password_position = $positions["password"];
373
+ $password_changed = false;
374
+ $password = ( $password_position === false ) ? wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) ) : $data[ $password_position ];
375
+ $role_position = $positions["role"];
376
+ $role = "";
377
+ $id_position = $positions["id"];
378
+ $id = ( empty( $id_position ) ) ? '' : $data[ $id_position ];
379
+ $created = true;
380
+
381
+ if( $role_position === false ){
382
+ $role = $role_default;
383
+ }
384
+ else{
385
+ $roles_cells = explode( ',', $data[ $role_position ] );
386
+
387
+ if( !is_array( $roles_cells ) )
388
+ $roles_cells = array( $roles_cells );
389
+
390
+ array_walk( $roles_cells, 'trim' );
391
+
392
+ foreach( $roles_cells as $it => $role_cell )
393
+ $roles_cells[ $it ] = strtolower( $role_cell );
394
+
395
+ $role = $roles_cells;
396
+ }
397
+
398
+ if( ( !empty( $role ) || is_array( $role ) && empty( $role[0] ) ) && !empty( array_diff( $role, $all_roles ) ) ){
399
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Some of the next roles "%s" does not exists', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
400
+ continue;
401
+ }
402
+
403
+ if ( ( !empty( $role ) || is_array( $role ) && empty( $role[0] ) ) && !empty( array_diff( $role, $editable_roles ) ) ){ // users only are able to import users with a role they are allowed to edit
404
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'You do not have permission to assign some of the next roles "%s"', 'import-users-from-csv-with-meta' ), implode( ', ', $role ) ) );
405
+ $created = false;
406
+ continue;
407
+ }
408
+
409
+ if( !empty( $email ) && ( ( sanitize_email( $email ) == '' ) ) ){ // if email is invalid
410
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Invalid email "%s"', 'import-users-from-csv-with-meta' ), $email ) );
411
+ $data[0] = __('Invalid EMail','import-users-from-csv-with-meta')." ($email)";
412
+ continue;
413
+ }
414
+ elseif( empty( $email ) ) {
415
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, __( 'Email not specified', 'import-users-from-csv-with-meta' ) );
416
+ $data[0] = __( 'EMail not specified', 'import-users-from-csv-with-meta' );
417
+ continue;
418
+ }
419
+
420
+ if( !empty( $id ) ){ // if user have used id
421
+ if( $acui_helper->user_id_exists( $id ) ){
422
+ if( $update_existing_users == 'no' ){
423
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'User with ID "%s" exists, we ignore it', 'import-users-from-csv-with-meta' ), $id ), 'notice' );
424
+ array_push( $users_ignored, $id );
425
+ continue;
426
+ }
427
+
428
+ // we check if username is the same than in row
429
+ $user = get_user_by( 'ID', $id );
430
+
431
+ if( $user->user_login == $username ){
432
+ $user_id = $id;
433
+
434
+ if( $password !== "" && $update_allow_update_passwords == 'yes' ){
435
+ wp_set_password( $password, $user_id );
436
+ $password_changed = true;
437
+ }
438
+
439
+ $new_user_id = $acui_helper->maybe_update_email( $user_id, $email, $password, $update_emails_existing_users );
440
+ if( empty( $new_user_id ) ){
441
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'User with email "%s" exists, we ignore it', 'import-users-from-csv-with-meta' ), $email ), 'notice' );
442
+ array_push( $users_ignored, $new_user_id );
443
+ continue;
444
+ }
445
+
446
+ if( is_wp_error( $new_user_id ) ){
447
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, $new_user_id->get_error_message() );
448
+ $data[0] = $new_user_id->get_error_message();
449
+ $created = false;
450
+ }
451
+ elseif( $new_user_id == $user_id)
452
+ $created = false;
453
+ else{
454
+ $user_id = $new_user_id;
455
+ $new_user = get_user_by( 'id', $new_user_id );
456
+ $data[0] = sprintf( __( 'Email has changed, new user created with username %s', 'import-users-from-csv-with-meta' ), $new_user->user_login );
457
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, $data[0], 'notice' );
458
+ $created = true;
459
+ }
460
+ }
461
+ else{
462
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Problems with ID "%s" username is not the same in the CSV and in database', 'import-users-from-csv-with-meta' ), $id ) );
463
+ continue;
464
+ }
465
+ }
466
+ else{
467
+ $user_id = wp_insert_user( array(
468
+ 'ID' => $id,
469
+ 'user_login' => $username,
470
+ 'user_email' => $email,
471
+ 'user_pass' => $password
472
+ ) );
473
+
474
+ $created = true;
475
+ $password_changed = true;
476
+ }
477
+ }
478
+ elseif( username_exists( $username ) ){
479
+ $user_object = get_user_by( "login", $username );
480
+ $user_id = $user_object->ID;
481
+
482
+ if( $update_existing_users == 'no' ){
483
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'User with username "%s" exists, we ignore it', 'import-users-from-csv-with-meta' ), $username ), 'notice' );
484
+ array_push( $users_ignored, $user_id );
485
+ continue;
486
+ }
487
+
488
+ if( $password !== "" && $update_allow_update_passwords == 'yes' ){
489
+ wp_set_password( $password, $user_id );
490
+ $password_changed = true;
491
+ }
492
+
493
+ $new_user_id = $acui_helper->maybe_update_email( $user_id, $email, $password, $update_emails_existing_users );
494
+ if( empty( $new_user_id ) ){
495
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'User with email "%s" exists, we ignore it', 'import-users-from-csv-with-meta' ), $email ), 'notice' );
496
+ array_push( $users_ignored, $new_user_id );
497
+ continue;
498
+ }
499
+
500
+ if( is_wp_error( $new_user_id ) ){
501
+ $data[0] = $new_user_id->get_error_message();
502
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, $data[0] );
503
+ $created = false;
504
+ }
505
+ elseif( $new_user_id == $user_id)
506
+ $created = false;
507
+ else{
508
+ $user_id = $new_user_id;
509
+ $new_user = get_user_by( 'id', $new_user_id );
510
+ $data[0] = sprintf( __( 'Email has changed, new user created with username %s', 'import-users-from-csv-with-meta' ), $new_user->user_login );
511
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, $data[0], 'warning' );
512
+ $created = true;
513
+ }
514
+ }
515
+ elseif( email_exists( $email ) && $allow_multiple_accounts == "not_allowed" ){ // if the email is registered, we take the user from this and we don't allow repeated emails
516
+ if( $update_existing_users == 'no' ){
517
+ continue;
518
+ }
519
+
520
+ $user_object = get_user_by( "email", $email );
521
+ $user_id = $user_object->ID;
522
+
523
+ $data[0] = sprintf( __( 'User already exists as: %s (in this CSV file is called: %s)', 'import-users-from-csv-with-meta' ), $user_object->user_login, $username );
524
+ array_push( $users_ignored, $user_id );
525
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, $data[0], 'warning' );
526
+
527
+ if( $password !== "" && $update_allow_update_passwords == 'yes' ){
528
+ wp_set_password( $password, $user_id );
529
+ $password_changed = true;
530
+ }
531
+
532
+ $created = false;
533
+ }
534
+ elseif( email_exists( $email ) && $allow_multiple_accounts == "allowed" ){ // if the email is registered and repeated emails are allowed
535
+ // if user is new, but the password in csv is empty, generate a password for this user
536
+ if( $password === "" ) {
537
+ $password = wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) );
538
+ }
539
+
540
+ $hacked_email = ACUI_AllowMultipleAccounts::hack_email( $email );
541
+ $user_id = wp_create_user( $username, $password, $hacked_email );
542
+ ACUI_AllowMultipleAccounts::hack_restore_remapped_email_address( $user_id, $email );
543
+ }
544
+ else{
545
+ // if user is new, but the password in csv is empty, generate a password for this user
546
+ if( $password === "" ) {
547
+ $password = wp_generate_password( apply_filters( 'acui_auto_password_length', 12 ), apply_filters( 'acui_auto_password_special_chars', true ), apply_filters( 'acui_auto_password_extra_special_chars', false ) );
548
+ }
549
+
550
+ $user_id = wp_create_user( $username, $password, $email );
551
+ $password_changed = true;
552
+ }
553
+
554
+ if( is_wp_error( $user_id ) ){ // in case the user is generating errors after this checks
555
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, sprintf( __( 'Problems with user: "%s" does not exists, error: %s', 'import-users-from-csv-with-meta' ), $username, $user_id->get_error_message() ) );
556
+ continue;
557
+ }
558
+
559
+ $users_registered[] = $user_id;
560
+ $user_object = new WP_User( $user_id );
561
+
562
+ if( $created || $update_roles_existing_users != 'no' ){
563
+ if( !( in_array("administrator", $acui_helper->get_roles_by_user_id( $user_id ), FALSE) || is_multisite() && is_super_admin( $user_id ) )){
564
+
565
+ if( $update_roles_existing_users == 'yes' || $created ){
566
+ $default_roles = $user_object->roles;
567
+ foreach ( $default_roles as $default_role ) {
568
+ $user_object->remove_role( $default_role );
569
+ }
570
+ }
571
+
572
+ if( $update_roles_existing_users == 'yes' || $update_roles_existing_users == 'yes_no_override' || $created ){
573
+ if( !empty( $role ) ){
574
+ if( is_array( $role ) ){
575
+ foreach ($role as $single_role) {
576
+ $user_object->add_role( $single_role );
577
+ }
578
+ }
579
+ else{
580
+ $user_object->add_role( $role );
581
+ }
582
+ }
583
+
584
+ $invalid_roles = array();
585
+ if( !empty( $role ) ){
586
+ if( !is_array( $role ) ){
587
+ $role_tmp = $role;
588
+ $role = array();
589
+ $role[] = $role_tmp;
590
+ }
591
+
592
+ foreach ($role as $single_role) {
593
+ $single_role = strtolower($single_role);
594
+ if( get_role( $single_role ) ){
595
+ $user_object->add_role( $single_role );
596
+ }
597
+ else{
598
+ $invalid_roles[] = trim( $single_role );
599
+ }
600
+ }
601
+ }
602
+
603
+ if ( !empty( $invalid_roles ) ){
604
+ if( count( $invalid_roles ) == 1 )
605
+ $data[0] = __('Invalid role','import-users-from-csv-with-meta').' (' . reset( $invalid_roles ) . ')';
606
+ else
607
+ $data[0] = __('Invalid roles','import-users-from-csv-with-meta').' (' . implode( ', ', $invalid_roles ) . ')';
608
+
609
+ $errors[] = $acui_helper->new_error( $row, $errors_totals, $data[0], 'warning' );
610
+ }
611
+ }
612
+ }
613
+ }
614
+
615
+ // Multisite add user to current blog
616
+ if( is_multisite() ){
617
+ if( $created || $update_roles_existing_users != 'no' ){
618
+ if( empty( $role ) )
619
+ $role = 'subscriber';
620
+
621
+ if( !is_array( $role ) )
622
+ $role = array( $role );
623
+
624
+ foreach ($role as $single_role)
625
+ add_user_to_blog( get_current_blog_id(), $user_id, $single_role );
626
+ }
627
+ elseif( $update_roles_existing_users == 'no' && !is_user_member_of_blog( $user_id, get_current_blog_id() ) ){
628
+ add_user_to_blog( get_current_blog_id(), $user_id, 'subscriber' );
629
+ }
630
+ }
631
+
632
+ if( $columns > 2 ){
633
+ for( $i = 2 ; $i < $columns; $i++ ):
634
+ $data[$i] = apply_filters( 'pre_acui_import_single_user_single_data', $data[$i], $headers[$i], $i );
635
+
636
+ if( !empty( $data ) ){
637
+ if( strtolower( $headers[ $i ] ) == "password" ){ // passwords -> continue
638
+ continue;
639
+ }
640
+ elseif( strtolower( $headers[ $i ] ) == "user_pass" ){ // hashed pass
641
+ if( !$created && $update_allow_update_passwords == 'no' )
642
+ continue;
643
+
644
+ global $wpdb;
645
+ $wpdb->update( $wpdb->users, array( 'user_pass' => wp_slash( $data[ $i ] ) ), array( 'ID' => $user_id ) );
646
+ wp_cache_delete( $user_id, 'users' );
647
+ continue;
648
+ }
649
+ elseif( in_array( $headers[ $i ], $acui_helper->get_wp_users_fields() ) ){ // wp_user data
650
+ if( $data[ $i ] === '' && $empty_cell_action == "leave" ){
651
+ continue;
652
+ }
653
+ else{
654
+ wp_update_user( array( 'ID' => $user_id, $headers[ $i ] => $data[ $i ] ) );
655
+ continue;
656
+ }
657
+ }
658
+ elseif( in_array( $headers[ $i ], $acui_helper->get_not_meta_fields() ) ){
659
+ continue;
660
+ }
661
+ else{
662
+ if( $data[ $i ] === '' ){
663
+ if( $empty_cell_action == "delete" )
664
+ delete_user_meta( $user_id, $headers[ $i ] );
665
+ else
666
+ continue;
667
+ }
668
+ else{
669
+ update_user_meta( $user_id, $headers[ $i ], $data[ $i ] );
670
+ continue;
671
+ }
672
+ }
673
+
674
+ }
675
+ endfor;
676
+ }
677
+
678
+ $acui_helper->print_row_imported( $row, $data, $errors );
679
+
680
+ do_action( 'post_acui_import_single_user', $headers, $data, $user_id, $role, $positions, $form_data, $is_frontend, $is_cron, $password_changed );
681
+
682
+ $mail_for_this_user = false;
683
+ if( $is_cron ){
684
+ if( get_option( "acui_cron_send_mail" ) ){
685
+ if( $created || ( !$created && get_option( "acui_cron_send_mail_updated" ) ) ){
686
+ $mail_for_this_user = true;
687
+ }
688
+ }
689
+ }
690
+ else{
691
+ if( isset( $form_data["sends_email"] ) && $form_data["sends_email"] ){
692
+ if( $created || ( !$created && ( isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] ) ) )
693
+ $mail_for_this_user = true;
694
+ }
695
+ }
696
+
697
+ // wordpress default user created and edited emails
698
+ if( get_option('acui_automatic_created_edited_wordpress_email') === 'true' ){
699
+ ( $created ) ? do_action( 'register_new_user', $user_id ) : do_action( 'edit_user_created_user', $user_id, 'both' );
700
+ }
701
+
702
+ // send mail
703
+ if( isset( $mail_for_this_user ) && $mail_for_this_user ){
704
+ if( !$created && $update_allow_update_passwords == 'no' )
705
+ $password = __( 'Password has not been changed', 'import-users-from-csv-with-meta' );
706
+
707
+ ACUI_Email_Options::send_email( $user_object, $positions, $headers, $data, $created, $password );
708
+ }
709
+
710
+ // results
711
+ ( $created ) ? $results['created']++ : $results['updated']++;
712
+ ( $created ) ? array_push( $users_created, $user_id ) : array_push( $users_updated, $user_id );
713
+ endif;
714
+ endwhile;
715
+
716
+ $acui_helper->print_table_end();
717
+
718
+ $acui_helper->print_errors( $errors );
719
+
720
+ // let the filter of default WordPress emails as it were before deactivating them
721
+ if( !get_option('acui_automatic_wordpress_email') ){
722
+ remove_filter( 'send_email_change_email', function() { return false; }, 999 );
723
+ remove_filter( 'send_password_change_email', function() { return false; }, 999 );
724
+ }
725
+
726
+ if( $attach_id != 0 )
727
+ wp_delete_attachment( $attach_id );
728
+
729
+ // delete all users that have not been imported
730
+ $delete_users_flag = false;
731
+ $change_role_not_present_flag = false;
732
+
733
+ if( $delete_users == 'yes' ){
734
+ $delete_users_flag = true;
735
+ }
736
+
737
+ if( $is_cron && get_option( "acui_cron_delete_users" ) ){
738
+ $delete_users_flag = true;
739
+ $delete_users_assign_posts = get_option( "acui_cron_delete_users_assign_posts");
740
+ }
741
+
742
+ if( $is_backend && $change_role_not_present == 'yes' ){
743
+ $change_role_not_present_flag = true;
744
+ }
745
+
746
+ if( $is_cron && !empty( get_option( "acui_cron_change_role_not_present" ) ) ){
747
+ $change_role_not_present_flag = true;
748
+ $change_role_not_present_role = get_option( "acui_cron_change_role_not_present_role");
749
+ }
750
+
751
+ if( $is_frontend && !empty( get_option( "acui_frontend_change_role_not_present" ) ) ){
752
+ $change_role_not_present_flag = true;
753
+ $change_role_not_present_role = get_option( "acui_frontend_change_role_not_present_role");
754
+ }
755
+
756
+ if( $errors_totals['errors'] > 0 || $errors_totals['warnings'] > 0 ){ // if there is some problem of some kind importing we won't proceed with delete or changing role to users not present to avoid problems
757
+ $delete_users_flag = false;
758
+ $change_role_not_present_flag = false;
759
+ }
760
+
761
+ if( $delete_users_flag ):
762
+ require_once( ABSPATH . 'wp-admin/includes/user.php');
763
+
764
+ global $wp_roles; // get all roles
765
+ $all_roles = $wp_roles->roles;
766
+ $exclude_roles = array_diff( array_keys( $all_roles ), $editable_roles ); // remove editable roles
767
+
768
+ if ( !in_array( 'administrator', $exclude_roles )){ // just to be sure
769
+ $exclude_roles[] = 'administrator';
770
+ }
771
+
772
+ $args = array(
773
+ 'fields' => array( 'ID' ),
774
+ 'role__not_in' => $exclude_roles,
775
+ 'exclude' => array( get_current_user_id() ), // current user never cannot be deleted
776
+ );
777
+
778
+ if( $delete_users_only_specified_role ){
779
+ $args[ 'role__in' ] = $role_default;
780
+ }
781
+
782
+ $all_users = get_users( $args );
783
+ $all_users_ids = array_map( function( $element ){ return intval( $element->ID ); }, $all_users );
784
+ $users_to_remove = array_diff( $all_users_ids, $users_registered );
785
+
786
+ $delete_users_assign_posts = ( get_userdata( $delete_users_assign_posts ) === false ) ? false : $delete_users_assign_posts;
787
+ $results['deleted'] = count( $users_to_remove );
788
+
789
+ foreach ( $users_to_remove as $user_id ) {
790
+ ( empty( $delete_users_assign_posts ) ) ? wp_delete_user( $user_id ) : wp_delete_user( $user_id, $delete_users_assign_posts );
791
+ array_push( $users_deleted, $user_id );
792
+ }
793
+ endif;
794
+
795
+ if( $change_role_not_present_flag && !$delete_users_flag ):
796
+ require_once( ABSPATH . 'wp-admin/includes/user.php');
797
+
798
+ $all_users = get_users( array(
799
+ 'fields' => array( 'ID' ),
800
+ 'role__not_in' => array( 'administrator' )
801
+ ) );
802
+
803
+ foreach ( $all_users as $user ) {
804
+ if( !in_array( $user->ID, $users_registered ) ){
805
+ $user_object = new WP_User( $user->ID );
806
+ $user_object->set_role( $change_role_not_present_role );
807
+ }
808
+ }
809
+ endif;
810
+
811
+ $acui_helper->print_results( $results, $errors );
812
+
813
+ if( !$is_frontend )
814
+ $acui_helper->print_end_of_process();
815
+
816
+ if( !$is_frontend && !$is_cron )
817
+ $acui_helper->execute_datatable();
818
+
819
+ @ini_set( 'auto_detect_line_endings', FALSE );
820
+
821
+ do_action( 'after_acui_import_users' ); // deprecated this hook will be changed by the next one
822
+ do_action( 'acui_after_import_users', $users_created, $users_updated, $users_deleted, $users_ignored );
823
+ ?>
824
+ </div>
825
+ <?php
826
+ }
827
+ }
trunk/classes/meta-keys.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if ( ! class_exists( 'WP_List_Table' ) ) {
6
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
7
+ }
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{
15
+ display: none;
16
+ }
17
+ </style>
18
+ <h3><?php _e( 'Meta keys used in your database for users', 'import-users-from-csv-with-meta' ); ?></h3>
19
+ <div id="poststuff">
20
+ <div id="post-body" class="metabox-holder columns-2">
21
+ <div id="post-body-content">
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>
30
+ </div>
31
+ <br class="clear">
32
+ </div>
33
+ <?php
34
+ }
35
+ }
36
+
37
+ class ACUI_MetaKeys_Table extends WP_List_Table {
38
+ public function __construct() {
39
+ parent::__construct( [
40
+ 'singular' => 'Meta key',
41
+ 'plural' => 'Meta keys',
42
+ 'ajax' => false,
43
+ ] );
44
+ }
45
+
46
+ function get_columns() {
47
+ $columns = [
48
+ 'meta_key' => 'Meta key',
49
+ 'type' => 'Type',
50
+ 'example' => 'Example'
51
+ ];
52
+
53
+ return $columns;
54
+ }
55
+
56
+ static function get_meta_keys() {
57
+ global $wpdb;
58
+
59
+ $meta_keys = array();
60
+
61
+ $select = "SELECT distinct $wpdb->usermeta.meta_key FROM $wpdb->usermeta ORDER BY $wpdb->usermeta.meta_key";
62
+ $usermeta = $wpdb->get_results( $select, ARRAY_A );
63
+
64
+ foreach ($usermeta as $key => $value) {
65
+ $meta_key = array();
66
+ $meta_key['meta_key'] = $value["meta_key"];
67
+ $meta_key['type'] = "";
68
+ $meta_key['example'] = "";
69
+
70
+ $meta_keys[] = $meta_key;
71
+ }
72
+
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";
80
+ $usermeta = $wpdb->get_results( $select );
81
+
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'];
93
+
94
+ case 'type':
95
+ return $this->get_type( $item['meta_key'] );
96
+
97
+ case 'example':
98
+ return $this->get_example( $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
+
131
+ $this->items = self::get_meta_keys();
132
+ }
133
+ }
trunk/classes/multisite.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ if( !is_multisite() )
5
+ return;
6
+
7
+ class ACUI_Multisite{
8
+ function __construct(){
9
+ add_filter( 'acui_restricted_fields', array( $this, 'restricted_fields' ), 10, 1 );
10
+ add_action( 'acui_documentation_after_plugins_activated', array( $this, 'documentation' ) );
11
+ add_action( 'post_acui_import_single_user', array( $this, 'assign' ), 10, 4 );
12
+ }
13
+
14
+ function restricted_fields( $acui_restricted_fields ){
15
+ return array_merge( $acui_restricted_fields, array( 'blogs' ) );
16
+ }
17
+
18
+ function documentation(){
19
+ ?>
20
+ <tr valign="top">
21
+ <th scope="row"><?php _e( "Multisite is activated", 'import-users-from-csv-with-meta' ); ?></th>
22
+ <td><?php _e( "Plugin can assing users to blogs after importing them roles. This is how it works:", 'import-users-from-csv-with-meta' ); ?>
23
+ <ul style="list-style:disc outside none; margin-left:2em;">
24
+ <li><?php _e( "You have to <strong>create a column called 'blogs'</strong>: if cell is empty, it won't assign users to any blog; if cell has a value, it will be used. You have to fill it with blog_id", 'import-users-from-csv-with-meta' ); ?></li>
25
+ <li><?php _e( "Multiple blogs can be assigned creating <strong>a list of blog ids</strong> using commas to separate values.", 'import-users-from-csv-with-meta' ); ?></li>
26
+ </ul>
27
+ </td>
28
+ </tr>
29
+ <?php
30
+ }
31
+
32
+ function assign( $headers, $row, $user_id, $role ){
33
+ $pos = array_search( 'blogs', $headers );
34
+
35
+ if( $pos === FALSE )
36
+ return;
37
+
38
+ if( empty( $role ) )
39
+ $role = 'subscriber';
40
+
41
+ if( is_array( $role ) )
42
+ $role = reset( $role );
43
+
44
+ $user_blogs_csv = explode( ',', $row[ $pos ] );
45
+ $user_blogs_csv = array_filter( $user_blogs_csv, function( $value ){ return $value !== ''; } );
46
+
47
+ foreach ( $user_blogs_csv as $blog_id ) {
48
+ add_user_to_blog( $blog_id, $user_id, $role );
49
+ }
50
+ }
51
+ }
52
+ new ACUI_Multisite();
trunk/classes/new_features.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_NewFeatures{
6
+ public static function message(){
7
+ ?>
8
+ <div class="postbox">
9
+ <h3 class="hndle"><span>&nbsp;<?php _e( 'New features', 'import-users-from-csv-with-meta' ); ?></span></h3>
10
+
11
+ <div class="inside" style="display: block;">
12
+ <p><?php _e( 'This is a list of new features that we want to include, but we have not been able to do yet. We have a bussiness and have not so much time for this plugin as we would like to have. If you need some new feature not included in this list, please write us to:', 'import-users-from-csv-with-meta' ); ?> <a href="mailto:contacto@codection.com">contacto@codection.com</a>. <?php _e( 'You can also donate us or talk with us to have some of the next new features done soon.', 'import-users-from-csv-with-meta' ); ?></p>
13
+ <ul style="list-style: disc; padding-left: 15px;">
14
+ <li>Change required document format</li>
15
+ <li>Make a wizard to help importing</li>
16
+ <li>Include a new step, to a simulation about how it would be the import before doing it</li>
17
+ <li>Make a website to give a better documentation and tutorials about it</li>
18
+ <li>Create an online service to be able to provide personal support to some imports</li>
19
+ <li>Include a button to export the current user data database in CSV format</li>
20
+ <li>Make this plugin compatible with WP-CLI including some command</li>
21
+ <li>Include more CSV examples</li>
22
+ </ul>
23
+ <div style="clear:both;"></div>
24
+ </div>
25
+ </div>
26
+ <?php
27
+ }
28
+ }
trunk/classes/options.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ self::$prefix . 'manually_send_mail' => false,
13
+ self::$prefix . 'manually_send_mail_updated' => false,
14
+ self::$prefix . 'manually_force_user_reset_password' => false,
15
+ // emails
16
+ self::$prefix . 'mail_subject' => __('Welcome to', 'import-users-from-csv-with-meta') . ' ' . get_bloginfo("name"),
17
+ 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>',
18
+ self::$prefix . 'mail_template_id' => 0,
19
+ self::$prefix . 'mail_attachment_id' => 0,
20
+ self::$prefix . 'enable_email_templates' => false,
21
+ self::$prefix . 'mail_disable_wp_editor' => false,
22
+ // cron
23
+ self::$prefix . 'cron_activated' => false,
24
+ self::$prefix . 'cron_send_mail' => false,
25
+ self::$prefix . 'cron_send_mail_updated' => false,
26
+ self::$prefix . 'cron_delete_users' => false,
27
+ self::$prefix . 'cron_delete_users_assign_posts' => 0,
28
+ self::$prefix . 'cron_change_role_not_present' => false,
29
+ self::$prefix . 'cron_change_role_not_present_role' => 0,
30
+ self::$prefix . 'cron_path_to_file' => '',
31
+ self::$prefix . 'cron_path_to_move' => '',
32
+ self::$prefix . 'cron_path_to_move_auto_rename' => false,
33
+ self::$prefix . 'cron_period' => '',
34
+ self::$prefix . 'cron_role' => '',
35
+ self::$prefix . 'cron_update_roles_existing_users' => '',
36
+ self::$prefix . 'cron_log' => '',
37
+ self::$prefix . 'cron_allow_multiple_accounts' => 'not_allowed',
38
+ // frontend
39
+ self::$prefix . 'frontend_send_mail'=> false,
40
+ self::$prefix . 'frontend_send_mail_updated' => false,
41
+ self::$prefix . 'frontend_mail_admin' => false,
42
+ self::$prefix . 'frontend_force_user_reset_password' => false,
43
+ self::$prefix . 'frontend_send_mail_admin_address_list' => '',
44
+ self::$prefix . 'frontend_delete_users' => false,
45
+ self::$prefix . 'frontend_delete_users_assign_posts' => 0,
46
+ self::$prefix . 'frontend_change_role_not_present' => false,
47
+ self::$prefix . 'frontend_change_role_not_present_role' => 0,
48
+ self::$prefix . 'frontend_role' => '',
49
+ self::$prefix . 'frontend_update_existing_users' => false,
50
+ self::$prefix . 'frontend_update_roles_existing_users' => false,
51
+ // emials
52
+ self::$prefix . 'manually_send_mail' => false,
53
+ self::$prefix . 'manually_send_mail_updated' => false,
54
+ self::$prefix . 'automatic_wordpress_email' => false,
55
+ self::$prefix . 'automatic_created_edited_wordpress_email' => false,
56
+ // profile fields
57
+ self::$prefix . 'show_profile_fields' => false
58
+ );
59
+ }
60
+
61
+ static function get_default( $key ){
62
+ $defaults = self::get_default_list();
63
+ return ( isset( $defaults[$key] ) ) ? $defaults[$key] : '';
64
+ }
65
+
66
+ static function prepare_key( $key, $class = '' ){
67
+ return ( empty( $class ) ) ? self::$prefix . $key : self::$prefix . $class . $key;
68
+ }
69
+
70
+ static function get( $key, $class = '' ){
71
+ $key = self::prepare_key( $key, $class );
72
+ $value = get_option( $key );
73
+
74
+ return ( !empty( $value ) ) ? $value : self::get_default( $key );
75
+ }
76
+
77
+ static function update( $key, $value, $class = '' ){
78
+ $key = self::prepare_key( $key, $class );
79
+ return update_option( $key, $value );
80
+ }
81
+
82
+ static function save_options( $form_data, $is_cron = false, $is_frontend = false ){
83
+ if( !$is_frontend && !$is_cron ){
84
+ update_option( "acui_manually_send_mail", isset( $form_data["sends_email"] ) && $form_data["sends_email"] == 'yes' );
85
+ update_option( "acui_manually_send_mail_updated", isset( $form_data["send_email_updated"] ) && $form_data["send_email_updated"] == 'yes' );
86
+ update_option( "acui_manually_force_user_reset_password", isset( $form_data["force_user_reset_password"] ) && $form_data["force_user_reset_password"] == 'yes' );
87
+ }
88
+ elseif( $is_frontend ){
89
+ $form_data["send_mail_admin_frontend_address_list"] = isset( $form_data["send_mail_admin_frontend_address_list"] ) ? $form_data["send_mail_admin_frontend_address_list"] : '';
90
+
91
+ update_option( "acui_frontend_send_mail", isset( $form_data["send-mail-frontend"] ) && $form_data["send-mail-frontend"] == "1" );
92
+ update_option( "acui_frontend_send_mail_updated", isset( $form_data["send-mail-updated-frontend"] ) && $form_data["send-mail-updated-frontend"] == "1" );
93
+ update_option( "acui_frontend_mail_admin", isset( $form_data["send_mail_admin_frontend"] ) && $form_data["send_mail_admin_frontend"] == "1" );
94
+ update_option( "acui_frontend_force_user_reset_password", isset( $form_data["force_user_reset_password"] ) && $form_data["force_user_reset_password"] == "1" );
95
+ update_option( "acui_frontend_send_mail_admin_address_list", sanitize_text_field( $form_data["send_mail_admin_frontend_address_list"] ) );
96
+ update_option( "acui_frontend_delete_users", isset( $form_data["delete_users_frontend"] ) && $form_data["delete_users_frontend"] == "1" );
97
+ update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
98
+ update_option( "acui_frontend_change_role_not_present", isset( $form_data["change_role_not_present_frontend"] ) && $form_data["change_role_not_present_frontend"] == "1" );
99
+ update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change_role_not_present_role_frontend"] ) );
100
+ update_option( "acui_frontend_activate_users_wp_members", isset( $form_data["activate-users-wp-members-frontend"] ) ? sanitize_text_field( $form_data["activate-users-wp-members-frontend"] ) : 'no_activate' );
101
+
102
+ update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
103
+ update_option( "acui_frontend_update_existing_users", sanitize_text_field( $form_data["update_existing_users"] ) );
104
+ update_option( "acui_frontend_update_roles_existing_users", sanitize_text_field( $form_data["update_roles_existing_users"] ) );
105
+ }
106
+ }
107
+ }
trunk/classes/rest-api.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_REST_API{
6
+ function __construct(){
7
+ add_action( 'rest_api_init', array( $this, 'init' ) );
8
+ add_filter( 'acui_rest_api_permission_callback', function(){ return true; } );
9
+ }
10
+
11
+ function init() {
12
+ register_rest_route( 'import-users-from-csv-with-meta/v1', '/execute-cron/', array(
13
+ 'methods' => 'GET',
14
+ 'callback' => array( $this, 'fire_cron' ),
15
+ 'permission_callback' => function () {
16
+ return apply_filters( 'acui_rest_api_permission_callback', current_user_can( apply_filters( 'acui_capability', 'create_users' ) ) );
17
+ }
18
+ ) );
19
+ }
20
+
21
+ function fire_cron(){
22
+ do_action( 'acui_cron_process' );
23
+ return "OK";
24
+ }
25
+ }
26
+
27
+ new ACUI_REST_API();
trunk/classes/settings.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit;
3
+
4
+ class ACUI_Settings{
5
+ var $settings;
6
+
7
+ function __construct(){
8
+ $settings = array(
9
+ 'common' => array(
10
+ 'default_role',
11
+
12
+ )
13
+ );
14
+ }
15
+ }
trunk/classes/wp-importer.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ class ACUI_WP_Importer_GUI{
6
+ function __construct(){
7
+ add_action( 'admin_init', array( $this, 'register' ) );
8
+ add_action( 'export_filters', array( $this, 'exporter' ) );
9
+ }
10
+
11
+ function register(){
12
+ register_importer( 'acui_importer', __( 'Import users or customers (CSV)', 'import-users-from-csv-with-meta' ), __( 'Import <strong>users or customers</strong> to your site via a csv file.', 'import-users-from-csv-with-meta' ), array( $this, 'importer' ) );
13
+ }
14
+
15
+ function importer(){
16
+ echo "<script>document.location.href='" . admin_url( 'tools.php?page=acui' ) . "'</script>";
17
+ }
18
+
19
+ function exporter(){
20
+ ?>
21
+ <p><?php printf( __( 'You can also export users and customers in CSV format, filtering by user created date, role, choosing the delimiter and some other options using <a href="%s">this exporter</a>.', 'import-users-from-csv-with-meta' ), admin_url( 'tools.php?page=acui&tab=export' ) ); ?></p>
22
+ <?php
23
+ }
24
+ }
25
+ new ACUI_WP_Importer_GUI();
trunk/csv_example.png ADDED
Binary file
trunk/icon_coffee.png ADDED
Binary file
trunk/import-users-from-csv-with-meta.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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.19.2
7
+ Author: codection
8
+ Author URI: https://codection.com
9
+ License: GPL2
10
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
+ Text Domain: import-users-from-csv-with-meta
12
+ Domain Path: /languages
13
+ */
14
+ if ( ! defined( 'ABSPATH' ) )
15
+ exit;
16
+
17
+ define( 'ACUI_VERSION', '1.19.2' );
18
+
19
+ class ImportExportUsersCustomers{
20
+ var $file;
21
+
22
+ function __construct(){
23
+ }
24
+
25
+ function on_init(){
26
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
27
+
28
+ if( is_plugin_active( 'buddypress/bp-loader.php' ) || function_exists( 'bp_is_active' ) ){
29
+ if ( defined( 'BP_VERSION' ) )
30
+ $this->loader();
31
+ else
32
+ add_action( 'bp_init', array( $this, 'loader' ) );
33
+ }
34
+ else{
35
+ $this->loader();
36
+ }
37
+
38
+ load_plugin_textdomain( 'import-users-from-csv-with-meta', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
39
+ }
40
+
41
+ function loader(){
42
+ add_action( 'admin_menu', array( $this, 'menu' ) );
43
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10, 1 );
44
+ add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 );
45
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
46
+ add_filter( 'wp_check_filetype_and_ext', array( $this, 'wp_check_filetype_and_ext' ), PHP_INT_MAX, 4 );
47
+
48
+ if( is_plugin_active( 'buddypress/bp-loader.php' ) && file_exists( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' ) ){
49
+ require_once( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' );
50
+ }
51
+
52
+ // classes
53
+ foreach ( glob( plugin_dir_path( __FILE__ ) . "classes/*.php" ) as $file ) {
54
+ include_once( $file );
55
+ }
56
+
57
+ // includes
58
+ foreach ( glob( plugin_dir_path( __FILE__ ) . "include/*.php" ) as $file ) {
59
+ include_once( $file );
60
+ }
61
+
62
+ // addons
63
+ foreach ( glob( plugin_dir_path( __FILE__ ) . "addons/*.php" ) as $file ) {
64
+ include_once( $file );
65
+ }
66
+ }
67
+
68
+ static function activate(){
69
+ include_once( 'classes/options.php' );
70
+ $acui_default_options_list = ACUI_Options::get_default_list();
71
+
72
+ foreach ( $acui_default_options_list as $key => $value) {
73
+ add_option( $key, $value, '', false );
74
+ }
75
+ }
76
+
77
+ static function deactivate(){
78
+ wp_clear_scheduled_hook( 'acui_cron' );
79
+ }
80
+
81
+ function menu() {
82
+ $acui_import = new ACUI_Import();
83
+ add_submenu_page( 'tools.php', __( 'Import and export users and customers', 'import-users-from-csv-with-meta' ), __( 'Import and export users and customers', 'import-users-from-csv-with-meta' ), apply_filters( 'acui_capability', 'create_users' ), 'acui', array( $acui_import, 'show' ) );
84
+ }
85
+
86
+ function admin_enqueue_scripts( $hook ) {
87
+ if( 'tools_page_acui' != $hook )
88
+ return;
89
+
90
+ wp_enqueue_style( 'acui_css', plugins_url( 'assets/style.css', __FILE__ ), false, ACUI_VERSION );
91
+ wp_enqueue_style( 'datatable', '//cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css' );
92
+ wp_enqueue_script( 'datatable', '//cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js' );
93
+ //wp_enqueue_script( 'datatable-select', '//cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js' );
94
+
95
+ if( isset( $_GET['tab'] ) && $_GET['tab'] == 'export' ){
96
+ ACUI_Exporter::enqueue();
97
+ }
98
+ }
99
+
100
+ function action_links( $links, $file ) {
101
+ if ($file == 'import-users-from-csv-with-meta/import-users-from-csv-with-meta.php') {
102
+ $links[] = sprintf( __( '<a href="%s">Export</a>', 'import-users-from-csv-with-meta' ), get_admin_url( null, 'tools.php?page=acui&tab=export' ) );
103
+ $links[] = sprintf( __( '<a href="%s">Import</a>', 'import-users-from-csv-with-meta' ), get_admin_url( null, 'tools.php?page=acui&tab=homepage' ) );
104
+ return array_reverse( $links );
105
+ }
106
+
107
+ return $links;
108
+ }
109
+
110
+ function plugin_row_meta( $links, $file ){
111
+ if ( strpos( $file, basename( __FILE__ ) ) !== false ) {
112
+ $new_links = array(
113
+ '<a href="https://www.paypal.me/imalrod" target="_blank">' . __( 'Donate', 'import-users-from-csv-with-meta' ) . '</a>',
114
+ '<a href="mailto:contacto@codection.com" target="_blank">' . __( 'Premium support', 'import-users-from-csv-with-meta' ) . '</a>',
115
+ '<a href="http://codection.com/tienda" target="_blank">' . __( 'Premium plugins', 'import-users-from-csv-with-meta' ) . '</a>',
116
+ );
117
+
118
+ $links = array_merge( $links, $new_links );
119
+ }
120
+
121
+ return $links;
122
+ }
123
+
124
+ function wp_check_filetype_and_ext( $values, $file, $filename, $mimes ) {
125
+ if ( extension_loaded( 'fileinfo' ) ) {
126
+ // with the php-extension, a CSV file is issues type text/plain so we fix that back to
127
+ // text/csv by trusting the file extension.
128
+ $finfo = finfo_open( FILEINFO_MIME_TYPE );
129
+ $real_mime = finfo_file( $finfo, $file );
130
+ finfo_close( $finfo );
131
+ if ( $real_mime === 'text/plain' && preg_match( '/\.(csv)$/i', $filename ) ) {
132
+ $values['ext'] = 'csv';
133
+ $values['type'] = 'text/csv';
134
+ }
135
+ } else {
136
+ // without the php-extension, we probably don't have the issue at all, but just to be sure...
137
+ if ( preg_match( '/\.(csv)$/i', $filename ) ) {
138
+ $values['ext'] = 'csv';
139
+ $values['type'] = 'text/csv';
140
+ }
141
+ }
142
+ return $values;
143
+ }
144
+ }
145
+
146
+ function acui_start(){
147
+ $import_export_users_customers = new ImportExportUsersCustomers();
148
+ add_action( 'init', array( $import_export_users_customers, 'on_init' ) );
149
+ }
150
+ add_action( 'plugins_loaded', 'acui_start', 8);
151
+
152
+ register_activation_hook( __FILE__, array( 'ImportExportUsersCustomers', 'activate' ) );
153
+ register_deactivation_hook( __FILE__, array( 'ImportExportUsersCustomers', 'deactivate' ) );
trunk/languages/import-users-from-csv-with-meta-de_DE.mo ADDED
Binary file
trunk/languages/import-users-from-csv-with-meta-de_DE.po ADDED
@@ -0,0 +1,1151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WordPress Blank Pot
2
+ # Copyright (C) 2014 ...
3
+ # This file is distributed under the GNU General Public License v2 or later.
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: WordPress Blank Pot v1.0.0\n"
7
+ "Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
8
+ "POT-Creation-Date: 2016-11-07 21:17+0100\n"
9
+ "PO-Revision-Date: \n"
10
+ "Language-Team: Your Team <translations@example.com>\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
19
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
20
+ "X-Poedit-Basepath: ..\n"
21
+ "X-Generator: Poedit 1.8.9\n"
22
+ "Last-Translator: \n"
23
+ "Language: de_DE\n"
24
+ "X-Poedit-SearchPath-0: .\n"
25
+
26
+ #: smtp.php:26 smtp.php:245
27
+ msgid "Send Test"
28
+ msgstr "Test senden"
29
+
30
+ #: smtp.php:40
31
+ msgid "Test mail to "
32
+ msgstr "Test-Mail an"
33
+
34
+ #: smtp.php:41
35
+ msgid ""
36
+ "This is a test email generated by the Import User From CSV With Meta "
37
+ "WordPress plugin."
38
+ msgstr ""
39
+ "Dies ist eine Test-Email erzeugt vom Plugin \"Import Benutzer aus CSV mit "
40
+ "Meta\"."
41
+
42
+ #: smtp.php:79
43
+ msgid "Message sent successfully"
44
+ msgstr "Nachricht erfolgreich gesendet"
45
+
46
+ #: smtp.php:83
47
+ msgid "Test Message Sent"
48
+ msgstr "Nachricht gesendet"
49
+
50
+ #: smtp.php:84
51
+ msgid "The result was:"
52
+ msgstr "Das Ergebnis war:"
53
+
54
+ #: smtp.php:86
55
+ msgid "The full debugging output is shown below:"
56
+ msgstr "Die vollständige Debugausgabe ist nachfolgend dargestellt:"
57
+
58
+ #: smtp.php:88
59
+ msgid "The SMTP debugging output is shown below:"
60
+ msgstr "Die SMTP-Debugausgabe ist nachfolgend dargestellt:"
61
+
62
+ #: smtp.php:119
63
+ msgid "Import User From CSV With Meta - SMTP server options"
64
+ msgstr "SMTP-Server-Optionen"
65
+
66
+ #: smtp.php:123
67
+ msgid "Global options"
68
+ msgstr "Allgemeine Optionen"
69
+
70
+ #: smtp.php:124
71
+ msgid ""
72
+ "Do you want to use your own SMTP settings for this plugin or the WordPress "
73
+ "settings."
74
+ msgstr "Eigene SMTP-Einstellungen oder WordPress-Einstellungen verwenden."
75
+
76
+ #: smtp.php:128
77
+ msgid "Settings"
78
+ msgstr "Einstellungen"
79
+
80
+ #: smtp.php:131
81
+ msgid "Use plugin SMTP settings"
82
+ msgstr "SMTP-Einstellungen des Plugins verwenden"
83
+
84
+ #: smtp.php:133
85
+ msgid "Use this settings to send mail."
86
+ msgstr "Diese Einstellungen zum Mailversand verwenden."
87
+
88
+ #: smtp.php:135
89
+ msgid "Use WordPress general settings to send mail."
90
+ msgstr "Allgemeine WordPress-Einstellungen zum Mailversand verwenden."
91
+
92
+ #: smtp.php:143
93
+ msgid "From Email"
94
+ msgstr "Emailadresse des Absenders"
95
+
96
+ #: smtp.php:145
97
+ msgid ""
98
+ "You can specify the email address that emails should be sent from. If you "
99
+ "leave this blank, the default email will be used."
100
+ msgstr ""
101
+ "Absenderadresse festlegen. Falls leer, wird die Default-Emailadresse "
102
+ "verwendet."
103
+
104
+ #: smtp.php:145
105
+ msgid ""
106
+ "<strong>Please Note:</strong> You appear to be using a version of WordPress "
107
+ "prior to 2.3. Please ignore the From Name field and instead enter Name&lt;"
108
+ "email@domain.com&gt; in this field."
109
+ msgstr ""
110
+ "<strong>Achtung</strong>Anscheinend wird eine WordPressversion vor 2.3 "
111
+ "verwendet. Ignoriere das Feld \"Absendername\" und füge statt dessen Name&lt;"
112
+ "email@domain.com&gt; in dieses Feld."
113
+
114
+ #: smtp.php:148
115
+ msgid "From Name"
116
+ msgstr "Absendername"
117
+
118
+ #: smtp.php:150
119
+ msgid ""
120
+ "You can specify the name that emails should be sent from. If you leave this "
121
+ "blank, the emails will be sent from WordPress."
122
+ msgstr ""
123
+ "Absendernamen festlegen. Falls leer, werden die Emails von WordPress "
124
+ "gesendet."
125
+
126
+ #: smtp.php:156 smtp.php:159
127
+ msgid "Mailer"
128
+ msgstr "Mailer"
129
+
130
+ #: smtp.php:161
131
+ msgid "Send emails of this plugin via SMTP."
132
+ msgstr "Emails dieses Plugins per SMTP senden."
133
+
134
+ #: smtp.php:163
135
+ msgid "Use the PHP mail() function to send emails."
136
+ msgstr "Die PHP mail() Funktion zum Emailversand verwenden."
137
+
138
+ #: smtp.php:171 smtp.php:174
139
+ msgid "Return Path"
140
+ msgstr "Antwort an"
141
+
142
+ #: smtp.php:176
143
+ msgid "Set the return-path to match the From Email"
144
+ msgstr "\"Antowrt an\" auf Absenderadresse setzen"
145
+
146
+ #: smtp.php:182
147
+ msgid "SMTP Options"
148
+ msgstr "SMTP Optionen"
149
+
150
+ #: smtp.php:183
151
+ msgid "These options only apply if you have chosen to send mail by SMTP above."
152
+ msgstr "Diese Optionen werden nur angewendet, wenn SMTP ausgewählt wurde."
153
+
154
+ #: smtp.php:187
155
+ msgid "SMTP Host"
156
+ msgstr "SMTP Host"
157
+
158
+ #: smtp.php:191
159
+ msgid "SMTP Port"
160
+ msgstr "SMTP Port"
161
+
162
+ #: smtp.php:195 smtp.php:198
163
+ msgid "Encryption"
164
+ msgstr "Verschlüsselung"
165
+
166
+ #: smtp.php:200
167
+ msgid "No encryption."
168
+ msgstr "Keine Verschlüsselung."
169
+
170
+ #: smtp.php:202
171
+ msgid "Use SSL encryption."
172
+ msgstr "SSL Verschlüsselung verwenden."
173
+
174
+ #: smtp.php:204
175
+ msgid ""
176
+ "Use TLS encryption. This is not the same as STARTTLS. For most servers SSL "
177
+ "is the recommended option."
178
+ msgstr ""
179
+ "TLS Verschlüsselung verwenden. Nicht identisch mit STARTTLS. Meist wird SSL "
180
+ "empfohlen."
181
+
182
+ #: smtp.php:208
183
+ msgid "Authentication"
184
+ msgstr "Authentifizerung"
185
+
186
+ #: smtp.php:211
187
+ msgid "No: Do not use SMTP authentication."
188
+ msgstr "Nein: Authentifizerung nicht verwenden."
189
+
190
+ #: smtp.php:213
191
+ msgid "Yes: Use SMTP authentication."
192
+ msgstr "Ja: Authentifizerung verwenden."
193
+
194
+ #: smtp.php:214
195
+ msgid "If this is set to no, the values below are ignored."
196
+ msgstr "Falls nein gesetzt ist, werden die folgenden Eingaben ignoriert."
197
+
198
+ #: smtp.php:218 importer.php:830 import-users-from-csv-with-meta.php:52
199
+ #: import-users-from-csv-with-meta.php:195
200
+ msgid "Username"
201
+ msgstr "Benutzername"
202
+
203
+ #: smtp.php:222 import-users-from-csv-with-meta.php:195
204
+ msgid "Password"
205
+ msgstr "Passwort"
206
+
207
+ #: smtp.php:227
208
+ msgid "Save Changes"
209
+ msgstr "Änderungen speichern"
210
+
211
+ #: smtp.php:234
212
+ msgid "Send a Test Email"
213
+ msgstr "Testemail senden"
214
+
215
+ #: smtp.php:240
216
+ msgid "To:"
217
+ msgstr "An:"
218
+
219
+ #: smtp.php:242
220
+ msgid ""
221
+ "Type an email address here and then click Send Test to generate a test email."
222
+ msgstr ""
223
+ "Eine Emailadresse eingeben und \"Sende Test\" klicken, um eine Testemail zu "
224
+ "erzeugen."
225
+
226
+ #: importer.php:60
227
+ msgid "Ready to registers"
228
+ msgstr "Bereit zu registrieren"
229
+
230
+ #: importer.php:61
231
+ msgid "First row represents the form of sheet"
232
+ msgstr "Erste Zeile enthält das Format der Tabelle"
233
+
234
+ #: importer.php:88
235
+ msgid "File must contain at least 2 columns: username and email"
236
+ msgstr "Mindestens 2 Spalten erforderlich: username und email"
237
+
238
+ #: importer.php:116
239
+ msgid "Inserting and updating data"
240
+ msgstr "Daten werden eingefügt und upgedated"
241
+
242
+ #: importer.php:118
243
+ msgid "Row"
244
+ msgstr "Zeile"
245
+
246
+ #: importer.php:123
247
+ msgid "Row number"
248
+ msgstr "Zeile Nummer"
249
+
250
+ #: importer.php:123
251
+ msgid "does not have the same columns than the header, we are going to skip"
252
+ msgstr "enthält nicht die gleichen Spalten wie Kopfzeile: wird übersprungen"
253
+
254
+ #: importer.php:174
255
+ msgid "Problems with ID"
256
+ msgstr "Probleme mit ID"
257
+
258
+ #: importer.php:174
259
+ msgid ""
260
+ "username is not the same in the CSV and in database, we are going to skip."
261
+ msgstr "username in CSV und Datenbank stimmen nicht überein: wird übersprungen"
262
+
263
+ #: importer.php:222
264
+ msgid "User already exists as:"
265
+ msgstr "Benutzer existiert bereits als:"
266
+
267
+ #: importer.php:222
268
+ msgid "(in this CSV file is called:"
269
+ msgstr "(in der CSV-Datei lautet er:"
270
+
271
+ #: importer.php:248
272
+ msgid "Problems with user:"
273
+ msgstr "Probleme mit Benutzer:"
274
+
275
+ #: importer.php:248
276
+ msgid ", we are going to skip. \\r\\nError: "
277
+ msgstr ", wird übersprungen. \\r\\nFehler: "
278
+
279
+ #: importer.php:368
280
+ msgid "Password has not been changed"
281
+ msgstr "Passwort nicht geändert"
282
+
283
+ #: importer.php:437
284
+ msgid "Process finished you can go"
285
+ msgstr "Vorgang abgeschlossen. Du kannst"
286
+
287
+ #: importer.php:437
288
+ msgid "here to see results"
289
+ msgstr "hier die Ergebnisse sehen"
290
+
291
+ #: importer.php:452
292
+ msgid "You are not allowed to see this content."
293
+ msgstr "Zugriff nicht erlaubt"
294
+
295
+ #: importer.php:498
296
+ msgid "Click to open/close"
297
+ msgstr "Zum Öffnen/Schließen klicken"
298
+
299
+ #: importer.php:502
300
+ msgid "Old CSV files uploaded"
301
+ msgstr "Alte CSV-Datei hochgeladen"
302
+
303
+ #: importer.php:505
304
+ msgid ""
305
+ "For security reasons you should delete this files, probably they would be "
306
+ "visible in the Internet if a bot or someone discover the URL. You can delete "
307
+ "each file or maybe you want delete all CSV files you have uploaded:"
308
+ msgstr ""
309
+ "Aus Sicherheitsgründen sollte diese Datei gelöscht werden, da sie im "
310
+ "Internet sichtbar ist, falls ein bot oder jemand die URL entdeckt. Du kannst "
311
+ "jede Datei oder alle hochgeladenen CSV-Dateien löschen:"
312
+
313
+ #: importer.php:506
314
+ msgid "Delete all CSV files uploaded"
315
+ msgstr "Alle hochgeladenen CSV-Dateien löschen"
316
+
317
+ #: importer.php:516
318
+ msgid "Delete"
319
+ msgstr "Lösche"
320
+
321
+ #: importer.php:525
322
+ msgid ""
323
+ "File must contain at least <strong>2 columns: username and email</strong>. "
324
+ "These should be the first two columns and it should be placed <strong>in "
325
+ "this order: username and email</strong>. If there are more columns, this "
326
+ "plugin will manage it automatically."
327
+ msgstr ""
328
+ "Datei muss zumindest <strong>2 Spalten haben: username und email</strong>. "
329
+ "Diese sollten die ersten beiden Spalten sein und sie sollten in "
330
+ "<strong>dieser Reihenfolge stehen: username und email</strong>. Weitere "
331
+ "Spalten werden vom Plugin automatisch verarbeitet."
332
+
333
+ #: importer.php:526
334
+ msgid ""
335
+ "Please, read carefully how <strong>passwords are managed</strong> and also "
336
+ "take note about capitalization, this plugin is <strong>case sensitive</"
337
+ "strong>."
338
+ msgstr ""
339
+ "Bitte lies sorgfältig, wie <strong>Passwörter gehandhabt werden</strong> und "
340
+ "beachte auch die Groß- und Kleinschreibung, Dieses Plugin ist <strong>case "
341
+ "sensitive</strong>."
342
+
343
+ #: importer.php:529 import-users-from-csv-with-meta.php:96
344
+ #: import-users-from-csv-with-meta.php:202
345
+ msgid "Import users from CSV"
346
+ msgstr "Benutzer aus CSV importieren"
347
+
348
+ #: importer.php:539
349
+ msgid "Update existing users?"
350
+ msgstr "Bestehende Benutzer updaten?"
351
+
352
+ #: importer.php:542 importer.php:571
353
+ msgid "Yes"
354
+ msgstr "Ja"
355
+
356
+ #: importer.php:543 importer.php:570
357
+ msgid "No"
358
+ msgstr "Nein"
359
+
360
+ #: importer.php:549 importer.php:1077
361
+ msgid "Role"
362
+ msgstr "Role"
363
+
364
+ #: importer.php:562
365
+ msgid ""
366
+ "If you choose more than one role, the roles would be assigned correctly but "
367
+ "you should use some plugin like <a href=\"https://wordpress.org/plugins/user-"
368
+ "role-editor/\">User Role Editor</a> to manage them."
369
+ msgstr ""
370
+ "Wird mehr als eine Role gewählt, so werden die Roles korrekt zugewiesen, "
371
+ "aber du solltest ein Plugin wie den <a href=\"https://wordpress.org/plugins/"
372
+ "user-role-editor/\">User Role Editor</a> zur Bearbeitung verwenden."
373
+
374
+ #: importer.php:567
375
+ msgid "Update roles for existing users?"
376
+ msgstr "Roles für bestehende Benutzer upaten?"
377
+
378
+ #: importer.php:577
379
+ msgid "CSV file <span class=\"description\">(required)</span></label>"
380
+ msgstr "CSV Datei <span class=\"description\">(erforderlich)</span></label>"
381
+
382
+ #: importer.php:581
383
+ msgid "<em>or you can choose directly a file from your host,"
384
+ msgstr "<em>oder direkt eine Datei vom Host wählen,"
385
+
386
+ #: importer.php:581 importer.php:585
387
+ msgid "click here"
388
+ msgstr "hier klicken"
389
+
390
+ #: importer.php:584 importer.php:1038 importer.php:1103
391
+ msgid "You have to introduce the path to file, i.e.:"
392
+ msgstr "Du musst den Pfad zur Datei angeben, d.h:"
393
+
394
+ #: importer.php:585
395
+ msgid "or you can upload it directly from your PC"
396
+ msgstr "oder direkt vom PC hochladen"
397
+
398
+ #: importer.php:591
399
+ msgid "What should the plugin do with empty cells?"
400
+ msgstr "Was soll mit leeren Zellen geschehen?"
401
+
402
+ #: importer.php:594
403
+ msgid "Leave the old value for this metadata"
404
+ msgstr "Werte für alte Metadaten behalten"
405
+
406
+ #: importer.php:595
407
+ msgid "Delete the metadata"
408
+ msgstr "Metadaten löschen"
409
+
410
+ #: importer.php:621
411
+ msgid "BuddyPress users"
412
+ msgstr "BuddyPress Benutzer"
413
+
414
+ #: importer.php:622
415
+ msgid ""
416
+ "You can insert any profile from BuddyPress using his name as header. Plugin "
417
+ "will check, before import, which fields are defined in BuddyPress and will "
418
+ "assign it in the update. You can use this fields:"
419
+ msgstr ""
420
+ "Du kannst jedes Profil von BuddyPress einfügen, indem du den name als Header "
421
+ "verwendest. Das Plugin prüft vor dem Import, welche Felder in BuddyPress "
422
+ "definiert sind und weist sie beim Update zu. Du kannst diese Felder "
423
+ "verwenden:"
424
+
425
+ #: importer.php:626
426
+ msgid ""
427
+ "Remember that all date fields have to be imported using a format like this: "
428
+ "2016-01-01 00:00:00"
429
+ msgstr ""
430
+ "Alle zu importierenden Datumsfelder müssen ein solches Format haben: "
431
+ "2016-01-01 00:00:00"
432
+
433
+ #: importer.php:628 importer.php:644 importer.php:661 importer.php:677
434
+ msgid "Only for"
435
+ msgstr "Nur für"
436
+
437
+ #: importer.php:628 importer.php:644 importer.php:661 importer.php:677
438
+ msgid "users"
439
+ msgstr "Benutzer"
440
+
441
+ #: importer.php:640
442
+ msgid "Do not activate users"
443
+ msgstr "Benutzer nicht aktivieren"
444
+
445
+ #: importer.php:641
446
+ msgid "Activate users when they are being imported"
447
+ msgstr "Benutzer beim Import aktivieren"
448
+
449
+ #: importer.php:644
450
+ msgid "WP Members"
451
+ msgstr "WP Members"
452
+
453
+ #: importer.php:654
454
+ msgid "Approve users at the same time is being created"
455
+ msgstr "Benutzer zur gelichen Zeit approbieren"
456
+
457
+ #: importer.php:657
458
+ msgid "Do not approve users"
459
+ msgstr "Benutzer nicht approbieren"
460
+
461
+ #: importer.php:658
462
+ msgid "Approve users when they are being imported"
463
+ msgstr "Benutzer beim Import approbieren"
464
+
465
+ #: importer.php:661
466
+ msgid "New User Approve"
467
+ msgstr "Neue Benutzer approbieren"
468
+
469
+ #: importer.php:671
470
+ msgid "Repeated email in different users?"
471
+ msgstr "Wiederhole email bei verschiedenen Benutzern?"
472
+
473
+ #: importer.php:674
474
+ msgid "Not allowed"
475
+ msgstr "Nicht erlaubt"
476
+
477
+ #: importer.php:675
478
+ msgid "Allowed"
479
+ msgstr "Erlaubt"
480
+
481
+ #: importer.php:677
482
+ msgid "Allow Multiple Accounts"
483
+ msgstr "Erlaube mehrfache Accounts"
484
+
485
+ #: importer.php:677
486
+ msgid ""
487
+ "Allow multiple user accounts to be created having the same email address."
488
+ msgstr "Mehrfache Accounts mit der gleichen Emailadresse erlauben."
489
+
490
+ #: importer.php:686
491
+ msgid "WordPress Access Areas is activated"
492
+ msgstr "WordPress Access Areas aktiviert"
493
+
494
+ #: importer.php:688
495
+ msgid "As user of"
496
+ msgstr "Ein Benutzer von"
497
+
498
+ #: importer.php:688
499
+ msgid "WordPress Access Areas"
500
+ msgstr "WordPress Access Areas"
501
+
502
+ #: importer.php:688
503
+ msgid "you can use the Access Areas created"
504
+ msgstr "Verwende erstellte Access Areas"
505
+
506
+ #: importer.php:688 importer.php:938
507
+ msgid "here"
508
+ msgstr "hier "
509
+
510
+ #: importer.php:688
511
+ msgid ""
512
+ "and use this areas in your own CSV file. Please use the column name "
513
+ "<strong>wp-access-areas</strong> and in each row use <strong>the name that "
514
+ "you have used"
515
+ msgstr ""
516
+ "und verwendie sie in deiner CSV Datei. Verwende den Spaltennamen <strong>wp-"
517
+ "access-areas</strong> und in jeder Zeile den <strong>verwendeten Namen"
518
+
519
+ #: importer.php:688
520
+ msgid ", like this ones:"
521
+ msgstr ", so wie hier:"
522
+
523
+ #: importer.php:697
524
+ msgid ""
525
+ "If you leave this cell empty for some user or the access area indicated "
526
+ "doesn't exist, user won't be assigned to any access area. You can choose "
527
+ "more than one area for each user using pads between them in the same row, i."
528
+ "e.: "
529
+ msgstr ""
530
+ "Wenn diese Zelle leer ist oder die angegebene access area nicht existiert, "
531
+ "wird der Benutzer keiner access area zugeordnet. Für jeden Benutzer kann "
532
+ "mehr als eine area gewählt werden, indem in derselben Zeile pads gesetzt "
533
+ "werden, d.h."
534
+
535
+ #: importer.php:704
536
+ msgid "Send mail"
537
+ msgstr "Mail senden"
538
+
539
+ #: importer.php:706
540
+ msgid "Do you wish to send a mail with credentials and other data?"
541
+ msgstr "Möchten Sie eine Mail mit den Zugangsdaten senden?"
542
+
543
+ #: importer.php:706 importer.php:707
544
+ msgid "yes"
545
+ msgstr "ja"
546
+
547
+ #: importer.php:707
548
+ msgid ""
549
+ "Do you wish to send this mail also to users that are being updated? (not "
550
+ "only to the one which are being created)"
551
+ msgstr ""
552
+ "Soll diese Mail auch an Benutzer gesendet werden, die upgedated wurden (also "
553
+ "nicht nur neu angelegte)"
554
+
555
+ #: importer.php:715
556
+ msgid "Start importing"
557
+ msgstr "Import beginnen"
558
+
559
+ #: importer.php:723
560
+ msgid "Please choose a file"
561
+ msgstr "Bitte Datei wählen"
562
+
563
+ #: importer.php:728
564
+ msgid "Please enter a path to the file"
565
+ msgstr "Bitte Pfad zur Datei angeben"
566
+
567
+ #: importer.php:733
568
+ msgid "Please select a role"
569
+ msgstr "Bitte eine Role auswählen"
570
+
571
+ #: importer.php:740
572
+ msgid "Are you sure to delete this file?"
573
+ msgstr "Diese Datei löschen?"
574
+
575
+ #: importer.php:749
576
+ msgid "There were problems deleting the file, please check file permissions"
577
+ msgstr "Problem beim Löschen der Datei, bitte Berechtigungen prüfen"
578
+
579
+ #: importer.php:751
580
+ msgid "File successfully deleted"
581
+ msgstr "Datei erfolgreich gelöscht"
582
+
583
+ #: importer.php:759
584
+ msgid ""
585
+ "Are you sure to delete ALL CSV files uploaded? There can be CSV files from "
586
+ "other plugins."
587
+ msgstr ""
588
+ "Wirklich ALLE CSV-Dateien löschen? Es könnten auch CSV-Dateien von anderen "
589
+ "Plugins dabei sein."
590
+
591
+ #: importer.php:767
592
+ msgid "There were problems deleting the files, please check files permissions"
593
+ msgstr "Problem beim Löschen der Datei, bitte Berechtigungen prüfen"
594
+
595
+ #: importer.php:769
596
+ msgid "Files successfully deleted"
597
+ msgstr "Dateien erfolgreich gelöscht"
598
+
599
+ #: importer.php:794
600
+ msgid "Custom columns loaded"
601
+ msgstr "Benutzerdefinierte Spalten geladen"
602
+
603
+ #: importer.php:798
604
+ msgid "Columns loaded in previous files"
605
+ msgstr "Benutzerdefinierte Spalten von früheren Dateien"
606
+
607
+ #: importer.php:799
608
+ msgid ""
609
+ "(if you load another CSV with different columns, the new ones will replace "
610
+ "this list)"
611
+ msgstr ""
612
+ "(beim Laden einer anderen CSV-Datei mit unterschiedlichen Spalten ersetzen "
613
+ "die neuen Spalten diese Liste)"
614
+
615
+ #: importer.php:808
616
+ msgid "There is no columns loaded yet"
617
+ msgstr "Noch keine Spalten geladen"
618
+
619
+ #: importer.php:823 import-users-from-csv-with-meta.php:202
620
+ msgid "Documentation"
621
+ msgstr "Dokumentation"
622
+
623
+ #: importer.php:827
624
+ msgid "Columns position"
625
+ msgstr "Spaltenposition"
626
+
627
+ #: importer.php:828
628
+ msgid ""
629
+ "(Documents should look like the one presented into screenshot. Remember you "
630
+ "should fill the first two columns with the next values)"
631
+ msgstr ""
632
+ "(Dateien sollten so aussehen wie die im Screenshot. Die ersten beiden "
633
+ "Spalten sollten mit folgenden Werten gefüllt sein)"
634
+
635
+ #: importer.php:831
636
+ msgid "Email"
637
+ msgstr "Email"
638
+
639
+ #: importer.php:833
640
+ msgid ""
641
+ "(The next columns are totally customizable and you can use whatever you "
642
+ "want. All rows must contains same columns)"
643
+ msgstr ""
644
+ "(Die folgenden Spalten sind benutzerdefiniert und können für beliebige "
645
+ "Zwecke verwendet werden. Alle Zeilen müssen jedoch dieselben Spalten haben)"
646
+
647
+ #: importer.php:834
648
+ msgid "(User profile will be adapted to the kind of data you have selected)"
649
+ msgstr "(Benutzerprofile werden entsprechend der gewählten Daten angepasst)"
650
+
651
+ #: importer.php:835
652
+ msgid ""
653
+ "(If you want to disable the extra profile information, please deactivate "
654
+ "this plugin after make the import)"
655
+ msgstr ""
656
+ "(Um die zusätzlichen Profilinformationen inaktiv zu setzen, deaktivieren Sie "
657
+ "bitte dieses Plugin nach dem Import)"
658
+
659
+ #: importer.php:839
660
+ msgid "id"
661
+ msgstr "id"
662
+
663
+ #: importer.php:840
664
+ msgid ""
665
+ "You can use a column called id in order to make inserts or updates of an "
666
+ "user using the ID used by WordPress in the wp_users table. We have two "
667
+ "different cases:"
668
+ msgstr ""
669
+ "Eine Spalte mit der Bezeichnung \"id\" kann verwendet werden, um Einfügen "
670
+ "oder Update eines Benutzers mittels der ID in der wp_users Tabelle zu "
671
+ "steuern. Zwei Möglichkeiten:"
672
+
673
+ #: importer.php:842
674
+ msgid ""
675
+ "If id <strong>doesn't exist in your users table</strong>: user will be "
676
+ "inserted"
677
+ msgstr ""
678
+ "Wenn die id <strong>nicht in der Benutzertabelle existiert</strong>, wird "
679
+ "der Benutzer hinzugefügt."
680
+
681
+ #: importer.php:843
682
+ msgid ""
683
+ "If id <strong>exists</strong>: plugin check if username is the same, if yes, "
684
+ "it will update the data, if not, it ignores the cell to avoid problems"
685
+ msgstr ""
686
+ "Wenn die id <strong>existiert</strong>, prüft das Plugin, ob der username "
687
+ "identisch ist. Wenn ja, werden die Daten aktualisiert, wenn nein, wird die "
688
+ "Zelle ignoriert, um Probleme zu vermeiden."
689
+
690
+ #: importer.php:848
691
+ msgid "Passwords"
692
+ msgstr "Passwörter"
693
+
694
+ #: importer.php:849
695
+ msgid ""
696
+ "A string that contains user passwords. We have different options for this "
697
+ "case:"
698
+ msgstr "Ein String, der Bentuzerpassworte enthält. Mehrere Möglichkeiten:"
699
+
700
+ #: importer.php:851
701
+ msgid ""
702
+ "If you <strong>don't create a column for passwords</strong>: passwords will "
703
+ "be generated automatically"
704
+ msgstr ""
705
+ "Wird <strong>keine Passwortspalte</strong> gesetzt, dann werden die "
706
+ "Passworte automatisch generiert"
707
+
708
+ #: importer.php:852
709
+ msgid ""
710
+ "If you <strong>create a column for passwords</strong>: if cell is empty, "
711
+ "password won't be updated; if cell has a value, it will be used"
712
+ msgstr ""
713
+ "Wird <strong>eine Passwortspalte gesetzt</strong>, dann gilt: Ist der Inhalt "
714
+ "leer, werden Passwörter nicht verändert, enthält sie einen Wert, wird "
715
+ "dieser benutzt"
716
+
717
+ #: importer.php:857
718
+ msgid "WordPress default profile data"
719
+ msgstr "WordPress Standardprofildaten"
720
+
721
+ #: importer.php:858
722
+ msgid ""
723
+ "You can use those labels if you want to set data adapted to the WordPress "
724
+ "default user columns (the ones who use the function"
725
+ msgstr ""
726
+ "Diese Bezeichnungen können verwendet werden, um Daten in den Standardspalten "
727
+ "der WordPress Bneutzerdatei zu setzen (benutzen die Funktion"
728
+
729
+ #: importer.php:860
730
+ msgid ""
731
+ "A string that contains a URL-friendly name for the user. The default is the "
732
+ "user's username."
733
+ msgstr ""
734
+ "String, der einen URL-fähigen Namen für den Benutzer enthält. Normalerweise "
735
+ "der username."
736
+
737
+ #: importer.php:861
738
+ msgid "A string containing the user's URL for the user's web site."
739
+ msgstr "String, der die URL des Benutzers für seine Webseite enthält."
740
+
741
+ #: importer.php:862
742
+ msgid ""
743
+ "A string that will be shown on the site. Defaults to user's username. It is "
744
+ "likely that you will want to change this, for both appearance and security "
745
+ "through obscurity (that is if you don't use and delete the default admin "
746
+ "user)."
747
+ msgstr ""
748
+ "String, der angezeigt wird. Vorgabe ist der username. Sollte geändert "
749
+ "werden, sowohl für das Erscheinungsbild als auch zur Sicherheit durch "
750
+ "Verschleierung (wenn der vorgegebene Adminbenutzer nicht verwendet und "
751
+ "gelöscht wird)."
752
+
753
+ #: importer.php:863
754
+ msgid "The user's nickname, defaults to the user's username."
755
+ msgstr "Nickname des Benutzers, Vorgabe ist der username."
756
+
757
+ #: importer.php:864
758
+ msgid "The user's first name."
759
+ msgstr "Vorname des Benutzers."
760
+
761
+ #: importer.php:865
762
+ msgid "The user's last name."
763
+ msgstr "Nachname des Benutzers."
764
+
765
+ #: importer.php:866
766
+ msgid "A string containing content about the user."
767
+ msgstr "Text mit Informationen über den Benutzer."
768
+
769
+ #: importer.php:867
770
+ msgid "User's Jabber account."
771
+ msgstr "Jabber account des Benutzers."
772
+
773
+ #: importer.php:868
774
+ msgid "User's AOL IM account."
775
+ msgstr "AOL IM account des Benutzers."
776
+
777
+ #: importer.php:869
778
+ msgid "User's Yahoo IM account."
779
+ msgstr "Yahoo IM account des Benutzers."
780
+
781
+ #: importer.php:870
782
+ msgid "Using the WordPress format for this kind of data Y-m-d H:i:s."
783
+ msgstr "Verwende das WordPress-Format für diese Art der Daten Y-m-d H:i:s"
784
+
785
+ #: importer.php:877
786
+ msgid "WooCommerce is activated"
787
+ msgstr "WooCommerce aktiviert"
788
+
789
+ #: importer.php:878
790
+ msgid ""
791
+ "You can use those labels if you want to set data adapted to the WooCommerce "
792
+ "default user columns"
793
+ msgstr ""
794
+ "Diese Bezeichnungen können verwendet werden, um Daten in den Standardspalten "
795
+ "der WooCommerce Bneutzerdatei zu setzen"
796
+
797
+ #: importer.php:906
798
+ msgid "Important notice"
799
+ msgstr "Wichtige Notiz"
800
+
801
+ #: importer.php:907
802
+ msgid ""
803
+ "You can upload as many files as you want, but all must have the same "
804
+ "columns. If you upload another file, the columns will change to the form of "
805
+ "last file uploaded."
806
+ msgstr ""
807
+ "Es können beliebig viele Dateien hochgeladen werden, aber alle müssen die "
808
+ "gleichen Spalten haben. Wenn eine andere Datei hochgeladen wird, werden die "
809
+ "Spalten an die letzte Datei angepasst."
810
+
811
+ #: importer.php:910
812
+ msgid "Any question about it"
813
+ msgstr "Fragen dazu"
814
+
815
+ #: importer.php:913
816
+ msgid "Free support (in WordPress forums):"
817
+ msgstr "kosenloser Support (im WordPress Forum):"
818
+
819
+ #: importer.php:914
820
+ msgid "Premium support (with a quote):"
821
+ msgstr "Premium Support (kostenpflichtig):"
822
+
823
+ #: importer.php:919
824
+ msgid "Example"
825
+ msgstr "Beispiel"
826
+
827
+ #: importer.php:920
828
+ msgid "Download this"
829
+ msgstr "Lade diese"
830
+
831
+ #: importer.php:920
832
+ msgid "file"
833
+ msgstr "Datei"
834
+
835
+ #: importer.php:920
836
+ msgid "to test"
837
+ msgstr "zum Testen"
838
+
839
+ #: importer.php:936 import-users-from-csv-with-meta.php:202
840
+ msgid "Mail options"
841
+ msgstr "Mail Optionen"
842
+
843
+ #: importer.php:938
844
+ msgid "You can set your own SMTP and other mail details"
845
+ msgstr "Eigene SMTP Optionen und andere Details können gesetzt werden"
846
+
847
+ #: importer.php:943
848
+ msgid "WordPress automatic emails users updated"
849
+ msgstr "Automatische WordPress Emails angepasst"
850
+
851
+ #: importer.php:947
852
+ msgid "Send automatic WordPress emails?"
853
+ msgstr "Automatische WordPress Emails senden?"
854
+
855
+ #: importer.php:951
856
+ msgid ""
857
+ "Deactivate WordPress automatic email when an user is updated or his "
858
+ "password is changed"
859
+ msgstr ""
860
+ "Automatische WordPress Emails deaktivieren, wenn ein Benutzer upgedatet oder "
861
+ "sein Passwort geändert wird"
862
+
863
+ #: importer.php:952
864
+ msgid ""
865
+ "Activate WordPress automatic email when an user is updated or his password "
866
+ "is changed"
867
+ msgstr ""
868
+ "Automatische WordPress Emails aktivieren, wenn ein Benutzer upgedatet oder "
869
+ "sein Passwort geändert wird"
870
+
871
+ #: importer.php:954
872
+ msgid ""
873
+ "When you update an user or change his password, WordPress prepare and send "
874
+ "automatic email, you can deactivate it here."
875
+ msgstr ""
876
+ "Beim Update eines Benutzers oder einer Passwortänderung sendet WordPress "
877
+ "automatisch eine Mail. Das kann hier deaktivert werden"
878
+
879
+ #: importer.php:962
880
+ msgid "Customize the email that can be sent when importing users"
881
+ msgstr "Anpassen der Email, die beim Import gesendet wird"
882
+
883
+ #: importer.php:964
884
+ msgid "Mail subject :"
885
+ msgstr "Betreff:"
886
+
887
+ #: importer.php:972
888
+ msgid "username to login"
889
+ msgstr "Loginname"
890
+
891
+ #: importer.php:973
892
+ msgid "user password"
893
+ msgstr "Passwort"
894
+
895
+ #: importer.php:974
896
+ msgid "current site login url"
897
+ msgstr "URL für Login"
898
+
899
+ #: importer.php:975
900
+ msgid "lost password url"
901
+ msgstr "URL für Passwort vergessen"
902
+
903
+ #: importer.php:976
904
+ msgid "password reset url"
905
+ msgstr "URL für Passwort zurücksetzen"
906
+
907
+ #: importer.php:977
908
+ msgid "user email"
909
+ msgstr "Benutzer Email"
910
+
911
+ #: importer.php:978
912
+ msgid ""
913
+ "You can also use any WordPress user standard field or an own metadata, if "
914
+ "you have used it in your CSV. For example, if you have a first_name column, "
915
+ "you could use **first_name** or any other meta_data like **my_custom_meta**"
916
+ msgstr ""
917
+ "Jedes Standardfeld der WordPress Benutzerdatei und jedes eigene Metadatafeld "
918
+ "kann verwendet werden, sofern es in der CSV-Datei enthalten ist. Wenn eine "
919
+ "Spalte first_name vorhanden ist, kann **first_name** verwendet werden oder "
920
+ "irgend ein Metafeld wie zB **my_custom_meta**"
921
+
922
+ #: importer.php:1029
923
+ msgid "Execute an import of users periodically"
924
+ msgstr "Benutzerimport periodisch ausführen"
925
+
926
+ #: importer.php:1035
927
+ msgid "Path of file that are going to be imported"
928
+ msgstr "Pfad zu den Dateien, die importiert werden sollen"
929
+
930
+ #: importer.php:1037 importer.php:1102
931
+ msgid "Insert complete path to the file"
932
+ msgstr "Kompletten Pfad angeben"
933
+
934
+ #: importer.php:1042
935
+ msgid "Period"
936
+ msgstr "Wiederholung"
937
+
938
+ #: importer.php:1045
939
+ msgid "Hourly"
940
+ msgstr "Stündlich"
941
+
942
+ #: importer.php:1046
943
+ msgid "Twicedaily"
944
+ msgstr "Zweimal pro Tag"
945
+
946
+ #: importer.php:1047
947
+ msgid "Daily"
948
+ msgstr "Täglich"
949
+
950
+ #: importer.php:1049
951
+ msgid "How often the event should reoccur?"
952
+ msgstr "Wie oft soll der Import stattfinden?"
953
+
954
+ #: importer.php:1053
955
+ msgid "Activate periodical import?"
956
+ msgstr "Periodischen Import aktivieren?"
957
+
958
+ #: importer.php:1059
959
+ msgid "Send mail when using periodical import?"
960
+ msgstr "Email nach periodischem Import versenden?"
961
+
962
+ #: importer.php:1065
963
+ msgid "Send mail also to users that are being updated?"
964
+ msgstr "Email auch an Benutzer, die adaptiert wurden?"
965
+
966
+ #: importer.php:1071
967
+ msgid "Delete users that are not present in the CSV?"
968
+ msgstr "Benutzer, die nicht in der CSV-Datei enthalten sind, löschen?"
969
+
970
+ #: importer.php:1091
971
+ msgid "Which role would be used to import users?"
972
+ msgstr "Welche Role soll beim Import zugewiesen werden?"
973
+
974
+ #: importer.php:1095
975
+ msgid "Move file after import?"
976
+ msgstr "Datei nach Import verschieben?"
977
+
978
+ #: importer.php:1108
979
+ msgid "Last actions of schedule task"
980
+ msgstr "Letzte zeitgesteuerte Ausführung"
981
+
982
+ #: importer.php:1114
983
+ msgid "Mail sending"
984
+ msgstr "Mailversand"
985
+
986
+ #: importer.php:1115
987
+ msgid ""
988
+ "Please take care: for this option, cron import, mail sending is not "
989
+ "available in this version (if you need it"
990
+ msgstr ""
991
+ "Achtung: Für diiese Option, zeitgesteuerter Import, ist die Funktion "
992
+ "Mailversand in dieser Version nicht verfügbar (wenn sie benötigt wird"
993
+
994
+ #: importer.php:1115
995
+ msgid "talk with us"
996
+ msgstr "kontaktieren Sie uns"
997
+
998
+ #: importer.php:1119
999
+ msgid "Save schedule options"
1000
+ msgstr "Zeitsteuerungsoptionen speichern"
1001
+
1002
+ #: importer.php:1126
1003
+ msgid ""
1004
+ "Are you sure to delete all users that are not present in the CSV? This "
1005
+ "action cannot be undone."
1006
+ msgstr ""
1007
+ "Wirklich alle Benutzer, die nicht in der CSV-Datei enthalten sind, löschen? "
1008
+ "Diese Aktion kann nicht zurückgenommen werden."
1009
+
1010
+ #: importer.php:1149
1011
+ msgid "Do you like it?"
1012
+ msgstr "Gefällt es Dir?"
1013
+
1014
+ #: importer.php:1152
1015
+ msgid "buy me a coffee"
1016
+ msgstr "zahl mir einen Kaffee"
1017
+
1018
+ #: importer.php:1153 importer.php:1173
1019
+ msgid "Hi! we are"
1020
+ msgstr "Hi! Wir sind"
1021
+
1022
+ #: importer.php:1153 importer.php:1173
1023
+ msgid "and"
1024
+ msgstr "und"
1025
+
1026
+ #: importer.php:1153 importer.php:1173
1027
+ msgid "from"
1028
+ msgstr "von"
1029
+
1030
+ #: importer.php:1153 importer.php:1173
1031
+ msgid "developers of this plugin."
1032
+ msgstr "Entwickler dieses Plugins."
1033
+
1034
+ #: importer.php:1154
1035
+ msgid ""
1036
+ "We have been spending many hours to develop this plugin. <br>If you like and "
1037
+ "use this plugin, you can <strong>buy us a cup of coffee</strong>."
1038
+ msgstr ""
1039
+ "Wir haben viele Stunden in die Entwicklung investiert. <br>Wenn es dir "
1040
+ "gefällt, zahl uns <strong>eine Tasse Kaffee</strong>."
1041
+
1042
+ #: importer.php:1158
1043
+ msgid "PayPal – The safer, easier way to pay online."
1044
+ msgstr "PayPal – der sicherere, einfachere Weg, online zu bezahlen."
1045
+
1046
+ #: importer.php:1170
1047
+ msgid "Need help with WordPress or WooCommerce?"
1048
+ msgstr "Brauchst du Hilfe zu WordPress oder WooCommerce?"
1049
+
1050
+ #: importer.php:1174
1051
+ msgid ""
1052
+ "We work everyday with WordPress and WooCommerce, if you need help hire us, "
1053
+ "send us a message to"
1054
+ msgstr ""
1055
+ "Wir arbeiten täglich mit WordPress und WooCommerce, wenn du Hilfe benötigst, "
1056
+ "beauftrage uns, sende eine Nachricht an"
1057
+
1058
+ #: import-users-from-csv-with-meta.php:51
1059
+ #: import-users-from-csv-with-meta.php:198
1060
+ msgid "Welcome to"
1061
+ msgstr "Willkommen bei"
1062
+
1063
+ #: import-users-from-csv-with-meta.php:52
1064
+ #: import-users-from-csv-with-meta.php:195
1065
+ msgid "Welcome,"
1066
+ msgstr "Willkommen,"
1067
+
1068
+ #: import-users-from-csv-with-meta.php:52
1069
+ #: import-users-from-csv-with-meta.php:195
1070
+ msgid "Your data to login in this site is:"
1071
+ msgstr "Deine Daten zum Login sind:"
1072
+
1073
+ #: import-users-from-csv-with-meta.php:52
1074
+ #: import-users-from-csv-with-meta.php:195
1075
+ msgid "URL to login"
1076
+ msgstr "URL zum Login"
1077
+
1078
+ #: import-users-from-csv-with-meta.php:96
1079
+ msgid "Insert users massively (CSV)"
1080
+ msgstr "Massenimport von Benutzers (CSV)"
1081
+
1082
+ #: import-users-from-csv-with-meta.php:97
1083
+ msgid "SMTP Configuration"
1084
+ msgstr "SMTP Konfiguration"
1085
+
1086
+ #: import-users-from-csv-with-meta.php:103
1087
+ #: import-users-from-csv-with-meta.php:202
1088
+ msgid "Donate"
1089
+ msgstr "Spenden"
1090
+
1091
+ #: import-users-from-csv-with-meta.php:104
1092
+ msgid "Premium support"
1093
+ msgstr "Premium Support"
1094
+
1095
+ #: import-users-from-csv-with-meta.php:105
1096
+ msgid "Premium plugins"
1097
+ msgstr "Premium Plugins"
1098
+
1099
+ #: import-users-from-csv-with-meta.php:202
1100
+ msgid "Customs columns loaded"
1101
+ msgstr "Benutzerdefinierte Spalten geladen"
1102
+
1103
+ #: import-users-from-csv-with-meta.php:202
1104
+ msgid "Cron import"
1105
+ msgstr "Zeitgesteuerter Import"
1106
+
1107
+ #: import-users-from-csv-with-meta.php:202
1108
+ msgid "Shop"
1109
+ msgstr "Shop"
1110
+
1111
+ #: import-users-from-csv-with-meta.php:202
1112
+ msgid "Hire an expert"
1113
+ msgstr "Beauftrage einen Experten"
1114
+
1115
+ #: import-users-from-csv-with-meta.php:242
1116
+ msgid "Error, we cannot find the file"
1117
+ msgstr "Fehler, die Datei wurde nicht gefunden"
1118
+
1119
+ #: import-users-from-csv-with-meta.php:286
1120
+ msgid "Unable to write to directory. Is this directory writable by the server?"
1121
+ msgstr ""
1122
+ "Verzeichnis ist nicht beschreibbar. Ist das Verzeichnis durch den Server "
1123
+ "beschreibbar?"
1124
+
1125
+ #: import-users-from-csv-with-meta.php:294
1126
+ msgid "Error, the file"
1127
+ msgstr "Fehler, die Datei"
1128
+
1129
+ #: import-users-from-csv-with-meta.php:294
1130
+ msgid "could not moved to"
1131
+ msgstr "konnte nicht verschoben werden nach"
1132
+
1133
+ #: import-users-from-csv-with-meta.php:323
1134
+ msgid "Mail template updated correctly"
1135
+ msgstr "Mailvorlage korrekt angepasst"
1136
+
1137
+ #: import-users-from-csv-with-meta.php:370
1138
+ msgid "Settings updated correctly"
1139
+ msgstr "Einstellungen korrekt angepasst"
1140
+
1141
+ #: import-users-from-csv-with-meta.php:376
1142
+ msgid "Import cron task starts at"
1143
+ msgstr "Zeitgesteuerter Import beginnt um"
1144
+
1145
+ #: import-users-from-csv-with-meta.php:397
1146
+ msgid "--Finished at"
1147
+ msgstr "--Beendet um"
1148
+
1149
+ #: import-users-from-csv-with-meta.php:506
1150
+ msgid "You are not an adminstrator"
1151
+ msgstr "Du bist kein Administrator"
trunk/languages/import-users-from-csv-with-meta-fr_FR.mo ADDED
Binary file
trunk/languages/import-users-from-csv-with-meta-fr_FR.po ADDED
@@ -0,0 +1,1188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WordPress Blank Pot
2
+ # Copyright (C) 2014 ...
3
+ # This file is distributed under the GNU General Public License v2 or later.
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: WordPress Blank Pot v1.0.0\n"
7
+ "Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
8
+ "POT-Creation-Date: 2016-11-05 10:32+0100\n"
9
+ "PO-Revision-Date: \n"
10
+ "Language-Team: Your Team <translations@example.com>\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
15
+ "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
19
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
20
+ "X-Poedit-Basepath: ..\n"
21
+ "X-Generator: Poedit 1.8.7\n"
22
+ "Last-Translator: FreePixel <contact@freepixel.net>\n"
23
+ "Language: fr_FR\n"
24
+ "X-Poedit-SearchPath-0: .\n"
25
+
26
+ #: smtp.php:26 smtp.php:245
27
+ msgid "Send Test"
28
+ msgstr "Envoyer un courriel de test"
29
+
30
+ #: smtp.php:40
31
+ msgid "Test mail to "
32
+ msgstr "Tester le courriel pour"
33
+
34
+ #: smtp.php:41
35
+ msgid ""
36
+ "This is a test email generated by the Import User From CSV With Meta "
37
+ "WordPress plugin."
38
+ msgstr ""
39
+ "Il s'agit d'un test de courrier électronique généré par l'utilisateur "
40
+ "d'importation de CSV avec l’extension Meta WordPress."
41
+
42
+ #: smtp.php:79
43
+ msgid "Message sent successfully"
44
+ msgstr "Message envoyé avec succès"
45
+
46
+ #: smtp.php:83
47
+ msgid "Test Message Sent"
48
+ msgstr "Message de test envoyé"
49
+
50
+ #: smtp.php:84
51
+ msgid "The result was:"
52
+ msgstr "Le résultat est :"
53
+
54
+ #: smtp.php:86
55
+ msgid "The full debugging output is shown below:"
56
+ msgstr "La sortie de débogage complète est montrée ci-dessous :"
57
+
58
+ #: smtp.php:88
59
+ msgid "The SMTP debugging output is shown below:"
60
+ msgstr "La sortie de débogage SMTP est illustrée ci-dessous :"
61
+
62
+ #: smtp.php:119
63
+ msgid "Import User From CSV With Meta - SMTP server options"
64
+ msgstr ""
65
+ "Importer un utilisateur à partir de CSV avec Meta - Options du serveur SMTP"
66
+
67
+ #: smtp.php:123
68
+ msgid "Global options"
69
+ msgstr "Options globales"
70
+
71
+ #: smtp.php:124
72
+ msgid ""
73
+ "Do you want to use your own SMTP settings for this plugin or the WordPress "
74
+ "settings."
75
+ msgstr ""
76
+ "Voulez-vous utiliser vos propres paramètres SMTP pour cette extension ou les "
77
+ "paramètres WordPress."
78
+
79
+ #: smtp.php:128
80
+ msgid "Settings"
81
+ msgstr "Paramètres"
82
+
83
+ #: smtp.php:131
84
+ msgid "Use plugin SMTP settings"
85
+ msgstr "Utiliser les paramètres SMTP de l’extension"
86
+
87
+ #: smtp.php:133
88
+ msgid "Use this settings to send mail."
89
+ msgstr "Utilisez ces paramètres pour envoyer les courriels."
90
+
91
+ #: smtp.php:135
92
+ msgid "Use WordPress general settings to send mail."
93
+ msgstr "Utilisez les paramètres généraux WordPress pour envoyer les courriels."
94
+
95
+ #: smtp.php:143
96
+ msgid "From Email"
97
+ msgstr "Courriel source de l’envoi"
98
+
99
+ #: smtp.php:145
100
+ msgid ""
101
+ "You can specify the email address that emails should be sent from. If you "
102
+ "leave this blank, the default email will be used."
103
+ msgstr ""
104
+ "Vous pouvez spécifier l'adresse courriel à laquelle les messages doivent "
105
+ "être envoyés. Si vous laissez cette case vide, le courriel admin par défaut "
106
+ "sera utilisé."
107
+
108
+ #: smtp.php:145
109
+ msgid ""
110
+ "<strong>Please Note:</strong> You appear to be using a version of WordPress "
111
+ "prior to 2.3. Please ignore the From Name field and instead enter Name&lt;"
112
+ "email@domain.com&gt; in this field."
113
+ msgstr ""
114
+ "<strong>Remarque :</strong> Vous semblez utiliser une version de WordPress < "
115
+ "2.3. Veuillez ignorer le champ de nom et entrez le nom&lt;email@domaine."
116
+ "com&gt; dans ce champ."
117
+
118
+ #: smtp.php:148
119
+ msgid "From Name"
120
+ msgstr "Nom de l’envoyeur"
121
+
122
+ #: smtp.php:150
123
+ msgid ""
124
+ "You can specify the name that emails should be sent from. If you leave this "
125
+ "blank, the emails will be sent from WordPress."
126
+ msgstr ""
127
+ "Vous pouvez spécifier le nom duquel les courriels doivent être envoyés. Si "
128
+ "vous laissez ce champ vide, les courriels seront envoyés à partir de nom "
129
+ "admin WordPress."
130
+
131
+ #: smtp.php:156 smtp.php:159
132
+ msgid "Mailer"
133
+ msgstr "Mailer"
134
+
135
+ #: smtp.php:161
136
+ msgid "Send emails of this plugin via SMTP."
137
+ msgstr "Envoyez des emails de cette extension via SMTP."
138
+
139
+ #: smtp.php:163
140
+ msgid "Use the PHP mail() function to send emails."
141
+ msgstr "Utilisez la fonction PHP mail() pour envoyer des courriels."
142
+
143
+ #: smtp.php:171 smtp.php:174
144
+ msgid "Return Path"
145
+ msgstr "Chemin de retour"
146
+
147
+ #: smtp.php:176
148
+ msgid "Set the return-path to match the From Email"
149
+ msgstr "Définissez le courriel pour correspondre à De"
150
+
151
+ #: smtp.php:182
152
+ msgid "SMTP Options"
153
+ msgstr "Options SMTP"
154
+
155
+ #: smtp.php:183
156
+ msgid "These options only apply if you have chosen to send mail by SMTP above."
157
+ msgstr ""
158
+ "Ces options s'appliquent uniquement si vous avez choisi d'envoyer des "
159
+ "messages par SMTP ci-dessus."
160
+
161
+ #: smtp.php:187
162
+ msgid "SMTP Host"
163
+ msgstr "Hôte SMTP"
164
+
165
+ #: smtp.php:191
166
+ msgid "SMTP Port"
167
+ msgstr "Port SMTP"
168
+
169
+ #: smtp.php:195 smtp.php:198
170
+ msgid "Encryption"
171
+ msgstr "Chiffrement"
172
+
173
+ #: smtp.php:200
174
+ msgid "No encryption."
175
+ msgstr "Pas de chiffrement."
176
+
177
+ #: smtp.php:202
178
+ msgid "Use SSL encryption."
179
+ msgstr "Utiliser le chiffrage SSL."
180
+
181
+ #: smtp.php:204
182
+ msgid ""
183
+ "Use TLS encryption. This is not the same as STARTTLS. For most servers SSL "
184
+ "is the recommended option."
185
+ msgstr ""
186
+ "Utilisez le chiffrage TLS. Ce n'est pas la même chose que STARTTLS. Pour la "
187
+ "plupart des serveurs l'option SSL est recommandée."
188
+
189
+ #: smtp.php:208
190
+ msgid "Authentication"
191
+ msgstr "Authentification"
192
+
193
+ #: smtp.php:211
194
+ msgid "No: Do not use SMTP authentication."
195
+ msgstr "Non : ne pas utiliser l'authentification SMTP."
196
+
197
+ #: smtp.php:213
198
+ msgid "Yes: Use SMTP authentication."
199
+ msgstr "Oui : utiliser l'authentification SMTP."
200
+
201
+ #: smtp.php:214
202
+ msgid "If this is set to no, the values below are ignored."
203
+ msgstr ""
204
+ "Si cette valeur est définie sur non, les valeurs ci-dessous sont ignorées."
205
+
206
+ #: smtp.php:218 importer.php:830 import-users-from-csv-with-meta.php:52
207
+ #: import-users-from-csv-with-meta.php:195
208
+ msgid "Username"
209
+ msgstr "Nom d’utilisateur"
210
+
211
+ #: smtp.php:222 import-users-from-csv-with-meta.php:195
212
+ msgid "Password"
213
+ msgstr "Mot de passe"
214
+
215
+ #: smtp.php:227
216
+ msgid "Save Changes"
217
+ msgstr "Sauvegarder les changements"
218
+
219
+ #: smtp.php:234
220
+ msgid "Send a Test Email"
221
+ msgstr "Envoyer un courriel de test"
222
+
223
+ #: smtp.php:240
224
+ msgid "To:"
225
+ msgstr "A :"
226
+
227
+ #: smtp.php:242
228
+ msgid ""
229
+ "Type an email address here and then click Send Test to generate a test email."
230
+ msgstr ""
231
+ "Entrez une adresse courriel ici, puis cliquez sur Envoyer un test pour "
232
+ "générer un courriel de test."
233
+
234
+ #: importer.php:60
235
+ msgid "Ready to registers"
236
+ msgstr "Prêt à enregistrer"
237
+
238
+ #: importer.php:61
239
+ msgid "First row represents the form of sheet"
240
+ msgstr "La première rangée représente la forme de la feuille"
241
+
242
+ #: importer.php:88
243
+ msgid "File must contain at least 2 columns: username and email"
244
+ msgstr ""
245
+ "Le fichier doit contenir au moins 2 colonnes : nom d'utilisateur et adresse "
246
+ "courriel"
247
+
248
+ #: importer.php:116
249
+ msgid "Inserting and updating data"
250
+ msgstr "Insertion et mise à jour de données"
251
+
252
+ #: importer.php:118
253
+ msgid "Row"
254
+ msgstr "Rangée"
255
+
256
+ #: importer.php:123
257
+ msgid "Row number"
258
+ msgstr "Numéro de rangée"
259
+
260
+ #: importer.php:123
261
+ msgid "does not have the same columns than the header, we are going to skip"
262
+ msgstr "n’a pas les mêmes colonnes que l'en-tête, nous allons abandonner"
263
+
264
+ #: importer.php:174
265
+ msgid "Problems with ID"
266
+ msgstr "Problèmes avec l’ID"
267
+
268
+ #: importer.php:174
269
+ msgid ""
270
+ "username is not the same in the CSV and in database, we are going to skip."
271
+ msgstr ""
272
+ "nom d'utilisateur n'est pas le même dans le CSV et dans la base de données, "
273
+ "nous allons abandonner."
274
+
275
+ #: importer.php:222
276
+ msgid "User already exists as:"
277
+ msgstr "L'utilisateur existe déjà comme :"
278
+
279
+ #: importer.php:222
280
+ msgid "(in this CSV file is called:"
281
+ msgstr "(dans ce fichier CSV est appelé :"
282
+
283
+ #: importer.php:248
284
+ msgid "Problems with user:"
285
+ msgstr "Problèmes avec l'utilisateur :"
286
+
287
+ #: importer.php:248
288
+ msgid ", we are going to skip. \\r\\nError: "
289
+ msgstr ", nous allons abandonner. \\r\\nErreur : "
290
+
291
+ #: importer.php:368
292
+ msgid "Password has not been changed"
293
+ msgstr "Le mot de passe n'a pas été modifié"
294
+
295
+ #: importer.php:437
296
+ msgid "Process finished you can go"
297
+ msgstr "Processus terminé, vous pouvez aller"
298
+
299
+ #: importer.php:437
300
+ msgid "here to see results"
301
+ msgstr "Ici pour voir les résultats"
302
+
303
+ #: importer.php:452
304
+ msgid "You are not allowed to see this content."
305
+ msgstr "Vous n'êtes pas autorisé à voir ce contenu."
306
+
307
+ #: importer.php:498
308
+ msgid "Click to open/close"
309
+ msgstr "Cliquez pour ouvrir/fermer"
310
+
311
+ #: importer.php:502
312
+ msgid "Old CSV files uploaded"
313
+ msgstr "Anciens fichiers CSV téléchargés"
314
+
315
+ #: importer.php:505
316
+ msgid ""
317
+ "For security reasons you should delete this files, probably they would be "
318
+ "visible in the Internet if a bot or someone discover the URL. You can delete "
319
+ "each file or maybe you want delete all CSV files you have uploaded:"
320
+ msgstr ""
321
+ "Pour des raisons de sécurité, vous devez supprimer ces fichiers, ils "
322
+ "seraient probablement visibles sur Internet si un robot ou quelqu'un "
323
+ "découvre l'URL. Vous pouvez supprimer chaque fichier ou peut-être supprimer "
324
+ "tous les fichiers CSV que vous avez téléchargés :"
325
+
326
+ #: importer.php:506
327
+ msgid "Delete all CSV files uploaded"
328
+ msgstr "Supprimer tous les fichiers CSV téléchargés"
329
+
330
+ #: importer.php:516
331
+ msgid "Delete"
332
+ msgstr "Supprimer"
333
+
334
+ #: importer.php:525
335
+ msgid ""
336
+ "File must contain at least <strong>2 columns: username and email</strong>. "
337
+ "These should be the first two columns and it should be placed <strong>in "
338
+ "this order: username and email</strong>. If there are more columns, this "
339
+ "plugin will manage it automatically."
340
+ msgstr ""
341
+ "Le fichier doit contenir au moins <strong>2 colonnes : nom d'utilisateur et "
342
+ "courriel</strong>. Ceux-ci doivent être les deux premières colonnes et il "
343
+ "doivent être placé <strong>dans cet ordre : nom d'utilisateur et courriel</"
344
+ "strong>. S'il y a plus de colonnes, cette extension va les gérer "
345
+ "automatiquement."
346
+
347
+ #: importer.php:526
348
+ msgid ""
349
+ "Please, read carefully how <strong>passwords are managed</strong> and also "
350
+ "take note about capitalization, this plugin is <strong>case sensitive</"
351
+ "strong>."
352
+ msgstr ""
353
+ "Merci de lire attentivement comment <strong>les mots de passe sont gérés</"
354
+ "strong> et prenez également note des majuscules, cette extension est "
355
+ "<strong>sensible à la casse</strong>."
356
+
357
+ #: importer.php:529 import-users-from-csv-with-meta.php:96
358
+ #: import-users-from-csv-with-meta.php:202
359
+ msgid "Import users from CSV"
360
+ msgstr "Importer des utilisateurs à partir de CSV"
361
+
362
+ #: importer.php:539
363
+ msgid "Update existing users?"
364
+ msgstr "Mettre à jour les utilisateurs existants ?"
365
+
366
+ #: importer.php:542 importer.php:571
367
+ msgid "Yes"
368
+ msgstr "Oui"
369
+
370
+ #: importer.php:543 importer.php:570
371
+ msgid "No"
372
+ msgstr "Non"
373
+
374
+ #: importer.php:549 importer.php:1077
375
+ msgid "Role"
376
+ msgstr "Rôle"
377
+
378
+ #: importer.php:562
379
+ msgid ""
380
+ "If you choose more than one role, the roles would be assigned correctly but "
381
+ "you should use some plugin like <a href=\"https://wordpress.org/plugins/user-"
382
+ "role-editor/\">User Role Editor</a> to manage them."
383
+ msgstr ""
384
+ "Si vous choisissez plus d'un rôle, les rôles seront attribués correctement, "
385
+ "mais vous devriez utiliser une extension comme <a href=\"https://wordpress."
386
+ "org/plugins/user-role-editor/\">User Role Editor</a> pour les gérer."
387
+
388
+ #: importer.php:567
389
+ msgid "Update roles for existing users?"
390
+ msgstr "Mise à jour des rôles pour les utilisateurs existants ?"
391
+
392
+ #: importer.php:577
393
+ msgid "CSV file <span class=\"description\">(required)</span></label>"
394
+ msgstr "Fichier CSV <em>(requis)</em>"
395
+
396
+ #: importer.php:581
397
+ msgid "<em>or you can choose directly a file from your host,"
398
+ msgstr "<em>ou vous pouvez choisir directement un fichier de votre hôte,"
399
+
400
+ #: importer.php:581 importer.php:585
401
+ msgid "click here"
402
+ msgstr "cliquer ici"
403
+
404
+ #: importer.php:584 importer.php:1038 importer.php:1103
405
+ msgid "You have to introduce the path to file, i.e.:"
406
+ msgstr "Vous devez saisir le chemin d'accès au fichier, par exemple :"
407
+
408
+ #: importer.php:585
409
+ msgid "or you can upload it directly from your PC"
410
+ msgstr "ou vous pouvez le télécharger directement depuis votre ordinateur"
411
+
412
+ #: importer.php:591
413
+ msgid "What should the plugin do with empty cells?"
414
+ msgstr "Que doit faire l’extension avec les cellules vides ?"
415
+
416
+ #: importer.php:594
417
+ msgid "Leave the old value for this metadata"
418
+ msgstr "Laisser l'ancienne valeur de ces métadonnées"
419
+
420
+ #: importer.php:595
421
+ msgid "Delete the metadata"
422
+ msgstr "Supprimer les métadonnées"
423
+
424
+ #: importer.php:621
425
+ msgid "BuddyPress users"
426
+ msgstr "Utilisateurs BuddyPress"
427
+
428
+ #: importer.php:622
429
+ msgid ""
430
+ "You can insert any profile from BuddyPress using his name as header. Plugin "
431
+ "will check, before import, which fields are defined in BuddyPress and will "
432
+ "assign it in the update. You can use this fields:"
433
+ msgstr ""
434
+ "Vous pouvez insérer n'importe quel profil de BuddyPress en utilisant son nom "
435
+ "comme en-tête. L’extension vérifiera, avant l'importation, quels champs sont "
436
+ "définis dans BuddyPress et l'affectera dans la mise à jour. Vous pouvez "
437
+ "utiliser les champs suivants :"
438
+
439
+ #: importer.php:626
440
+ msgid ""
441
+ "Remember that all date fields have to be imported using a format like this: "
442
+ "2016-01-01 00:00:00"
443
+ msgstr ""
444
+ "N'oubliez pas que tous les champs de date doivent être importés avec un "
445
+ "format comme celui-ci : 2016-01-01 00:00:00"
446
+
447
+ #: importer.php:628 importer.php:644 importer.php:661 importer.php:677
448
+ msgid "Only for"
449
+ msgstr "Seulement pour"
450
+
451
+ #: importer.php:628 importer.php:644 importer.php:661 importer.php:677
452
+ msgid "users"
453
+ msgstr "utilisateurs"
454
+
455
+ #: importer.php:640
456
+ msgid "Do not activate users"
457
+ msgstr "Ne pas activer les utilisateurs"
458
+
459
+ #: importer.php:641
460
+ msgid "Activate users when they are being imported"
461
+ msgstr "Activer les utilisateurs lors de leur importation"
462
+
463
+ #: importer.php:644
464
+ msgid "WP Members"
465
+ msgstr "Membres WP"
466
+
467
+ #: importer.php:654
468
+ msgid "Approve users at the same time is being created"
469
+ msgstr "Approuver les utilisateurs en même temps que leur création"
470
+
471
+ #: importer.php:657
472
+ msgid "Do not approve users"
473
+ msgstr "Ne pas approuver les utilisateurs"
474
+
475
+ #: importer.php:658
476
+ msgid "Approve users when they are being imported"
477
+ msgstr "Approuver les utilisateurs lors de leur importation"
478
+
479
+ #: importer.php:661
480
+ msgid "New User Approve"
481
+ msgstr "Nouvel utilisateur approuvé"
482
+
483
+ #: importer.php:671
484
+ msgid "Repeated email in different users?"
485
+ msgstr "Courriel répété dans différents utilisateurs ?"
486
+
487
+ #: importer.php:674
488
+ msgid "Not allowed"
489
+ msgstr "Non permis"
490
+
491
+ #: importer.php:675
492
+ msgid "Allowed"
493
+ msgstr "Permis"
494
+
495
+ #: importer.php:677
496
+ msgid "Allow Multiple Accounts"
497
+ msgstr "Autoriser plusieurs comptes"
498
+
499
+ #: importer.php:677
500
+ msgid ""
501
+ "Allow multiple user accounts to be created having the same email address."
502
+ msgstr ""
503
+ "Autoriser la création de plusieurs comptes d'utilisateurs ayant la même "
504
+ "adresse courriel."
505
+
506
+ #: importer.php:686
507
+ msgid "WordPress Access Areas is activated"
508
+ msgstr "Les zones d'accès WordPress sont activées"
509
+
510
+ #: importer.php:688
511
+ msgid "As user of"
512
+ msgstr "En tant qu'utilisateur de"
513
+
514
+ #: importer.php:688
515
+ msgid "WordPress Access Areas"
516
+ msgstr "Zones d'accès WordPress"
517
+
518
+ #: importer.php:688
519
+ msgid "you can use the Access Areas created"
520
+ msgstr "vous pouvez utiliser les zones d'accès créées"
521
+
522
+ #: importer.php:688 importer.php:938
523
+ msgid "here"
524
+ msgstr "par ici"
525
+
526
+ #: importer.php:688
527
+ msgid ""
528
+ "and use this areas in your own CSV file. Please use the column name "
529
+ "<strong>wp-access-areas</strong> and in each row use <strong>the name that "
530
+ "you have used"
531
+ msgstr ""
532
+ "et utilisez ces zones dans votre propre fichier CSV. Veuillez utiliser le "
533
+ "nom de la colonne <strong>wp-access-areas</strong> et utiliser dans chaque "
534
+ "ligne <strong>le nom que vous avez utilisé"
535
+
536
+ #: importer.php:688
537
+ msgid ", like this ones:"
538
+ msgstr ", comme celui-ci :"
539
+
540
+ #: importer.php:697
541
+ msgid ""
542
+ "If you leave this cell empty for some user or the access area indicated "
543
+ "doesn't exist, user won't be assigned to any access area. You can choose "
544
+ "more than one area for each user using pads between them in the same row, i."
545
+ "e.: "
546
+ msgstr ""
547
+ "Si vous laissez cette cellule vide pour un utilisateur ou si la zone d'accès "
548
+ "indiquée n'existe pas, l'utilisateur ne sera affecté à aucune zone d'accès. "
549
+ "Vous pouvez choisir plus d'une zone pour chaque utilisateur en utilisant des "
550
+ "pads entre eux dans la même rangée, par exemple : "
551
+
552
+ #: importer.php:704
553
+ msgid "Send mail"
554
+ msgstr "Envoyer le courriel"
555
+
556
+ #: importer.php:706
557
+ msgid "Do you wish to send a mail with credentials and other data?"
558
+ msgstr ""
559
+ "Voulez-vous envoyer un courriel avec des informations d'identification et "
560
+ "d'autres données ?"
561
+
562
+ #: importer.php:706 importer.php:707
563
+ msgid "yes"
564
+ msgstr "oui"
565
+
566
+ #: importer.php:707
567
+ msgid ""
568
+ "Do you wish to send this mail also to users that are being updated? (not "
569
+ "only to the one which are being created)"
570
+ msgstr ""
571
+ "Voulez-vous envoyer ce courriel également aux utilisateurs qui sont mis à "
572
+ "jour ? (et pas seulement à ceux qui sont créés)"
573
+
574
+ #: importer.php:715
575
+ msgid "Start importing"
576
+ msgstr "Démarrer l’importation"
577
+
578
+ #: importer.php:723
579
+ msgid "Please choose a file"
580
+ msgstr "Veuillez choisir un fichier"
581
+
582
+ #: importer.php:728
583
+ msgid "Please enter a path to the file"
584
+ msgstr "Chemin d'accès au fichier"
585
+
586
+ #: importer.php:733
587
+ msgid "Please select a role"
588
+ msgstr "Veuillez sélectionner un rôle"
589
+
590
+ #: importer.php:740
591
+ msgid "Are you sure to delete this file?"
592
+ msgstr "Voulez-vous vraiment supprimer ce fichier ?"
593
+
594
+ #: importer.php:749
595
+ msgid "There were problems deleting the file, please check file permissions"
596
+ msgstr ""
597
+ "Problèmes pour supprimer le fichier, merci de vérifier les autorisations du "
598
+ "fichier"
599
+
600
+ #: importer.php:751
601
+ msgid "File successfully deleted"
602
+ msgstr "Fichier supprimé avec succès"
603
+
604
+ #: importer.php:759
605
+ msgid ""
606
+ "Are you sure to delete ALL CSV files uploaded? There can be CSV files from "
607
+ "other plugins."
608
+ msgstr ""
609
+ "Voulez-vous vraiment supprimer tous les fichiers CSV téléchargés ? Il peut y "
610
+ "avoir des fichiers CSV à partir d'autres extensions."
611
+
612
+ #: importer.php:767
613
+ msgid "There were problems deleting the files, please check files permissions"
614
+ msgstr "Des problèmes ont été rencontrés lors de la suppression des fichiers."
615
+
616
+ #: importer.php:769
617
+ msgid "Files successfully deleted"
618
+ msgstr "Fichiers supprimés avec succès"
619
+
620
+ #: importer.php:794
621
+ msgid "Custom columns loaded"
622
+ msgstr "Colonnes personnalisées"
623
+
624
+ #: importer.php:798
625
+ msgid "Columns loaded in previous files"
626
+ msgstr "Colonnes chargées dans des fichiers précédents"
627
+
628
+ #: importer.php:799
629
+ msgid ""
630
+ "(if you load another CSV with different columns, the new ones will replace "
631
+ "this list)"
632
+ msgstr ""
633
+ "(Si vous chargez un autre CSV avec des colonnes différentes, les nouvelles "
634
+ "remplacent cette liste)"
635
+
636
+ #: importer.php:808
637
+ msgid "There is no columns loaded yet"
638
+ msgstr "Il n'y a pas de colonnes chargées"
639
+
640
+ #: importer.php:823 import-users-from-csv-with-meta.php:202
641
+ msgid "Documentation"
642
+ msgstr "Documentation"
643
+
644
+ #: importer.php:827
645
+ msgid "Columns position"
646
+ msgstr "Position des colonnes"
647
+
648
+ #: importer.php:828
649
+ msgid ""
650
+ "(Documents should look like the one presented into screenshot. Remember you "
651
+ "should fill the first two columns with the next values)"
652
+ msgstr ""
653
+ "(Les documents doivent ressembler à ceux présentés dans la capture d'écran. "
654
+ "N'oubliez pas que vous devriez remplir les deux premières colonnes avec les "
655
+ "valeurs suivantes)"
656
+
657
+ #: importer.php:831
658
+ msgid "Email"
659
+ msgstr "Courriel"
660
+
661
+ #: importer.php:833
662
+ msgid ""
663
+ "(The next columns are totally customizable and you can use whatever you "
664
+ "want. All rows must contains same columns)"
665
+ msgstr ""
666
+ "(Les colonnes suivantes sont totalement personnalisables et vous pouvez "
667
+ "utiliser ce que vous voulez. Toutes les lignes doivent contenir les mêmes "
668
+ "colonnes)"
669
+
670
+ #: importer.php:834
671
+ msgid "(User profile will be adapted to the kind of data you have selected)"
672
+ msgstr ""
673
+ "(Le profil utilisateur sera adapté au type de données que vous avez "
674
+ "sélectionné)"
675
+
676
+ #: importer.php:835
677
+ msgid ""
678
+ "(If you want to disable the extra profile information, please deactivate "
679
+ "this plugin after make the import)"
680
+ msgstr ""
681
+ "(Si vous souhaitez désactiver les informations de profil supplémentaires, "
682
+ "veuillez désactiver cette extension après avoir fait l'importation)"
683
+
684
+ #: importer.php:839
685
+ msgid "id"
686
+ msgstr "ID"
687
+
688
+ #: importer.php:840
689
+ msgid ""
690
+ "You can use a column called id in order to make inserts or updates of an "
691
+ "user using the ID used by WordPress in the wp_users table. We have two "
692
+ "different cases:"
693
+ msgstr ""
694
+ "Vous pouvez utiliser une colonne appelée ID pour faire des insertions ou des "
695
+ "mises à jour d'un utilisateur utilisant l'ID utilisé par WordPress dans la "
696
+ "table wp_users. Nous avons deux cas différents :"
697
+
698
+ #: importer.php:842
699
+ msgid ""
700
+ "If id <strong>doesn't exist in your users table</strong>: user will be "
701
+ "inserted"
702
+ msgstr ""
703
+ "Si l’ID <strong>n'existe pas dans la table des utilisateurs</strong> : "
704
+ "l'utilisateur sera inséré"
705
+
706
+ #: importer.php:843
707
+ msgid ""
708
+ "If id <strong>exists</strong>: plugin check if username is the same, if yes, "
709
+ "it will update the data, if not, it ignores the cell to avoid problems"
710
+ msgstr ""
711
+ "Si l’ID <strong>existe</strong> : l’extension va vérifier si le nom "
712
+ "d’utilisateur est le même, si oui, il va mettre à jour les données, si non, "
713
+ "il ignore la cellule pour éviter les problèmes"
714
+
715
+ #: importer.php:848
716
+ msgid "Passwords"
717
+ msgstr "Mots de passe"
718
+
719
+ #: importer.php:849
720
+ msgid ""
721
+ "A string that contains user passwords. We have different options for this "
722
+ "case:"
723
+ msgstr ""
724
+ "Chaîne contenant des mots de passe utilisateur. Nous avons différentes "
725
+ "options pour ce cas :"
726
+
727
+ #: importer.php:851
728
+ msgid ""
729
+ "If you <strong>don't create a column for passwords</strong>: passwords will "
730
+ "be generated automatically"
731
+ msgstr ""
732
+ "Si vous <strong>ne créez pas de colonne pour les mots de passe</strong> : "
733
+ "les mots de passe seront générés automatiquement"
734
+
735
+ #: importer.php:852
736
+ msgid ""
737
+ "If you <strong>create a column for passwords</strong>: if cell is empty, "
738
+ "password won't be updated; if cell has a value, it will be used"
739
+ msgstr ""
740
+ "Si vous <strong>créez une colonne pour les mots de passe</strong> : si la "
741
+ "cellule est vide, le mot de passe ne sera pas mis à jour ; Si la cellule a "
742
+ "une valeur, elle sera utilisée"
743
+
744
+ #: importer.php:857
745
+ msgid "WordPress default profile data"
746
+ msgstr "Données de profil par défaut de WordPress"
747
+
748
+ #: importer.php:858
749
+ msgid ""
750
+ "You can use those labels if you want to set data adapted to the WordPress "
751
+ "default user columns (the ones who use the function"
752
+ msgstr ""
753
+ "Vous pouvez utiliser ces étiquettes si vous souhaitez définir des données "
754
+ "adaptées aux colonnes utilisateur par défaut de WordPress (celles qui "
755
+ "utilisent la fonction"
756
+
757
+ #: importer.php:860
758
+ msgid ""
759
+ "A string that contains a URL-friendly name for the user. The default is the "
760
+ "user's username."
761
+ msgstr ""
762
+ "Chaîne contenant un nom familier pour l'utilisateur. La valeur par défaut "
763
+ "est le nom d'utilisateur de l'utilisateur."
764
+
765
+ #: importer.php:861
766
+ msgid "A string containing the user's URL for the user's web site."
767
+ msgstr ""
768
+ "Chaîne contenant l'URL de l'utilisateur pour le site web de l'utilisateur."
769
+
770
+ #: importer.php:862
771
+ msgid ""
772
+ "A string that will be shown on the site. Defaults to user's username. It is "
773
+ "likely that you will want to change this, for both appearance and security "
774
+ "through obscurity (that is if you don't use and delete the default admin "
775
+ "user)."
776
+ msgstr ""
777
+ "La chaîne qui sera affichée sur le site. Par défaut, le nom d'utilisateur de "
778
+ "l'utilisateur. Il est probable que vous voudrez changer cela, à la fois pour "
779
+ "l'aspect et la sécurité par masquage (c'est-à-dire si vous n'utilisez pas et "
780
+ "ne supprimez pas l'utilisateur admin par défaut)."
781
+
782
+ #: importer.php:863
783
+ msgid "The user's nickname, defaults to the user's username."
784
+ msgstr ""
785
+ "Le pseudonyme de l'utilisateur, par défaut, est le nom d'utilisateur de "
786
+ "l'utilisateur."
787
+
788
+ #: importer.php:864
789
+ msgid "The user's first name."
790
+ msgstr "Prénom de l'utilisateur."
791
+
792
+ #: importer.php:865
793
+ msgid "The user's last name."
794
+ msgstr "Nom de l'utilisateur."
795
+
796
+ #: importer.php:866
797
+ msgid "A string containing content about the user."
798
+ msgstr "Chaîne contenant du contenu sur l'utilisateur."
799
+
800
+ #: importer.php:867
801
+ msgid "User's Jabber account."
802
+ msgstr "Compte Jabber de l'utilisateur."
803
+
804
+ #: importer.php:868
805
+ msgid "User's AOL IM account."
806
+ msgstr "Compte AOL IM de l'utilisateur."
807
+
808
+ #: importer.php:869
809
+ msgid "User's Yahoo IM account."
810
+ msgstr "Compte Yahoo IM de l'utilisateur."
811
+
812
+ #: importer.php:870
813
+ msgid "Using the WordPress format for this kind of data Y-m-d H:i:s."
814
+ msgstr "Utilisation du format WordPress pour ce type de données Y-m-d H:i:s."
815
+
816
+ #: importer.php:877
817
+ msgid "WooCommerce is activated"
818
+ msgstr "WooCommerce est activé"
819
+
820
+ #: importer.php:878
821
+ msgid ""
822
+ "You can use those labels if you want to set data adapted to the WooCommerce "
823
+ "default user columns"
824
+ msgstr ""
825
+ "Vous pouvez utiliser ces étiquettes si vous souhaitez définir des données "
826
+ "adaptées aux colonnes utilisateur WooCommerce par défaut"
827
+
828
+ #: importer.php:906
829
+ msgid "Important notice"
830
+ msgstr "Avis important"
831
+
832
+ #: importer.php:907
833
+ msgid ""
834
+ "You can upload as many files as you want, but all must have the same "
835
+ "columns. If you upload another file, the columns will change to the form of "
836
+ "last file uploaded."
837
+ msgstr ""
838
+ "Vous pouvez télécharger autant de fichiers que vous voulez, mais tous "
839
+ "doivent avoir les mêmes colonnes. Si vous téléchargez un autre fichier, les "
840
+ "colonnes changent dans la forme du dernier fichier téléchargé."
841
+
842
+ #: importer.php:910
843
+ msgid "Any question about it"
844
+ msgstr "Toute question à ce sujet"
845
+
846
+ #: importer.php:913
847
+ msgid "Free support (in WordPress forums):"
848
+ msgstr "Support gratuit (dans les forums WordPress) :"
849
+
850
+ #: importer.php:914
851
+ msgid "Premium support (with a quote):"
852
+ msgstr "Assistance Premium (avec un devis) :"
853
+
854
+ #: importer.php:919
855
+ msgid "Example"
856
+ msgstr "Exemple"
857
+
858
+ #: importer.php:920
859
+ msgid "Download this"
860
+ msgstr "Télécharger"
861
+
862
+ #: importer.php:920
863
+ msgid "file"
864
+ msgstr "fichier"
865
+
866
+ #: importer.php:920
867
+ msgid "to test"
868
+ msgstr "pour tester"
869
+
870
+ #: importer.php:936 import-users-from-csv-with-meta.php:202
871
+ msgid "Mail options"
872
+ msgstr "Options de courriel"
873
+
874
+ #: importer.php:938
875
+ msgid "You can set your own SMTP and other mail details"
876
+ msgstr ""
877
+ "Vous pouvez définir <strong>votre propre SMTP</strong> et d'autres détails "
878
+ "de courriel"
879
+
880
+ #: importer.php:943
881
+ msgid "WordPress automatic emails users updated"
882
+ msgstr "Courriels automatiques pour les mises à jour d’utilisateurs"
883
+
884
+ #: importer.php:947
885
+ msgid "Send automatic WordPress emails?"
886
+ msgstr "Envoyer des courriels automatiques WordPress ?"
887
+
888
+ #: importer.php:951
889
+ msgid ""
890
+ "Deactivate WordPress automatic email when an user is updated or his "
891
+ "password is changed"
892
+ msgstr ""
893
+ "Désactiver le courriel automatique lorsqu'un utilisateur est mis à jour ou "
894
+ "que son mot de passe est modifié"
895
+
896
+ #: importer.php:952
897
+ msgid ""
898
+ "Activate WordPress automatic email when an user is updated or his password "
899
+ "is changed"
900
+ msgstr ""
901
+ "Activer le courriel automatique quand un utilisateur est mis à jour ou son "
902
+ "mot de passe est changé"
903
+
904
+ #: importer.php:954
905
+ msgid ""
906
+ "When you update an user or change his password, WordPress prepare and send "
907
+ "automatic email, you can deactivate it here."
908
+ msgstr ""
909
+ "Lorsque vous mettez à jour un utilisateur ou modifiez son mot de passe, "
910
+ "WordPress prépare et envoie un courrier électronique automatique, vous "
911
+ "pouvez le désactiver ici."
912
+
913
+ #: importer.php:962
914
+ msgid "Customize the email that can be sent when importing users"
915
+ msgstr ""
916
+ "Personnaliser le courriel qui peut être envoyé lors de l'importation "
917
+ "d'utilisateurs"
918
+
919
+ #: importer.php:964
920
+ msgid "Mail subject :"
921
+ msgstr "Sujet du courriel :"
922
+
923
+ #: importer.php:972
924
+ msgid "username to login"
925
+ msgstr "nom d'utilisateur pour ce connecter"
926
+
927
+ #: importer.php:973
928
+ msgid "user password"
929
+ msgstr "mot de passe utilisateur"
930
+
931
+ #: importer.php:974
932
+ msgid "current site login url"
933
+ msgstr "URL actuelle de connexion au site"
934
+
935
+ #: importer.php:975
936
+ msgid "lost password url"
937
+ msgstr "URL de mot de passe perdu"
938
+
939
+ #: importer.php:976
940
+ msgid "password reset url"
941
+ msgstr "URL de réinitialisation du mot de passe"
942
+
943
+ #: importer.php:977
944
+ msgid "user email"
945
+ msgstr "courriel utilisateur"
946
+
947
+ #: importer.php:978
948
+ msgid ""
949
+ "You can also use any WordPress user standard field or an own metadata, if "
950
+ "you have used it in your CSV. For example, if you have a first_name column, "
951
+ "you could use **first_name** or any other meta_data like **my_custom_meta**"
952
+ msgstr ""
953
+ "Vous pouvez également utiliser n'importe quel champ standard d'utilisateur "
954
+ "WordPress ou une méta-donnée, si vous l'avez utilisé dans votre CSV. Par "
955
+ "exemple, si vous avez une colonne first_name, vous pouvez utiliser ** "
956
+ "first_name ** ou tout autre meta_data comme ** my_custom_meta **"
957
+
958
+ #: importer.php:1029
959
+ msgid "Execute an import of users periodically"
960
+ msgstr "Exécuter une importation d'utilisateurs périodiquement"
961
+
962
+ #: importer.php:1035
963
+ msgid "Path of file that are going to be imported"
964
+ msgstr "Chemin du fichier qui va être importé"
965
+
966
+ #: importer.php:1037 importer.php:1102
967
+ msgid "Insert complete path to the file"
968
+ msgstr "Insérer le chemin d'accès complet au fichier"
969
+
970
+ #: importer.php:1042
971
+ msgid "Period"
972
+ msgstr "Période"
973
+
974
+ #: importer.php:1045
975
+ msgid "Hourly"
976
+ msgstr "Toutes les heures"
977
+
978
+ #: importer.php:1046
979
+ msgid "Twicedaily"
980
+ msgstr "Deux fois par jour"
981
+
982
+ #: importer.php:1047
983
+ msgid "Daily"
984
+ msgstr "Quotidien"
985
+
986
+ #: importer.php:1049
987
+ msgid "How often the event should reoccur?"
988
+ msgstr "À quelle fréquence l’importation doit se produire ?"
989
+
990
+ #: importer.php:1053
991
+ msgid "Activate periodical import?"
992
+ msgstr "Activer l'importation périodique ?"
993
+
994
+ #: importer.php:1059
995
+ msgid "Send mail when using periodical import?"
996
+ msgstr "Envoyer un courriel lors de l'importation périodique ?"
997
+
998
+ #: importer.php:1065
999
+ msgid "Send mail also to users that are being updated?"
1000
+ msgstr "Envoyer également aux utilisateurs qui sont mis à jour ?"
1001
+
1002
+ #: importer.php:1071
1003
+ msgid "Delete users that are not present in the CSV?"
1004
+ msgstr "Supprimer les utilisateurs qui ne sont pas présents dans le CSV ?"
1005
+
1006
+ #: importer.php:1091
1007
+ msgid "Which role would be used to import users?"
1008
+ msgstr "Quel rôle serait utilisé pour importer des utilisateurs ?"
1009
+
1010
+ #: importer.php:1095
1011
+ msgid "Move file after import?"
1012
+ msgstr "Déplacer le fichier après l'importation ?"
1013
+
1014
+ #: importer.php:1108
1015
+ msgid "Last actions of schedule task"
1016
+ msgstr "Dernières actions de la tâche programmée"
1017
+
1018
+ #: importer.php:1114
1019
+ msgid "Mail sending"
1020
+ msgstr "Envoi automatisé"
1021
+
1022
+ #: importer.php:1115
1023
+ msgid ""
1024
+ "Please take care: for this option, cron import, mail sending is not "
1025
+ "available in this version (if you need it"
1026
+ msgstr ""
1027
+ "Veuillez prendre note : pour l’option d’importation automatique, l'envoi de "
1028
+ "courrier n'est pas disponible dans cette version (si vous en avez besoin"
1029
+
1030
+ #: importer.php:1115
1031
+ msgid "talk with us"
1032
+ msgstr "parlez avec nous"
1033
+
1034
+ #: importer.php:1119
1035
+ msgid "Save schedule options"
1036
+ msgstr "Enregistrer les options de planification"
1037
+
1038
+ #: importer.php:1126
1039
+ msgid ""
1040
+ "Are you sure to delete all users that are not present in the CSV? This "
1041
+ "action cannot be undone."
1042
+ msgstr ""
1043
+ "Êtes-vous sûr de supprimer tous les utilisateurs qui ne sont pas présents "
1044
+ "dans le CSV ? Cette action ne peut pas être annulée."
1045
+
1046
+ #: importer.php:1149
1047
+ msgid "Do you like it?"
1048
+ msgstr "Vous aimez cette extension ?"
1049
+
1050
+ #: importer.php:1152
1051
+ msgid "buy me a coffee"
1052
+ msgstr "payez moi un café"
1053
+
1054
+ #: importer.php:1153 importer.php:1173
1055
+ msgid "Hi! we are"
1056
+ msgstr "Bonjour ! Nous sommes"
1057
+
1058
+ #: importer.php:1153 importer.php:1173
1059
+ msgid "and"
1060
+ msgstr "et"
1061
+
1062
+ #: importer.php:1153 importer.php:1173
1063
+ msgid "from"
1064
+ msgstr "de"
1065
+
1066
+ #: importer.php:1153 importer.php:1173
1067
+ msgid "developers of this plugin."
1068
+ msgstr "développeurs de cette extension."
1069
+
1070
+ #: importer.php:1154
1071
+ msgid ""
1072
+ "We have been spending many hours to develop this plugin. <br>If you like and "
1073
+ "use this plugin, you can <strong>buy us a cup of coffee</strong>."
1074
+ msgstr ""
1075
+ "Nous avons passé plusieurs heures à développer cette extension. <br>Si vous "
1076
+ "aimez et utilisez cette extension, vous pourriez au moins <strong>nous payer "
1077
+ "un café</strong>."
1078
+
1079
+ #: importer.php:1158
1080
+ msgid "PayPal – The safer, easier way to pay online."
1081
+ msgstr "PayPal - La manière la plus sûre et la plus simple de payer en ligne."
1082
+
1083
+ #: importer.php:1170
1084
+ msgid "Need help with WordPress or WooCommerce?"
1085
+ msgstr "Besoin d'aide avec WordPress ou WooCommerce ?"
1086
+
1087
+ #: importer.php:1174
1088
+ msgid ""
1089
+ "We work everyday with WordPress and WooCommerce, if you need help hire us, "
1090
+ "send us a message to"
1091
+ msgstr ""
1092
+ "Nous travaillons tous les jours avec WordPress et WooCommerce, si vous avez "
1093
+ "besoin d'aide, envoyez-nous un message à"
1094
+
1095
+ #: import-users-from-csv-with-meta.php:51
1096
+ #: import-users-from-csv-with-meta.php:198
1097
+ msgid "Welcome to"
1098
+ msgstr "Bienvenue à"
1099
+
1100
+ #: import-users-from-csv-with-meta.php:52
1101
+ #: import-users-from-csv-with-meta.php:195
1102
+ msgid "Welcome,"
1103
+ msgstr "Bienvenue,"
1104
+
1105
+ #: import-users-from-csv-with-meta.php:52
1106
+ #: import-users-from-csv-with-meta.php:195
1107
+ msgid "Your data to login in this site is:"
1108
+ msgstr "Vos données pour vous connecter sur ce site sont les suivantes :"
1109
+
1110
+ #: import-users-from-csv-with-meta.php:52
1111
+ #: import-users-from-csv-with-meta.php:195
1112
+ msgid "URL to login"
1113
+ msgstr "URL de connexion"
1114
+
1115
+ #: import-users-from-csv-with-meta.php:96
1116
+ msgid "Insert users massively (CSV)"
1117
+ msgstr "Insérer des utilisateurs massivement (CSV)"
1118
+
1119
+ #: import-users-from-csv-with-meta.php:97
1120
+ msgid "SMTP Configuration"
1121
+ msgstr "Configuration SMTP"
1122
+
1123
+ #: import-users-from-csv-with-meta.php:103
1124
+ #: import-users-from-csv-with-meta.php:202
1125
+ msgid "Donate"
1126
+ msgstr "Faites un don"
1127
+
1128
+ #: import-users-from-csv-with-meta.php:104
1129
+ msgid "Premium support"
1130
+ msgstr "Assistance Premium"
1131
+
1132
+ #: import-users-from-csv-with-meta.php:105
1133
+ msgid "Premium plugins"
1134
+ msgstr "Extensions Premium"
1135
+
1136
+ #: import-users-from-csv-with-meta.php:202
1137
+ msgid "Customs columns loaded"
1138
+ msgstr "Colonnes personnalisées"
1139
+
1140
+ #: import-users-from-csv-with-meta.php:202
1141
+ msgid "Cron import"
1142
+ msgstr "Automatisation"
1143
+
1144
+ #: import-users-from-csv-with-meta.php:202
1145
+ msgid "Shop"
1146
+ msgstr "Boutique"
1147
+
1148
+ #: import-users-from-csv-with-meta.php:202
1149
+ msgid "Hire an expert"
1150
+ msgstr "Embaucher un expert"
1151
+
1152
+ #: import-users-from-csv-with-meta.php:242
1153
+ msgid "Error, we cannot find the file"
1154
+ msgstr "Erreur, impossible de trouver le fichier"
1155
+
1156
+ #: import-users-from-csv-with-meta.php:286
1157
+ msgid "Unable to write to directory. Is this directory writable by the server?"
1158
+ msgstr ""
1159
+ "Impossible d'écrire dans le répertoire. Ce répertoire est-il accessible en "
1160
+ "écriture par le serveur ?"
1161
+
1162
+ #: import-users-from-csv-with-meta.php:294
1163
+ msgid "Error, the file"
1164
+ msgstr "Erreur, le fichier"
1165
+
1166
+ #: import-users-from-csv-with-meta.php:294
1167
+ msgid "could not moved to"
1168
+ msgstr "ne peut pas être déplacé à"
1169
+
1170
+ #: import-users-from-csv-with-meta.php:323
1171
+ msgid "Mail template updated correctly"
1172
+ msgstr "Modèle de courriel mis à jour correctement"
1173
+
1174
+ #: import-users-from-csv-with-meta.php:370
1175
+ msgid "Settings updated correctly"
1176
+ msgstr "Paramètres mis à jour correctement"
1177
+
1178
+ #: import-users-from-csv-with-meta.php:376
1179
+ msgid "Import cron task starts at"
1180
+ msgstr "La tâche cron d’importation commence à"
1181
+
1182
+ #: import-users-from-csv-with-meta.php:397
1183
+ msgid "--Finished at"
1184
+ msgstr "-- Finis à"
1185
+
1186
+ #: import-users-from-csv-with-meta.php:506
1187
+ msgid "You are not an adminstrator"
1188
+ msgstr "Vous n'êtes pas un administrateur"
trunk/languages/import-users-from-csv-with-meta.pot ADDED
@@ -0,0 +1,1067 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WordPress Blank Pot
2
+ # Copyright (C) 2014 ...
3
+ # This file is distributed under the GNU General Public License v2 or later.
4
+ #, fuzzy
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: WordPress Blank Pot v1.0.0\n"
8
+ "Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
9
+ "POT-Creation-Date: 2017-01-24 19:47+0100\n"
10
+ "PO-Revision-Date: \n"
11
+ "Last-Translator: Toni Ginard <toni.ginard@gmail.com>\n"
12
+ "Language-Team: Your Team <translations@example.com>\n"
13
+ "Language: en_US\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
19
+ "X-Poedit-SourceCharset: UTF-8\n"
20
+ "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
21
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
22
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
23
+ "X-Poedit-Basepath: ..\n"
24
+ "X-Generator: Poedit 1.8.9\n"
25
+ "X-Poedit-SearchPath-0: .\n"
26
+
27
+ #: import-users-from-csv-with-meta.php:51
28
+ #: import-users-from-csv-with-meta.php:204
29
+ msgid "Welcome to"
30
+ msgstr ""
31
+
32
+ #: import-users-from-csv-with-meta.php:52
33
+ #: import-users-from-csv-with-meta.php:201
34
+ msgid "Welcome,"
35
+ msgstr ""
36
+
37
+ #: import-users-from-csv-with-meta.php:52
38
+ #: import-users-from-csv-with-meta.php:201
39
+ msgid "Your data to login in this site is:"
40
+ msgstr ""
41
+
42
+ #: import-users-from-csv-with-meta.php:52
43
+ #: import-users-from-csv-with-meta.php:201
44
+ msgid "URL to login"
45
+ msgstr ""
46
+
47
+ #: import-users-from-csv-with-meta.php:52
48
+ #: import-users-from-csv-with-meta.php:201 importer.php:834 smtp.php:218
49
+ msgid "Username"
50
+ msgstr ""
51
+
52
+ #: import-users-from-csv-with-meta.php:102
53
+ msgid "Insert users massively (CSV)"
54
+ msgstr ""
55
+
56
+ #: import-users-from-csv-with-meta.php:102
57
+ #: import-users-from-csv-with-meta.php:208 importer.php:533
58
+ msgid "Import users from CSV"
59
+ msgstr ""
60
+
61
+ #: import-users-from-csv-with-meta.php:103
62
+ msgid "SMTP Configuration"
63
+ msgstr ""
64
+
65
+ #: import-users-from-csv-with-meta.php:109
66
+ #: import-users-from-csv-with-meta.php:208
67
+ msgid "Donate"
68
+ msgstr ""
69
+
70
+ #: import-users-from-csv-with-meta.php:110
71
+ msgid "Premium support"
72
+ msgstr ""
73
+
74
+ #: import-users-from-csv-with-meta.php:111
75
+ msgid "Premium plugins"
76
+ msgstr ""
77
+
78
+ #: import-users-from-csv-with-meta.php:201 smtp.php:222
79
+ msgid "Password"
80
+ msgstr ""
81
+
82
+ #: import-users-from-csv-with-meta.php:208
83
+ msgid "Customs columns loaded"
84
+ msgstr ""
85
+
86
+ #: import-users-from-csv-with-meta.php:208 importer.php:940
87
+ msgid "Mail options"
88
+ msgstr ""
89
+
90
+ #: import-users-from-csv-with-meta.php:208 importer.php:827
91
+ msgid "Documentation"
92
+ msgstr ""
93
+
94
+ #: import-users-from-csv-with-meta.php:208
95
+ msgid "Cron import"
96
+ msgstr ""
97
+
98
+ #: import-users-from-csv-with-meta.php:208
99
+ msgid "Shop"
100
+ msgstr ""
101
+
102
+ #: import-users-from-csv-with-meta.php:208
103
+ msgid "Hire an expert"
104
+ msgstr ""
105
+
106
+ #: import-users-from-csv-with-meta.php:248
107
+ msgid "Error, we cannot find the file"
108
+ msgstr ""
109
+
110
+ #: import-users-from-csv-with-meta.php:292
111
+ msgid "Unable to write to directory. Is this directory writable by the server?"
112
+ msgstr ""
113
+
114
+ #: import-users-from-csv-with-meta.php:300
115
+ msgid "Error, the file"
116
+ msgstr ""
117
+
118
+ #: import-users-from-csv-with-meta.php:300
119
+ msgid "could not moved to"
120
+ msgstr ""
121
+
122
+ #: import-users-from-csv-with-meta.php:329
123
+ msgid "Mail template updated correctly"
124
+ msgstr ""
125
+
126
+ #: import-users-from-csv-with-meta.php:382
127
+ msgid "Settings updated correctly"
128
+ msgstr ""
129
+
130
+ #: import-users-from-csv-with-meta.php:388
131
+ msgid "Import cron task starts at"
132
+ msgstr ""
133
+
134
+ #: import-users-from-csv-with-meta.php:409
135
+ msgid "--Finished at"
136
+ msgstr ""
137
+
138
+ #: import-users-from-csv-with-meta.php:535
139
+ msgid "You are not an adminstrator"
140
+ msgstr ""
141
+
142
+ #: importer.php:60
143
+ msgid "Ready to registers"
144
+ msgstr ""
145
+
146
+ #: importer.php:61
147
+ msgid "First row represents the form of sheet"
148
+ msgstr ""
149
+
150
+ #: importer.php:88
151
+ msgid "File must contain at least 2 columns: username and email"
152
+ msgstr ""
153
+
154
+ #: importer.php:116
155
+ msgid "Inserting and updating data"
156
+ msgstr ""
157
+
158
+ #: importer.php:118
159
+ msgid "Row"
160
+ msgstr ""
161
+
162
+ #: importer.php:123
163
+ msgid "Row number"
164
+ msgstr ""
165
+
166
+ #: importer.php:123
167
+ msgid "does not have the same columns than the header, we are going to skip"
168
+ msgstr ""
169
+
170
+ #: importer.php:176
171
+ msgid "Problems with ID"
172
+ msgstr ""
173
+
174
+ #: importer.php:176
175
+ msgid ""
176
+ "username is not the same in the CSV and in database, we are going to skip."
177
+ msgstr ""
178
+
179
+ #: importer.php:223
180
+ msgid "User already exists as:"
181
+ msgstr ""
182
+
183
+ #: importer.php:223
184
+ msgid "(in this CSV file is called:"
185
+ msgstr ""
186
+
187
+ #: importer.php:242
188
+ msgid "Problems with user:"
189
+ msgstr ""
190
+
191
+ #: importer.php:242
192
+ msgid ", we are going to skip. \\r\\nError: "
193
+ msgstr ""
194
+
195
+ #: importer.php:366
196
+ msgid "Password has not been changed"
197
+ msgstr ""
198
+
199
+ #: importer.php:441
200
+ msgid "Process finished you can go"
201
+ msgstr ""
202
+
203
+ #: importer.php:441
204
+ msgid "here to see results"
205
+ msgstr ""
206
+
207
+ #: importer.php:456
208
+ msgid "You are not allowed to see this content."
209
+ msgstr ""
210
+
211
+ #: importer.php:502
212
+ msgid "Click to open/close"
213
+ msgstr ""
214
+
215
+ #: importer.php:506
216
+ msgid "Old CSV files uploaded"
217
+ msgstr ""
218
+
219
+ #: importer.php:509
220
+ msgid ""
221
+ "For security reasons you should delete this files, probably they would be "
222
+ "visible in the Internet if a bot or someone discover the URL. You can delete "
223
+ "each file or maybe you want delete all CSV files you have uploaded:"
224
+ msgstr ""
225
+
226
+ #: importer.php:510
227
+ msgid "Delete all CSV files uploaded"
228
+ msgstr ""
229
+
230
+ #: importer.php:520
231
+ msgid "Delete"
232
+ msgstr ""
233
+
234
+ #: importer.php:529
235
+ msgid ""
236
+ "File must contain at least <strong>2 columns: username and email</strong>. "
237
+ "These should be the first two columns and it should be placed <strong>in "
238
+ "this order: username and email</strong>. If there are more columns, this "
239
+ "plugin will manage it automatically."
240
+ msgstr ""
241
+
242
+ #: importer.php:530
243
+ msgid ""
244
+ "Please, read carefully how <strong>passwords are managed</strong> and also "
245
+ "take note about capitalization, this plugin is <strong>case sensitive</"
246
+ "strong>."
247
+ msgstr ""
248
+
249
+ #: importer.php:543
250
+ msgid "Update existing users?"
251
+ msgstr ""
252
+
253
+ #: importer.php:546 importer.php:575
254
+ msgid "Yes"
255
+ msgstr ""
256
+
257
+ #: importer.php:547 importer.php:574
258
+ msgid "No"
259
+ msgstr ""
260
+
261
+ #: importer.php:553 importer.php:1108
262
+ msgid "Role"
263
+ msgstr ""
264
+
265
+ #: importer.php:566
266
+ msgid ""
267
+ "If you choose more than one role, the roles would be assigned correctly but "
268
+ "you should use some plugin like <a href=\"https://wordpress.org/plugins/user-"
269
+ "role-editor/\">User Role Editor</a> to manage them."
270
+ msgstr ""
271
+
272
+ #: importer.php:571
273
+ msgid "Update roles for existing users?"
274
+ msgstr ""
275
+
276
+ #: importer.php:581
277
+ msgid "CSV file <span class=\"description\">(required)</span></label>"
278
+ msgstr ""
279
+
280
+ #: importer.php:585
281
+ msgid "<em>or you can choose directly a file from your host,"
282
+ msgstr ""
283
+
284
+ #: importer.php:585 importer.php:589
285
+ msgid "click here"
286
+ msgstr ""
287
+
288
+ #: importer.php:588 importer.php:1047 importer.php:1138
289
+ msgid "You have to introduce the path to file, i.e.:"
290
+ msgstr ""
291
+
292
+ #: importer.php:589
293
+ msgid "or you can upload it directly from your PC"
294
+ msgstr ""
295
+
296
+ #: importer.php:595
297
+ msgid "What should the plugin do with empty cells?"
298
+ msgstr ""
299
+
300
+ #: importer.php:598
301
+ msgid "Leave the old value for this metadata"
302
+ msgstr ""
303
+
304
+ #: importer.php:599
305
+ msgid "Delete the metadata"
306
+ msgstr ""
307
+
308
+ #: importer.php:625
309
+ msgid "BuddyPress users"
310
+ msgstr ""
311
+
312
+ #: importer.php:626
313
+ msgid ""
314
+ "You can insert any profile from BuddyPress using his name as header. Plugin "
315
+ "will check, before import, which fields are defined in BuddyPress and will "
316
+ "assign it in the update. You can use this fields:"
317
+ msgstr ""
318
+
319
+ #: importer.php:630
320
+ msgid ""
321
+ "Remember that all date fields have to be imported using a format like this: "
322
+ "2016-01-01 00:00:00"
323
+ msgstr ""
324
+
325
+ #: importer.php:632 importer.php:648 importer.php:665 importer.php:681
326
+ msgid "Only for"
327
+ msgstr ""
328
+
329
+ #: importer.php:632 importer.php:648 importer.php:665 importer.php:681
330
+ msgid "users"
331
+ msgstr ""
332
+
333
+ #: importer.php:644
334
+ msgid "Do not activate users"
335
+ msgstr ""
336
+
337
+ #: importer.php:645
338
+ msgid "Activate users when they are being imported"
339
+ msgstr ""
340
+
341
+ #: importer.php:648
342
+ msgid "WP Members"
343
+ msgstr ""
344
+
345
+ #: importer.php:658
346
+ msgid "Approve users at the same time is being created"
347
+ msgstr ""
348
+
349
+ #: importer.php:661
350
+ msgid "Do not approve users"
351
+ msgstr ""
352
+
353
+ #: importer.php:662
354
+ msgid "Approve users when they are being imported"
355
+ msgstr ""
356
+
357
+ #: importer.php:665
358
+ msgid "New User Approve"
359
+ msgstr ""
360
+
361
+ #: importer.php:675
362
+ msgid "Repeated email in different users?"
363
+ msgstr ""
364
+
365
+ #: importer.php:678
366
+ msgid "Not allowed"
367
+ msgstr ""
368
+
369
+ #: importer.php:679
370
+ msgid "Allowed"
371
+ msgstr ""
372
+
373
+ #: importer.php:681
374
+ msgid "Allow Multiple Accounts"
375
+ msgstr ""
376
+
377
+ #: importer.php:681
378
+ msgid ""
379
+ "Allow multiple user accounts to be created having the same email address."
380
+ msgstr ""
381
+
382
+ #: importer.php:690
383
+ msgid "WordPress Access Areas is activated"
384
+ msgstr ""
385
+
386
+ #: importer.php:692
387
+ msgid "As user of"
388
+ msgstr ""
389
+
390
+ #: importer.php:692
391
+ msgid "WordPress Access Areas"
392
+ msgstr ""
393
+
394
+ #: importer.php:692
395
+ msgid "you can use the Access Areas created"
396
+ msgstr ""
397
+
398
+ #: importer.php:692 importer.php:942
399
+ msgid "here"
400
+ msgstr ""
401
+
402
+ #: importer.php:692
403
+ msgid ""
404
+ "and use this areas in your own CSV file. Please use the column name "
405
+ "<strong>wp-access-areas</strong> and in each row use <strong>the name that "
406
+ "you have used"
407
+ msgstr ""
408
+
409
+ #: importer.php:692
410
+ msgid ", like this ones:"
411
+ msgstr ""
412
+
413
+ #: importer.php:701
414
+ msgid ""
415
+ "If you leave this cell empty for some user or the access area indicated "
416
+ "doesn't exist, user won't be assigned to any access area. You can choose "
417
+ "more than one area for each user using pads between them in the same row, i."
418
+ "e.: "
419
+ msgstr ""
420
+
421
+ #: importer.php:708
422
+ msgid "Send mail"
423
+ msgstr ""
424
+
425
+ #: importer.php:710
426
+ msgid "Do you wish to send a mail with credentials and other data?"
427
+ msgstr ""
428
+
429
+ #: importer.php:710 importer.php:711
430
+ msgid "yes"
431
+ msgstr ""
432
+
433
+ #: importer.php:711
434
+ msgid ""
435
+ "Do you wish to send this mail also to users that are being updated? (not "
436
+ "only to the one which are being created)"
437
+ msgstr ""
438
+
439
+ #: importer.php:719
440
+ msgid "Start importing"
441
+ msgstr ""
442
+
443
+ #: importer.php:727
444
+ msgid "Please choose a file"
445
+ msgstr ""
446
+
447
+ #: importer.php:732
448
+ msgid "Please enter a path to the file"
449
+ msgstr ""
450
+
451
+ #: importer.php:737
452
+ msgid "Please select a role"
453
+ msgstr ""
454
+
455
+ #: importer.php:744
456
+ msgid "Are you sure to delete this file?"
457
+ msgstr ""
458
+
459
+ #: importer.php:753
460
+ msgid "There were problems deleting the file, please check file permissions"
461
+ msgstr ""
462
+
463
+ #: importer.php:755
464
+ msgid "File successfully deleted"
465
+ msgstr ""
466
+
467
+ #: importer.php:763
468
+ msgid ""
469
+ "Are you sure to delete ALL CSV files uploaded? There can be CSV files from "
470
+ "other plugins."
471
+ msgstr ""
472
+
473
+ #: importer.php:771
474
+ msgid "There were problems deleting the files, please check files permissions"
475
+ msgstr ""
476
+
477
+ #: importer.php:773
478
+ msgid "Files successfully deleted"
479
+ msgstr ""
480
+
481
+ #: importer.php:798
482
+ msgid "Custom columns loaded"
483
+ msgstr ""
484
+
485
+ #: importer.php:802
486
+ msgid "Columns loaded in previous files"
487
+ msgstr ""
488
+
489
+ #: importer.php:803
490
+ msgid ""
491
+ "(if you load another CSV with different columns, the new ones will replace "
492
+ "this list)"
493
+ msgstr ""
494
+
495
+ #: importer.php:812
496
+ msgid "There is no columns loaded yet"
497
+ msgstr ""
498
+
499
+ #: importer.php:831
500
+ msgid "Columns position"
501
+ msgstr ""
502
+
503
+ #: importer.php:832
504
+ msgid ""
505
+ "(Documents should look like the one presented into screenshot. Remember you "
506
+ "should fill the first two columns with the next values)"
507
+ msgstr ""
508
+
509
+ #: importer.php:835
510
+ msgid "Email"
511
+ msgstr ""
512
+
513
+ #: importer.php:837
514
+ msgid ""
515
+ "(The next columns are totally customizable and you can use whatever you "
516
+ "want. All rows must contains same columns)"
517
+ msgstr ""
518
+
519
+ #: importer.php:838
520
+ msgid "(User profile will be adapted to the kind of data you have selected)"
521
+ msgstr ""
522
+
523
+ #: importer.php:839
524
+ msgid ""
525
+ "(If you want to disable the extra profile information, please deactivate "
526
+ "this plugin after make the import)"
527
+ msgstr ""
528
+
529
+ #: importer.php:843
530
+ msgid "id"
531
+ msgstr ""
532
+
533
+ #: importer.php:844
534
+ msgid ""
535
+ "You can use a column called id in order to make inserts or updates of an "
536
+ "user using the ID used by WordPress in the wp_users table. We have two "
537
+ "different cases:"
538
+ msgstr ""
539
+
540
+ #: importer.php:846
541
+ msgid ""
542
+ "If id <strong>doesn't exist in your users table</strong>: user will be "
543
+ "inserted"
544
+ msgstr ""
545
+
546
+ #: importer.php:847
547
+ msgid ""
548
+ "If id <strong>exists</strong>: plugin check if username is the same, if yes, "
549
+ "it will update the data, if not, it ignores the cell to avoid problems"
550
+ msgstr ""
551
+
552
+ #: importer.php:852
553
+ msgid "Passwords"
554
+ msgstr ""
555
+
556
+ #: importer.php:853
557
+ msgid ""
558
+ "A string that contains user passwords. We have different options for this "
559
+ "case:"
560
+ msgstr ""
561
+
562
+ #: importer.php:855
563
+ msgid ""
564
+ "If you <strong>don't create a column for passwords</strong>: passwords will "
565
+ "be generated automatically"
566
+ msgstr ""
567
+
568
+ #: importer.php:856
569
+ msgid ""
570
+ "If you <strong>create a column for passwords</strong>: if cell is empty, "
571
+ "password won't be updated; if cell has a value, it will be used"
572
+ msgstr ""
573
+
574
+ #: importer.php:861
575
+ msgid "WordPress default profile data"
576
+ msgstr ""
577
+
578
+ #: importer.php:862
579
+ msgid ""
580
+ "You can use those labels if you want to set data adapted to the WordPress "
581
+ "default user columns (the ones who use the function"
582
+ msgstr ""
583
+
584
+ #: importer.php:864
585
+ msgid ""
586
+ "A string that contains a URL-friendly name for the user. The default is the "
587
+ "user's username."
588
+ msgstr ""
589
+
590
+ #: importer.php:865
591
+ msgid "A string containing the user's URL for the user's web site."
592
+ msgstr ""
593
+
594
+ #: importer.php:866
595
+ msgid ""
596
+ "A string that will be shown on the site. Defaults to user's username. It is "
597
+ "likely that you will want to change this, for both appearance and security "
598
+ "through obscurity (that is if you don't use and delete the default admin "
599
+ "user)."
600
+ msgstr ""
601
+
602
+ #: importer.php:867
603
+ msgid "The user's nickname, defaults to the user's username."
604
+ msgstr ""
605
+
606
+ #: importer.php:868
607
+ msgid "The user's first name."
608
+ msgstr ""
609
+
610
+ #: importer.php:869
611
+ msgid "The user's last name."
612
+ msgstr ""
613
+
614
+ #: importer.php:870
615
+ msgid "A string containing content about the user."
616
+ msgstr ""
617
+
618
+ #: importer.php:871
619
+ msgid "User's Jabber account."
620
+ msgstr ""
621
+
622
+ #: importer.php:872
623
+ msgid "User's AOL IM account."
624
+ msgstr ""
625
+
626
+ #: importer.php:873
627
+ msgid "User's Yahoo IM account."
628
+ msgstr ""
629
+
630
+ #: importer.php:874
631
+ msgid "Using the WordPress format for this kind of data Y-m-d H:i:s."
632
+ msgstr ""
633
+
634
+ #: importer.php:881
635
+ msgid "WooCommerce is activated"
636
+ msgstr ""
637
+
638
+ #: importer.php:882
639
+ msgid ""
640
+ "You can use those labels if you want to set data adapted to the WooCommerce "
641
+ "default user columns"
642
+ msgstr ""
643
+
644
+ #: importer.php:910
645
+ msgid "Important notice"
646
+ msgstr ""
647
+
648
+ #: importer.php:911
649
+ msgid ""
650
+ "You can upload as many files as you want, but all must have the same "
651
+ "columns. If you upload another file, the columns will change to the form of "
652
+ "last file uploaded."
653
+ msgstr ""
654
+
655
+ #: importer.php:914
656
+ msgid "Any question about it"
657
+ msgstr ""
658
+
659
+ #: importer.php:917
660
+ msgid "Free support (in WordPress forums):"
661
+ msgstr ""
662
+
663
+ #: importer.php:918
664
+ msgid "Premium support (with a quote):"
665
+ msgstr ""
666
+
667
+ #: importer.php:923
668
+ msgid "Example"
669
+ msgstr ""
670
+
671
+ #: importer.php:924
672
+ msgid "Download this"
673
+ msgstr ""
674
+
675
+ #: importer.php:924
676
+ msgid "file"
677
+ msgstr ""
678
+
679
+ #: importer.php:924
680
+ msgid "to test"
681
+ msgstr ""
682
+
683
+ #: importer.php:942
684
+ msgid "You can set your own SMTP and other mail details"
685
+ msgstr ""
686
+
687
+ #: importer.php:947
688
+ msgid "WordPress automatic emails users updated"
689
+ msgstr ""
690
+
691
+ #: importer.php:951
692
+ msgid "Send automatic WordPress emails?"
693
+ msgstr ""
694
+
695
+ #: importer.php:955
696
+ msgid ""
697
+ "Deactivate WordPress automatic email when an user is updated or his "
698
+ "password is changed"
699
+ msgstr ""
700
+
701
+ #: importer.php:956
702
+ msgid ""
703
+ "Activate WordPress automatic email when an user is updated or his password "
704
+ "is changed"
705
+ msgstr ""
706
+
707
+ #: importer.php:958
708
+ msgid ""
709
+ "When you update an user or change his password, WordPress prepare and send "
710
+ "automatic email, you can deactivate it here."
711
+ msgstr ""
712
+
713
+ #: importer.php:966
714
+ msgid "Customize the email that can be sent when importing users"
715
+ msgstr ""
716
+
717
+ #: importer.php:968
718
+ msgid "Mail subject :"
719
+ msgstr ""
720
+
721
+ #: importer.php:976
722
+ msgid "username to login"
723
+ msgstr ""
724
+
725
+ #: importer.php:977
726
+ msgid "user password"
727
+ msgstr ""
728
+
729
+ #: importer.php:978
730
+ msgid "current site login url"
731
+ msgstr ""
732
+
733
+ #: importer.php:979
734
+ msgid "lost password url"
735
+ msgstr ""
736
+
737
+ #: importer.php:980
738
+ msgid "password reset url"
739
+ msgstr ""
740
+
741
+ #: importer.php:981
742
+ msgid "user email"
743
+ msgstr ""
744
+
745
+ #: importer.php:982
746
+ msgid ""
747
+ "You can also use any WordPress user standard field or an own metadata, if "
748
+ "you have used it in your CSV. For example, if you have a first_name column, "
749
+ "you could use **first_name** or any other meta_data like **my_custom_meta**"
750
+ msgstr ""
751
+
752
+ #: importer.php:1038
753
+ msgid "Execute an import of users periodically"
754
+ msgstr ""
755
+
756
+ #: importer.php:1044
757
+ msgid "Path of file that are going to be imported"
758
+ msgstr ""
759
+
760
+ #: importer.php:1046 importer.php:1137
761
+ msgid "Insert complete path to the file"
762
+ msgstr ""
763
+
764
+ #: importer.php:1051
765
+ msgid "Period"
766
+ msgstr ""
767
+
768
+ #: importer.php:1054
769
+ msgid "Hourly"
770
+ msgstr ""
771
+
772
+ #: importer.php:1055
773
+ msgid "Twicedaily"
774
+ msgstr ""
775
+
776
+ #: importer.php:1056
777
+ msgid "Daily"
778
+ msgstr ""
779
+
780
+ #: importer.php:1058
781
+ msgid "How often the event should reoccur?"
782
+ msgstr ""
783
+
784
+ #: importer.php:1062
785
+ msgid "Activate periodical import?"
786
+ msgstr ""
787
+
788
+ #: importer.php:1068
789
+ msgid "Send mail when using periodical import?"
790
+ msgstr ""
791
+
792
+ #: importer.php:1074
793
+ msgid "Send mail also to users that are being updated?"
794
+ msgstr ""
795
+
796
+ #: importer.php:1080
797
+ msgid "Delete users that are not present in the CSV?"
798
+ msgstr ""
799
+
800
+ #: importer.php:1089 importer.php:1091
801
+ msgid "Delete posts of deleted users without assigning to any user"
802
+ msgstr ""
803
+
804
+ #: importer.php:1103
805
+ msgid ""
806
+ "After delete users, we can choose if we want to assign their posts to "
807
+ "another user. Please do not delete them or posts will be deleted."
808
+ msgstr ""
809
+
810
+ #: importer.php:1113 importer.php:1115
811
+ msgid "Disable role assignment in cron import"
812
+ msgstr ""
813
+
814
+ #: importer.php:1126
815
+ msgid "Which role would be used to import users?"
816
+ msgstr ""
817
+
818
+ #: importer.php:1130
819
+ msgid "Move file after import?"
820
+ msgstr ""
821
+
822
+ #: importer.php:1143
823
+ msgid "Auto rename after move?"
824
+ msgstr ""
825
+
826
+ #: importer.php:1150
827
+ msgid ""
828
+ "Your file will be renamed after moved, so you will not lost any version of "
829
+ "it. The way to rename will be append the time stamp using this date format: "
830
+ "YmdHis."
831
+ msgstr ""
832
+
833
+ #: importer.php:1155
834
+ msgid "Last actions of schedule task"
835
+ msgstr ""
836
+
837
+ #: importer.php:1162
838
+ msgid "Save schedule options"
839
+ msgstr ""
840
+
841
+ #: importer.php:1169
842
+ msgid ""
843
+ "Are you sure to delete all users that are not present in the CSV? This "
844
+ "action cannot be undone."
845
+ msgstr ""
846
+
847
+ #: importer.php:1203
848
+ msgid "Do you like it?"
849
+ msgstr ""
850
+
851
+ #: importer.php:1206
852
+ msgid "buy me a coffee"
853
+ msgstr ""
854
+
855
+ #: importer.php:1207 importer.php:1227
856
+ msgid "Hi! we are"
857
+ msgstr ""
858
+
859
+ #: importer.php:1207 importer.php:1227
860
+ msgid "and"
861
+ msgstr ""
862
+
863
+ #: importer.php:1207 importer.php:1227
864
+ msgid "from"
865
+ msgstr ""
866
+
867
+ #: importer.php:1207 importer.php:1227
868
+ msgid "developers of this plugin."
869
+ msgstr ""
870
+
871
+ #: importer.php:1208
872
+ msgid ""
873
+ "We have been spending many hours to develop this plugin. <br>If you like and "
874
+ "use this plugin, you can <strong>buy us a cup of coffee</strong>."
875
+ msgstr ""
876
+
877
+ #: importer.php:1212
878
+ msgid "PayPal – The safer, easier way to pay online."
879
+ msgstr ""
880
+
881
+ #: importer.php:1224
882
+ msgid "Need help with WordPress or WooCommerce?"
883
+ msgstr ""
884
+
885
+ #: importer.php:1228
886
+ msgid ""
887
+ "We work everyday with WordPress and WooCommerce, if you need help hire us, "
888
+ "send us a message to"
889
+ msgstr ""
890
+
891
+ #: smtp.php:26 smtp.php:245
892
+ msgid "Send Test"
893
+ msgstr ""
894
+
895
+ #: smtp.php:40
896
+ msgid "Test mail to "
897
+ msgstr ""
898
+
899
+ #: smtp.php:41
900
+ msgid ""
901
+ "This is a test email generated by the Import User From CSV With Meta "
902
+ "WordPress plugin."
903
+ msgstr ""
904
+
905
+ #: smtp.php:79
906
+ msgid "Message sent successfully"
907
+ msgstr ""
908
+
909
+ #: smtp.php:83
910
+ msgid "Test Message Sent"
911
+ msgstr ""
912
+
913
+ #: smtp.php:84
914
+ msgid "The result was:"
915
+ msgstr ""
916
+
917
+ #: smtp.php:86
918
+ msgid "The full debugging output is shown below:"
919
+ msgstr ""
920
+
921
+ #: smtp.php:88
922
+ msgid "The SMTP debugging output is shown below:"
923
+ msgstr ""
924
+
925
+ #: smtp.php:119
926
+ msgid "Import User From CSV With Meta - SMTP server options"
927
+ msgstr ""
928
+
929
+ #: smtp.php:123
930
+ msgid "Global options"
931
+ msgstr ""
932
+
933
+ #: smtp.php:124
934
+ msgid ""
935
+ "Do you want to use your own SMTP settings for this plugin or the WordPress "
936
+ "settings."
937
+ msgstr ""
938
+
939
+ #: smtp.php:128
940
+ msgid "Settings"
941
+ msgstr ""
942
+
943
+ #: smtp.php:131
944
+ msgid "Use plugin SMTP settings"
945
+ msgstr ""
946
+
947
+ #: smtp.php:133
948
+ msgid "Use this settings to send mail."
949
+ msgstr ""
950
+
951
+ #: smtp.php:135
952
+ msgid "Use WordPress general settings to send mail."
953
+ msgstr ""
954
+
955
+ #: smtp.php:143
956
+ msgid "From Email"
957
+ msgstr ""
958
+
959
+ #: smtp.php:145
960
+ msgid ""
961
+ "You can specify the email address that emails should be sent from. If you "
962
+ "leave this blank, the default email will be used."
963
+ msgstr ""
964
+
965
+ #: smtp.php:145
966
+ msgid ""
967
+ "<strong>Please Note:</strong> You appear to be using a version of WordPress "
968
+ "prior to 2.3. Please ignore the From Name field and instead enter Name&lt;"
969
+ "email@domain.com&gt; in this field."
970
+ msgstr ""
971
+
972
+ #: smtp.php:148
973
+ msgid "From Name"
974
+ msgstr ""
975
+
976
+ #: smtp.php:150
977
+ msgid ""
978
+ "You can specify the name that emails should be sent from. If you leave this "
979
+ "blank, the emails will be sent from WordPress."
980
+ msgstr ""
981
+
982
+ #: smtp.php:156 smtp.php:159
983
+ msgid "Mailer"
984
+ msgstr ""
985
+
986
+ #: smtp.php:161
987
+ msgid "Send emails of this plugin via SMTP."
988
+ msgstr ""
989
+
990
+ #: smtp.php:163
991
+ msgid "Use the PHP mail() function to send emails."
992
+ msgstr ""
993
+
994
+ #: smtp.php:171 smtp.php:174
995
+ msgid "Return Path"
996
+ msgstr ""
997
+
998
+ #: smtp.php:176
999
+ msgid "Set the return-path to match the From Email"
1000
+ msgstr ""
1001
+
1002
+ #: smtp.php:182
1003
+ msgid "SMTP Options"
1004
+ msgstr ""
1005
+
1006
+ #: smtp.php:183
1007
+ msgid "These options only apply if you have chosen to send mail by SMTP above."
1008
+ msgstr ""
1009
+
1010
+ #: smtp.php:187
1011
+ msgid "SMTP Host"
1012
+ msgstr ""
1013
+
1014
+ #: smtp.php:191
1015
+ msgid "SMTP Port"
1016
+ msgstr ""
1017
+
1018
+ #: smtp.php:195 smtp.php:198
1019
+ msgid "Encryption"
1020
+ msgstr ""
1021
+
1022
+ #: smtp.php:200
1023
+ msgid "No encryption."
1024
+ msgstr ""
1025
+
1026
+ #: smtp.php:202
1027
+ msgid "Use SSL encryption."
1028
+ msgstr ""
1029
+
1030
+ #: smtp.php:204
1031
+ msgid ""
1032
+ "Use TLS encryption. This is not the same as STARTTLS. For most servers SSL "
1033
+ "is the recommended option."
1034
+ msgstr ""
1035
+
1036
+ #: smtp.php:208
1037
+ msgid "Authentication"
1038
+ msgstr ""
1039
+
1040
+ #: smtp.php:211
1041
+ msgid "No: Do not use SMTP authentication."
1042
+ msgstr ""
1043
+
1044
+ #: smtp.php:213
1045
+ msgid "Yes: Use SMTP authentication."
1046
+ msgstr ""
1047
+
1048
+ #: smtp.php:214
1049
+ msgid "If this is set to no, the values below are ignored."
1050
+ msgstr ""
1051
+
1052
+ #: smtp.php:227
1053
+ msgid "Save Changes"
1054
+ msgstr ""
1055
+
1056
+ #: smtp.php:234
1057
+ msgid "Send a Test Email"
1058
+ msgstr ""
1059
+
1060
+ #: smtp.php:240
1061
+ msgid "To:"
1062
+ msgstr ""
1063
+
1064
+ #: smtp.php:242
1065
+ msgid ""
1066
+ "Type an email address here and then click Send Test to generate a test email."
1067
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,1399 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Import and export users and customers ===
2
+ 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.9.2
7
+ Stable tag: 1.19.2
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Import and export users and customers using CSV files including custom user meta and roles. Integrations with lots of other plugins. Frontend upload, cron import and much more.
12
+
13
+ == Description ==
14
+
15
+ **Try it out on your free dummy site: Click here => [https://demo.tastewp.com/import-users-from-csv-with-meta](https://demo.tastewp.com/import-users-from-csv-with-meta)**
16
+
17
+ Clean and easy-to-use import and export users and customer plugin, for WordPress and WooCommerce. It includes custom user meta to be included automatically from a CSV file and delimitation auto-detector. It also is able to send a mail to each user imported and all the meta data imported is ready to edit into user profile.
18
+
19
+ * Import CSV file with users directly to your WordPress or customers into WooCommerce
20
+ * Import thousends of users or customers in only some seconds
21
+ * Export users or customers to a CSV file, filtering by role or registered date
22
+ * You can also import meta-data like data from WooCommerce customers
23
+ * You can assign roles while importing
24
+ * Send a mail to every new user, this mails can be saved as templates and are fully customizable, before sending you can test it
25
+ * Use your own
26
+ * You can also update users if the user is already in your WordPress
27
+ * Create a cron task to import users periodically
28
+ * Edit the metadata (you will be able to edit the metadata imported using metakeys directly in the profile of each user)
29
+ * Extend the plugin using the hooks we provide
30
+ * Compatible with WPML [read the documentation](https://wpml.org/documentation/plugins-compatibility/import-users-from-csv-with-meta-and-wpml/) to see how you can translate the front-end import and export users page and send translated email notifications to users
31
+
32
+ Moreover this plugin is compatible with many other plugins to be able to import and include them data, subscriptions, memberships, etc. Take a look:
33
+
34
+ * WooCommerce: to import the customer data
35
+ * WooCommerce Memberships: to import memberships
36
+ * WooCommerce Subscriptions: to create subscriptions associated with users while they are being imported
37
+ * BuddyPress: to import custom BuddyPress avatars, fields, groups and roles
38
+ * Advanced Custom Fields: to import data to the fields you define there
39
+ * Paid Membership Pro: to import memberships
40
+ * Indeed Ultimate Membership Pro: to import memberships
41
+ * Paid Member Subscriptions: to import memberships
42
+ * Allow Multiple Accounts: plugin will allow the same rules importing than this plugin
43
+ * Groups: to assign users to groups while importing
44
+ * New User Approve: you can import users and approbe/wait for approve them
45
+ * Users Group: to assign users to groups while importing
46
+ * WP LMS Course: to enroll users in the courses while importing
47
+ * WP Members: to import memberships
48
+ * WP Users Group: to assign users to groups while importing
49
+ * WooCommerce Membership by RightPress: to create memberships while users are being imported
50
+ * WP Private Content Plus: To import and export the groups to which users are assigned
51
+
52
+ If you have some problem or doubt:
53
+
54
+ * Read our documentation
55
+ * Ask anything in support forum, we try to give the best support
56
+
57
+ In Codection we have more plugins, please take a look to them.
58
+
59
+ * [RedSys Gateway for WooCommerce Pro a plugin to connect your WooCommerce to RedSys](https://codection.com/producto/redsys-gateway-for-woocommerce) (premium)
60
+ * [Ceca Gateway for WooCommerce Pro a plugin to connect your WooCommerce to Ceca](https://codection.com/producto/ceca-gateway-for-woocommerce-pro/) (premium)
61
+ * [RedSys Button for WordPress a plugin to receive payments using RedSys in WordPress without using WooCommerce](https://codection.com/producto/redsys-button-wordpress/) (premium)
62
+ * [RedSys Gateway for Contact Form 7 a plugin to receive payments using RedSys in WordPress using the popular contact plugin Contact Form 7](https://codection.com/producto/redsys-gateway-for-contact-form-7/) (premium)
63
+ * [Ceca Gateway for Contact Form 7 a plugin to receive payments using Ceca in WordPress using the popular contact plugin Contact Form 7](https://codection.com/producto/ceca-gateway-for-contact-form-7/) (premium)
64
+ * [RedSys Gateway for WP Booking Calendar Pro a plugin to receive payments using RedSys in WordPress using WP Booking Calendar Pro](https://codection.com/producto/redsys-gateway-for-wp-booking-calendar-pro/) (premium)
65
+ * [RedSys Gateway for Goodlayers Tourmaster Pro a plugin to receive payments using RedSys in WordPress using Goodlayers Tourmaster Pro](https://codection.com/producto/redsys-gateway-for-goodlayers-tourmaster-pro/) (premium)
66
+ * [Clean Login a plugin to create your own register, log in, lost password and update profile forms](https://wordpress.org/plugins/clean-login/) (free)
67
+ * [WooCommerce Products Restricted Users a plugin to restrict product visibility by user](https://wordpress.org/plugins/woo-products-restricted-users/) (free)
68
+ * [First payment date for WooCommerce Subscriptions a plugin to set a first payment date in membership sites with WooCommerce Subscriptions](https://wordpress.org/plugins/first-payment-date-for-woocommerce-subscriptions/) (free)
69
+
70
+ ### **Basics**
71
+
72
+ * Import users and customers from a CSV easily
73
+ * And also extra profile information with the user meta data (included in the CSV with your custom fields)
74
+ * Just upload the CSV file (one included as example)
75
+ * All your users will be created/updated with the updated information, and of course including the user meta
76
+ * Autodetect delimiter compatible with `comma , `, `semicolon ; ` and `bar | `
77
+ * Export users and customers choosing delimiters and using some filters
78
+ * Create a cron task to do the import periodically in order to integrate WordPress with an external system
79
+ * Interaction with lots of other plugins like WooCommerce, BuddyPress, Paid Membership Pro, WooCommerce Memebership, WooCommerce Subscriptions and many others
80
+ * Import users from frontend using a shortcode
81
+
82
+ ### **Usage**
83
+
84
+ Once the plugin is installed you can use it. Go to Tools menu and there, there will be a section called _Insert users from CSV_. Just choose your CSV file and go!
85
+
86
+ ### **CSV generation**
87
+
88
+ You can generate CSV file with all users inside it, using a standar spreadsheet software like: Microsoft Excel, LibreOffice Calc, OpenOffice Calc or Gnumeric.
89
+
90
+ You have to create the file filled with information (or take it from another database) and you will only have to choose CSV file when you "Save as..." the file. As example, a CSV file is included with the plugin.
91
+
92
+ ### **Some considerations**
93
+
94
+ Plugin will automatically detect:
95
+
96
+ * Charset and set it to **UTF-8** to prevent problems with non-ASCII characters.
97
+ * It also will **auto detect line-ending** to prevent problems with different OS.
98
+ * Finally, it will **detect the delimiter** being used in CSV file
99
+
100
+ == Screenshots ==
101
+
102
+ 1. Plugin link from dashboard
103
+ 2. Plugin page
104
+ 3. CSV file structure
105
+ 4. Users imported
106
+ 5. Extra profile information (user meta)
107
+
108
+ == Changelog ==
109
+
110
+ = 1.19.2 =
111
+ * New hooks added to override the button text in both shortcodes import and export
112
+ * New addon for WP Private Content Plus to import and export the groups to which users are assigned
113
+ * Revised WPML support
114
+
115
+ = 1.19.1.10 =
116
+ * New hook added in export before deleting the file from the server
117
+
118
+ = 1.19.1.9 =
119
+ * Improved some labels to avoid misunderstandings with email options, thanks to @blakemiller
120
+
121
+ = 1.19.1.8 =
122
+ * Fixed warnings in "Meta keys" tab
123
+
124
+ = 1.19.1.7 =
125
+ * New hooks added to homepage tab to include more options using addons
126
+
127
+ = 1.19.1.6 =
128
+ * New hooks to filter username and password of every users being imported
129
+
130
+ = 1.19.1.5 =
131
+ * Improved BuddyBoss compatibility, now when we include class-bp-xprofile-group.php, we check if BuddyPress is the plugin active or BuddyBoss
132
+
133
+ = 1.19.1.4 =
134
+ * Changed appearence of some buttons in the right panel
135
+ * Included new strings to localize
136
+
137
+ = 1.19.1.3 =
138
+ * Improved ACF addon, now you can use relationships with IDs in addition to slugs
139
+
140
+ = 1.19.1.2 =
141
+ * Fixed fatal error
142
+
143
+ = 1.19.1.1 =
144
+ * Fixed warning in screen with import results
145
+ * Ko-fi donation link added
146
+
147
+ = 1.19.1 =
148
+ * Export now allow to choose which columns export also in "Export" tab and not only in frontend
149
+
150
+ = 1.19 =
151
+ * New class to create diffent HTML elements to standarize plugin code
152
+ * Different fixes in export function to avoid errors
153
+ * New secondary tab section prepared
154
+
155
+ = 1.18.4.4 =
156
+ * Force version update
157
+
158
+ = 1.18.4.3 =
159
+ * New hook added: do_action( 'acui_after_import_users', $users_created, $users_updated, $users_deleted, $users_ignored ); with 3 variables passed with a list of user IDs with users created, updated, deleted and ignored in the process
160
+ * Fixed bad error thrown when empty role was selected in error
161
+
162
+ = 1.18.4.2 =
163
+ * Fixed bug in batch_exporter when using PHP 8
164
+
165
+ = 1.18.4.1 =
166
+ * Fixed bug in batch_exporter that could create fatal errors on executing
167
+
168
+ = 1.18.4 =
169
+ * Improved problem when deleting users, if errors happens but they are notices, we can delete now. Many of the users who have problems with deleting users not present in CSV, was created by the old conditional that checked any kind of error (including notices).
170
+
171
+ = 1.18.3 =
172
+ * Problem solved converting data that has a format date but that is not wanted to be converted, to timestamps when exporting
173
+ * Fixed problems in standard import, in very big databases, there was a problem creating the list of users to assign deleted posts, now this list is created and managed using select2 and AJAX to improve performance and usability
174
+
175
+ = 1.18.2.3 =
176
+ * Problem solved converting timestamps when exporting
177
+ * If an error raise in the server while exporting, instead only showing the error in the console, we throws an alert to improve user experience
178
+
179
+ = 1.18.2.2 =
180
+ * Included a note to prevent misunderstandings when testing emails
181
+
182
+ = 1.18.2.1 =
183
+ * Tested up to 5.8.1
184
+ * Fixed problem with roles export
185
+
186
+ = 1.18.2 =
187
+ * New hooks added to manage extra profile fields
188
+ * Problem solved in BuddyPress addon
189
+
190
+ = 1.18.1 =
191
+ * Fixed problem after 1.18 when exporting users
192
+
193
+ = 1.18 =
194
+ * Export in backend and frontend now works using step by step process using client calls to avoid gateway timeouts and other kind of timing limits in very long process
195
+ * Addon for WP User Manager improved to avoid redirection loop
196
+
197
+ = 1.17.9 =
198
+ * Export now can be ordered using an attribute in the shortcode
199
+
200
+ = 1.17.8.4 =
201
+ * Bug fixed in WP User Manager addon
202
+
203
+ = 1.17.8.3 =
204
+ * Export shortcode parameter column now also defines the order of the columns
205
+
206
+ = 1.17.8.2 =
207
+ * Password documentation updated
208
+ * New hooks added for filtering from and to user_registered date in export acui_export_user_registered_from_date and acui_export_user_registered_to_date
209
+
210
+ = 1.17.8.1 =
211
+ * Ready for WordPress 5.8
212
+
213
+ = 1.17.8 =
214
+ * Array with string keys now can be imported using this syntax inside your CSV cell: key1=>value1::key2=>value2::key3=>value3
215
+ + Improved the way that "Extra profile information" is shown in users profiles to be able to show arrays without notices
216
+
217
+ = 1.17.7 =
218
+ * 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
219
+
220
+ = 1.17.6.3 =
221
+ * Fixed bug in WP User Manager addon
222
+
223
+ = 1.17.6.2 =
224
+ * Objects in CSV can now be printed using serialization
225
+
226
+ = 1.17.6.1 =
227
+ * Force users to reset their passwords is also compatible with WP User Manager forms
228
+ * Improved the way data to replace is searched preparing the emails
229
+ * Improved the way some data is shown to prevent notices from array to string conversions
230
+
231
+ = 1.17.6 =
232
+ * Now you can filter the columns that are going to be exported using the shortcode and the attribute columns
233
+
234
+ = 1.17.5.7 =
235
+ * Email templates are being sent translated in the current WPML language if column locale is not set
236
+ * Warning fixed in ACF addon
237
+
238
+ = 1.17.5.6 =
239
+ * Frontend force reset password fixed
240
+
241
+ = 1.17.5.5 =
242
+ * Frontend settings GUI improved
243
+ * Force users to reset their passwords after login also available for frontend import
244
+ * Fixed issue created in 1.17.5.4 saving options in frontend when import started
245
+
246
+ = 1.17.5.4 =
247
+ * Solved this issue https://wordpress.org/support/topic/password-gets-changed/
248
+ * Solved this issue https://wordpress.org/support/topic/users-without-an-email-address-are-imported/
249
+ * Others issues solved
250
+
251
+ = 1.17.5.3 =
252
+ * You can now force the users to reset their passwords after login if you have changed the password in the import
253
+ * Some code improvements
254
+
255
+ = 1.17.5.2 =
256
+ * New hooks into shortcode form to enable include actions from there
257
+
258
+ = 1.17.5.1 =
259
+ * New action class introduced to make easier to use options into the plugin
260
+ * Path to file in homepage tab, now it is saved to prevent to rewrite it in every import
261
+
262
+ = 1.17.5 =
263
+ * Fixed problems importing avatar from WP User Avatar
264
+ * Avatars using WP User Avatar can now be exported
265
+ * Some code improvements
266
+
267
+ = 1.17.4.4 =
268
+ * Problems importing BuddyPress Groups solved
269
+
270
+ = 1.17.4.3 =
271
+ * BuddyPress member type import fixed
272
+ * Little improvement in export GUI
273
+
274
+ = 1.17.4.2 =
275
+ * Frontend import email now can have a list of custom recipients, different to admin email
276
+
277
+ = 1.17.4.1 =
278
+ * Process import results shown in a table at the end of process
279
+
280
+ = 1.17.4 =
281
+ * New shortcode to export users
282
+
283
+ = 1.17.3.6 =
284
+ * Fixed problem importing ACF multiple select field type, thanks to @lpointet
285
+
286
+ = 1.17.3.5 =
287
+ * Fixed warning on export
288
+
289
+ = 1.17.3.4 =
290
+ * Tested up to 5.7
291
+ * New method to fix error when a WP_Error appear into an array, when the array is being printed
292
+
293
+ = 1.17.3.3 =
294
+ * Improved messages when deleting users not present in CSV
295
+ * Fixed error when a WP_Error appear into an array, when the array is being printed
296
+
297
+ = 1.17.3.2 =
298
+ * Improved BuddyPress group management when importing, now you can remove users from a group
299
+ * Improved BuddyPress import, now you can use group ids and not only group slugs
300
+
301
+ = 1.17.3.1 =
302
+ * New filter to override default permission_callback in rest-api method to call cron
303
+
304
+ = 1.17.3 =
305
+ * New feature added actions, now you can assign posts while you are importing users
306
+ * Code improvements
307
+
308
+ = 1.17.2.1 =
309
+ * Addon included for WP User Manager - WPUM Groups
310
+ * BuddyPress addon improved
311
+
312
+ = 1.17.2 =
313
+ * New addon included for WPML
314
+ * Email templates are being sent translated if you use the "locale" column in your CSV, so every user will receive the email translated in their own langauge
315
+
316
+ = 1.17.1.6 =
317
+ * Warning solved, it appears sometimes importing in strtolower operation over roles
318
+
319
+ = 1.17.1.5 =
320
+ * Bugs fixed exporting users
321
+
322
+ = 1.17.1.4 =
323
+ * Roles are always managed as small letters to minimize problems writing them
324
+ * Fixed bug exporting metadata that are objects
325
+ * Included new filter in prepare export value
326
+
327
+ = 1.17.1.3 =
328
+ * Fixed bug in mail templates when wp_editor is disabled
329
+
330
+ = 1.17.1.2 =
331
+ * In multisite, default role is subscriber if this is not set
332
+
333
+ = 1.17.1.1 =
334
+ * In multisite, user is added to current blog with role subscriber if user choose to no update roles but the user does not exist there
335
+
336
+ = 1.17.1 =
337
+ * New errors, warnings and notices reporting methods
338
+ * DataTable used to improve data visualization
339
+
340
+ = 1.17.0.4 =
341
+ * Included an addon for LearnDash to explain how to proceed with an import of students
342
+
343
+ = 1.17.0.3 =
344
+ * Fixed problem with BuddyPress addon and BP_Groups_Member class
345
+
346
+ = 1.17.0.2 =
347
+ * New version released
348
+
349
+ = 1.17.0.1 =
350
+ * Bug fixed importing users
351
+
352
+ = 1.17 =
353
+ * Many code changes, making it simpler to include more features and make it easier to debug in a future
354
+ * Export bug fixed: the plugin exports an empty role column that breaks the CSV
355
+ * You can now test cron task from the "Cron" settings tab
356
+
357
+ = 1.16.4.1 =
358
+ * Fixed problem in "Mail options" that does not allow to remove attachments
359
+
360
+ = 1.16.4 =
361
+ * You can choose what to do with users that being updated, their email has changed: you can update it, skip this user, or create a new user with a prefix
362
+
363
+ = 1.16.3.6 =
364
+ * When you are exporting data we scape every first data if it starts with a +, -, =, and @ including a \ to prevent any unwanted formula execution in a spreadsheet that will be working with the CSV
365
+
366
+ = 1.16.3.5 =
367
+ * New option in standard import to choose if passwords should be updated when updating users
368
+
369
+ = 1.16.3.4 =
370
+ * Export data can now be ordered alphabetically
371
+
372
+ = 1.16.3.3 =
373
+ * Extra profile fields now can be used also when registering a new user
374
+
375
+ = 1.16.3.2 =
376
+ * Username now can be empty, in this case, we generate random usernames
377
+ * Code improvements
378
+
379
+ = 1.16.3.1 =
380
+ * BuddyPress/BuddyBoss avatar can now be imported
381
+ * Code improvements
382
+
383
+ = 1.16.3 =
384
+ * Now you can use HTML emails
385
+ * Code improvements
386
+
387
+ = 1.16.2 =
388
+ * Email sending function created
389
+ * Test email button included
390
+
391
+ = 1.16.1.5 =
392
+ * Fixed problem importing ACF textarea and other type fields
393
+
394
+ = 1.16.1.4 =
395
+ * Fixed problem importing ACF text fields
396
+
397
+ = 1.16.1.3 =
398
+ * BuddyPress member type is now included in the export
399
+
400
+ = 1.16.1.2 =
401
+ * Usability improve when using delete users not present in CSV (change role options is disabled because they can't run)
402
+ * Performance optimization, if user is deleted, it cannot be tried to change role
403
+
404
+ = 1.16.1.1 =
405
+ * New wildcards included in emails for WooCommerce: woocommercelostpasswordurl, woocommercepasswordreseturl and woocommercepasswordreseturllink
406
+
407
+ = 1.16.1 =
408
+ * Multisite check and fix issues
409
+ * Addon to include compatibility included Paid Member Subscriptions by Cozmoslabs thanks to Marian Lowe
410
+
411
+ = 1.16 =
412
+ * Code is being rewritten to make it easy to update
413
+ * New filter added to override the necessary capatibily to use the plugin
414
+
415
+ = 1.15.9.2 =
416
+ * We try to make the plugin compatible with BuddyPress related themes and plugins that uses their functions but they are not BuddyPress really
417
+ * Problems exporting file when a site is behind CloudFare fixed
418
+
419
+ = 1.15.9.1 =
420
+ * You can now export data from BuddyPress groups
421
+ * BuddyPress addon is now a class instead of different methods
422
+
423
+ = 1.15.9 =
424
+ * You can now export data from BuddyPress fields
425
+
426
+ = 1.15.8.1 =
427
+ * Added shipping_phone as non date key to avoid datetime conversion
428
+
429
+ = 1.15.8 =
430
+ * REST API endpoint added to execute cron calling the site remotely
431
+
432
+ = 1.15.7.4 =
433
+ * Problems with apostrophes solved
434
+
435
+ = 1.15.7.3 =
436
+ * Tested up to WordPress 5.5
437
+ * Improvements in timestamp data export
438
+
439
+ = 1.15.7.2 =
440
+ * UTF-8 fixed exporting users
441
+
442
+ = 1.15.7.1 =
443
+ * Bug fixed: after importing new customers, new WooCommerce tables was not populated properly and they were not shown in the "Customers" list into WooCommerce, thanks for reporting @movementoweb (https://wordpress.org/support/topic/usuarios-importados-con-rol-de-cliente-customer-no-se-muestran-en-woocommerce/)
444
+
445
+ = 1.15.7 =
446
+ * Addon included to import data defined by WooCommerce Custom Fields by Rightpress
447
+
448
+ = 1.15.6.8 =
449
+ * Cron import fixed. It failed because of get_editable_roles was not declared in cron import
450
+ * Check if role exists in order to show a better message when importing
451
+
452
+ = 1.15.6.7 =
453
+ * A non-user admin could delete himself automatically deleting users not present in CSV (thanks again to @nonprofitweb https://wordpress.org/support/topic/non-admin-user-can-delete-self/#post-12950734)
454
+ * Improved "Users only can import users with a role that they allowed to edit" thanks also to @nonprofitweb
455
+ * Forms has now classes to be able to customize the way they are shown using CSV thanks again to @nonprofitweb
456
+
457
+ = 1.15.6.6 =
458
+ * Added multiple hooks to filter all about emails being sent when importing
459
+ * Included new variables in hooks that already exists in emails being sent when importing
460
+
461
+ = 1.15.6.5 =
462
+ * Users only can import users with a role that they allowed to edit (thanks to @nonprofitweb https://wordpress.org/support/topic/import-user-with-higher-role/)
463
+
464
+ = 1.15.6.4 =
465
+ * Now you can use variables also in Subject, thanks to @vbarrier (https://wordpress.org/support/topic/use-variables-also-in-subject/)
466
+
467
+ = 1.15.6.3 =
468
+ * Problems with roles being updated that should not be updated in multisite fixed
469
+
470
+ = 1.15.6.2 =
471
+ * Export checkbox included to avoid conversion to date format to prevent problem with some data converted that should not be converted
472
+
473
+ = 1.15.6.1 =
474
+ * ACF addon now append values instead of replacing it
475
+
476
+ = 1.15.6 =
477
+ * ACF compatibility included
478
+
479
+ = 1.15.5.13 =
480
+ * var_dump forgotten
481
+ * Up to version updated
482
+
483
+ = 1.15.5.12 =
484
+ * Bug fixed in BuddyPress importer
485
+ * Little improvement in extra profile fields
486
+
487
+ = 1.15.5.11 =
488
+ * Deletion process performance improved
489
+ * Now you can specify if only want to delete users of specified role using a new attribute in the frontend import
490
+
491
+ = 1.15.5.10 =
492
+ * Extra profile fields now can be reseted
493
+
494
+ = 1.15.5.9 =
495
+ * Array to string conversion fixed in emails being sent
496
+ * Problems importing data from WooCommerce Membership fixed (thanks to grope-ecomedia)
497
+
498
+ = 1.15.5.8 =
499
+ * Export improved to avoid more data to be exported as date
500
+ * Tested up to WordPress 4.0
501
+
502
+ = 1.15.5.7 =
503
+ * List of hooks created and included
504
+
505
+ = 1.15.5.6 =
506
+ * In export, now user id is called "source_user_id" to avoid problems importing
507
+
508
+ = 1.15.5.5 =
509
+ * Groups can be now imported by their name instead only of their ids
510
+
511
+ = 1.15.5.4 =
512
+ * Bug fixed in frontend import, roles being updated when it shouldn't be updated thanks to @widevents for reporting (https://wordpress.org/support/topic/change-role-of-users-that-are-not-present-in-the-csv-works-without-ckeckbox-on/)
513
+
514
+ = 1.15.5.3 =
515
+ * Email notification can be sent to administrator of the website when someone use the frontend importer
516
+ * Code improvement
517
+
518
+ = 1.15.5.2 =
519
+ * Bug found on export fixed
520
+
521
+ = 1.15.5.1 =
522
+ * MailPoet addon included (in previous we forgot to include the file)
523
+
524
+ = 1.15.5 =
525
+ * MailPoet addon added to include users in list when they are being imported
526
+
527
+ = 1.15.4.4 =
528
+ * New filter to override message when file is bad formed
529
+
530
+ = 1.15.4.3 =
531
+ * Duplicate email error thrown updating users
532
+
533
+ = 1.15.4.2 =
534
+ * New filters added
535
+
536
+ = 1.15.4.1 =
537
+ * Double email fixed
538
+
539
+ = 1.15.4 =
540
+ * WooCommerce Subscriptions importer included to create subscriptions at the same time you are importing users
541
+ * New hooks added
542
+ * Code improved
543
+
544
+ = 1.15.3.6 =
545
+ * New shortcut into WordPress importer and exporter default tools to find this one easier
546
+
547
+ = 1.15.3.5 =
548
+ * Bug fixed in "Mail options"
549
+
550
+ = 1.15.3.4 =
551
+ * You can now use WordPress default user edited and created emails when importing users
552
+ * WooCommerce Membership by RightPress compatibility included, now you can assign users to their plan while they are being imported
553
+
554
+ = 1.15.3.3 =
555
+ * WooCommerce Membership addon improved, now you can only assign users to a plan using the membership_plan_id
556
+
557
+ = 1.15.3.2 =
558
+ * Bug fixed
559
+
560
+ = 1.15.3.1 =
561
+ * Role included in export
562
+ * test.csv improved
563
+ * Different code improvements
564
+
565
+ = 1.15.3 =
566
+ * Multisite compatiility improved now you can assign users to blogs after import
567
+
568
+ = 1.15.2.3 =
569
+ * Fixes some issues exporting date and time values
570
+
571
+ = 1.15.2.2 =
572
+ * Part of the code of frontend has been rewritten to improve readibility
573
+ * New options in frontend upload
574
+
575
+ = 1.15.2.1 =
576
+ * Changed name into repository to describe better what plugin does
577
+ * Frontend shortcode now accepts role parameter
578
+
579
+ = 1.15.2 =
580
+ * You can now select which delimiter is used in the CSV exports and also you can choose the date time format in date time and timestamps date
581
+
582
+ = 1.15.1.1 =
583
+ * You can now filter users that are being exported by role and user registered date
584
+
585
+ = 1.15.1 =
586
+ * New tab with a list of all meta keys found in the database, with the type of it and an example to be able to use it in your imports
587
+
588
+ = 1.15.0.1 =
589
+ * Only users who can create users, can export them
590
+
591
+ = 1.15 =
592
+ * Export option included
593
+
594
+ = 1.14.3.10 =
595
+ * Changed the way HTML emails are declared to prevent problems with plugins like WP HTML Mail
596
+
597
+ = 1.14.3.9 =
598
+ * Included compatibility with WP User Avatar to import avatar images while the import is being executed, thanks to the support of cshaffstall.com
599
+
600
+ = 1.14.3.8 =
601
+ * user_login and show_admin_bar_front are included as WordPress core fields to avoid showing it as custom meta_keys thanks to
602
+ Michael Finkenberger
603
+
604
+ = 1.14.3.7 =
605
+ * New filters added to custom message shown in log or regular import
606
+ * Last roles used are remembered in import, to avoid you have to choose all time different roles
607
+
608
+ = 1.14.3.6 =
609
+ * Fixed a problem with a nonce that was bad named
610
+
611
+ = 1.14.3.5 =
612
+ * Removed some tags when printing log in cron job
613
+ * Improved error message with Customer Area Addon
614
+
615
+ = 1.14.3.4 =
616
+ * Fixed other problem thanks to @alexgav (https://wordpress.org/support/topic/issue-in-cron-import-tab/)
617
+
618
+ = 1.14.3.3 =
619
+ * Fixed some problems thanks to @alexgav (https://wordpress.org/support/topic/issue-in-cron-import-tab/)
620
+
621
+ = 1.14.3.2 =
622
+ * Added CSS to fix table mobile view
623
+
624
+ = 1.14.3.1 =
625
+ * Problems uploading users from fronted fixed
626
+
627
+ = 1.14.3 =
628
+ * Filter added to fix CSV files upload problems
629
+
630
+ = 1.14.2.12 =
631
+ * Typos fixed thanks to https://wordpress.org/support/topic/typo-in-the-settings-page/
632
+
633
+ = 1.14.2.11 =
634
+ * Problem using "Yes, add new roles and not override existing one" was fixed
635
+
636
+ = 1.14.2.10 =
637
+ * Change period was not working if you did not deactivate first the cron job, now it is solved and you can do it without deactivating cron job
638
+
639
+ = 1.14.2.9 =
640
+ * Role default problem fixed thanks for all the one who notice the bug
641
+
642
+ = 1.14.2.8 =
643
+ * Addon to import groups of Customer Area Managed Area included
644
+
645
+ = 1.14.2.7 =
646
+ * Removed old code parts from SMTP settings that now are not available and could create warnings
647
+
648
+ = 1.14.2.6 =
649
+ * Problem fixed deleting old CSV files
650
+
651
+ = 1.14.2.5 =
652
+ * Problem fixed in cron job
653
+
654
+ = 1.14.2.4 =
655
+ * HTML problems fixed
656
+
657
+ = 1.14.2.3 =
658
+ * Global variable with url of plugin removed
659
+
660
+ = 1.14.2.2 =
661
+ * More nonces included
662
+
663
+ = 1.14.2.1 =
664
+ * Directory traversal attack prevented
665
+
666
+ = 1.14.2 =
667
+ * Authenticated Media Deletion Vulnerability fixed in acui_bulk_delete_attachment
668
+ * Nonces incorporated in different AJAX and forms to improve security
669
+ * Media type of media deleted check to avoid problems deleting files
670
+ * SMTP configuration removed completely, we recommend to use a SMTP plugin if you need it in the future, this part was deprecated some versions ago
671
+ * plugins_url() now is well called so images, files and other assets will be shown properly in all cases
672
+ * Data is sanitized always to prevent security and user problems
673
+
674
+ = 1.14.1.3 =
675
+ * XSS problem fixed when displaying data imported
676
+
677
+ = 1.14.1.2 =
678
+ * New Spanish hosting partner included
679
+ * Link added to new review
680
+
681
+ = 1.14.1.1 =
682
+ * We have changed some empty() check to === '' check, to avoid problems with values like blank spaces (thanks to https://wordpress.org/support/topic/not-importing-fields-with-just-spaces/#post-11597406)
683
+
684
+ = 1.14.1 =
685
+ * Compatibility with Groups plugin (https://es.wordpress.org/plugins/groups/)
686
+
687
+ = 1.14.0.9 =
688
+ * WP-CLI does not manage our previous version
689
+ * New tab "New features" added
690
+
691
+ = 1.14.0.8.1 =
692
+ * Bug fixed
693
+
694
+ = 1.14.0.8 =
695
+ * **passwordreseturllink** shows reset password url with a link in HTML
696
+
697
+ = 1.14.0.7 =
698
+ * Filter improved to avoid strange characters in emails
699
+
700
+ = 1.14.0.6 =
701
+ * Notice fixed from last change
702
+
703
+ = 1.14.0.5 =
704
+ * Role now is not required when importing
705
+
706
+ = 1.14.0.4 =
707
+ * Fix to save email options bug (that appeared in last version)
708
+
709
+ = 1.14.0.3 =
710
+ * Security fixes to prevent Reflected Cross Site Scripting (XSS) and Cross Site Request Forgery (CSRF), thanks to Application Security for reporting
711
+
712
+ = 1.14.0.2 =
713
+ * get_users used memory improved filtering fields returned, thanks to @shortcutsolutions (https://wordpress.org/support/topic/import-page-no-longer-has-submit-button/#post-11309862)
714
+
715
+ = 1.14.0.1 =
716
+ * Echo removed from class to prevent message on activation
717
+
718
+ = 1.14 =
719
+ * Options management improved
720
+ * GUI improved
721
+ * Now you can change the role of users that are not in the CSV file thanks to California Advocates Management Services
722
+
723
+ = 1.13.2 =
724
+ * Attachments in email templates and mail options now can be deleted thanks to Joel Frankwick
725
+
726
+ = 1.13.1 =
727
+ * Email templates loads also the attachment in Mail options when they are selected thanks to Joel Frankwick
728
+
729
+ = 1.13 =
730
+ * Now you can delete users that are not in the CSV file, not only when you are doing an import based on a cron task, but also when you do it from the dashboard or with the shortcode in the frontend thanks to mojosolo.com
731
+ * Documentation improved
732
+ * Bug fixed
733
+ * Tested up to 5.1
734
+
735
+ = 1.12.6.2 =
736
+ * Notices fixed
737
+ * Some file deleted and some urls fixed
738
+
739
+ = 1.12.6.1 =
740
+ * Plugin is now compatible with plugins that change login url, thanks to @2candela2 (https://wordpress.org/support/topic/make-it-compatible-with-plugins-that-change-login-url/)
741
+
742
+ = 1.12.6 =
743
+ * wpml-config.xml added to improve compatibility with WPML
744
+ * Warnings fixed
745
+
746
+ = 1.12.5.1 =
747
+ * Fixed some files that were not included in the trunk
748
+
749
+ = 1.12.5 =
750
+ * New addon added thanks to @egraznov in order to make possible to import data from LifterLMS
751
+
752
+ = 1.12.4 =
753
+ * New hooks added to make possible to include new tabs from an addon
754
+
755
+ = 1.12.3.1 =
756
+ * Fatal error fixed in frontend tab
757
+
758
+ = 1.12.3 =
759
+ * Integration with Paid Membership Pro improved thanks to @joneiseman (https://wordpress.org/support/topic/import-paid-membership-pro-fields-not-working/#post-11110984)
760
+
761
+ = 1.12.2.3 =
762
+ * Readme updated
763
+
764
+ = 1.12.2.2 =
765
+ * Readme fixed
766
+
767
+ = 1.12.2.1 =
768
+ * SMTP settings removed, old link was yet placed and caused misunderstandings, thanks to @paulabender for the notice
769
+ * Tested up to WordPress 5.0.3
770
+
771
+ = 1.12.2 =
772
+ * Extra check to avoid problems with CSV bad formed
773
+ * Plugin can now manage attachments in email sending and email templates thanks to Immersedtechnologies
774
+ * Part of the code has been rewritten using classes
775
+ * We have changed the way of detecting the delimiter (thanks to @chaskinsuk https://wordpress.org/support/topic/detect-delimiter-fails-with-serialized-data/)
776
+
777
+ = 1.12.1 =
778
+ * Filter added to avoid script inside values of each cells to prevent XSS attacks, thanks for reporting Slawek Zytko
779
+
780
+ = 1.12 =
781
+ * Plugin can now manage email templates for managing mails which are sent to users thanks to Immersedtechnologies
782
+
783
+ = 1.11.3.17 =
784
+ * Documentation improved with some notes about roles management thanks to @stephenfourie (https://wordpress.org/support/topic/user-role-always-set-as-administrator/)
785
+
786
+ = 1.11.3.16 =
787
+ * Redeclaration of str_getcsv removed, this is not necessary because of all new PHP versions contains it
788
+
789
+ = 1.11.3.15 =
790
+ * Filters included for auto password generated
791
+ * Tested up to WordPress 5.0
792
+
793
+ = 1.11.3.14 =
794
+ * Empty email check added thanks to @malcolm-oph (https://wordpress.org/support/topic/blank-email-field-in-csv-data-not-detected/)
795
+
796
+ = 1.11.3.13 =
797
+ * Mail address with data of users can now be overriden thanks to a new filter
798
+
799
+ = 1.11.3.12 =
800
+ * Plugin is now compatible with Vimeo Sync Membership thanks to Justin Snavely
801
+
802
+ = 1.11.3.11 =
803
+ * Now you can use the WordPress loaded schedules in the cron import instead of the three default one thanks to PM2S
804
+ * Mail cron sending fixed issues
805
+
806
+ = 1.11.3.10 =
807
+ * New hooks added thanks to Joel Frankwick in order to make possible to change default wp_mail() headers
808
+
809
+ = 1.11.3.9 =
810
+ * New hooks added thanks to @malcolm-oph (https://wordpress.org/support/topic/using-filters-to-add-data-columns/)
811
+
812
+ = 1.11.3.8.1 =
813
+ * Fixed bug thanks to @xenator for discovering the bug (https://wordpress.org/support/topic/uncaught-error-while-importing-users/#post-10618130)
814
+
815
+ = 1.11.3.8 =
816
+ * Fixed mail sending in frontend import
817
+ * Now you can activate users with WP Members in frontend import
818
+ * Some fixes and warnings added
819
+
820
+ = 1.11.3.7 =
821
+ * Fixes and improvements thanks to @malcolm-oph
822
+
823
+ = 1.11.3.6 =
824
+ * Role import working in cron jobs
825
+
826
+ = 1.11.3.5 =
827
+ * SMTP tab hidden for user which are not using this option
828
+
829
+ = 1.11.3.4 =
830
+ * Bug fixed: thanks to @oldfieldmike for reporting and fixing a bug present when BuddyPress was active (https://wordpress.org/support/topic/bp_xprofile_group/#post-10265833)
831
+
832
+ = 1.11.3.3 =
833
+ * Added compatibility to import levels from Indeed Ultimate Membership Pro
834
+ * Fixed role problems when importing
835
+
836
+ = 1.11.3.2 =
837
+ * Patreon link included and some other improvements to make easier support this develop
838
+ * Deprecated notices included about SMTP settings in this plugin
839
+
840
+ = 1.11.3.1 =
841
+ * Thanks to Sebastian Mellmann(@xenator) a bug have been solved in password management in new users
842
+
843
+ = 1.11.3 =
844
+ * Thanks to @xenator you can now import users with Allow Multiple Accounts with same Mail via cron
845
+
846
+ = 1.11.2 =
847
+ * Problem with WordPress default emails fixed
848
+
849
+ = 1.11.1 =
850
+ * Sidebar changed
851
+ * Readme completed
852
+
853
+ = 1.11 =
854
+ * You can now import users from the frontend using a shortcode thanks to Nelson Artz Group GmbH & Co. KG
855
+
856
+ = 1.10.13 =
857
+ * You can now import User Groups (https://wordpress.org/plugins/user-groups/) and assign them to the users
858
+
859
+ = 1.10.12 =
860
+ * You can now import WP User Groups (https://es.wordpress.org/plugins/wp-user-groups/) and assign them to the users thanks to the support of Arturas & Luis, Lda.
861
+
862
+ = 1.10.11.1 =
863
+ * Debug notice shown fixed (thanks for submiting the bug @anieves (https://wordpress.org/support/topic/problem-using-wp-members-with-import-users-from-csv-2/#post-10035037)
864
+
865
+ = 1.10.11 =
866
+ * Administrator are not deleted in cron task
867
+ * Some hashed passwords was not being imported correctly because of wp_unslash() function into wp_insert_user(), issue fixed
868
+
869
+ = 1.10.10 =
870
+ * Thanks to Attainable Adventure Cruising Ltd now the system to import passwords hashed directly from the CSV has been fixed
871
+ * Thanks to Kevin Price-Ward and Peri Lane now the system does not include the default role when creating a new user
872
+ * Plugin tested up to WordPress 4.9.4
873
+
874
+ = 1.10.9.1 =
875
+ * Thanks to @lucile-agence-pulsi for reporting a bug (https://wordpress.org/support/topic/show-extra-profile-fields/) now this is solved
876
+
877
+ = 1.10.9 =
878
+ * Thanks to the support of Studio MiliLand (http://www.mililand.com) we can now import data to Paid Membership Pro Plugin
879
+
880
+ = 1.10.8.2 =
881
+ * Thanks to @Carlos Herrera we can now import date fields from BuddyPress
882
+
883
+ = 1.10.8.1 =
884
+ * Bug fixed
885
+
886
+ = 1.10.8 =
887
+ * New system for include addons
888
+ * You can now import data from WooCommerce Membership thanks to Lukas from Kousekmusic.cz
889
+ * Tested up to WordPress 4.9
890
+
891
+ = 1.10.7.5 =
892
+ * Bug solved in cron import, now mails not being sent to user who are being updated unless you activate those mails
893
+
894
+ = 1.10.7.4 =
895
+ * Plugin now remember if user has selected or not mail sending when doing a manual import, to select by default this option next time
896
+
897
+ = 1.10.7.3 =
898
+ * Some of the plugins options are disabled by default to prevent unwanted mail sending
899
+
900
+ = 1.10.7.2 =
901
+ * Improve email notification disable
902
+
903
+ = 1.10.7.1 =
904
+ * Sending mail in standard import bug solved, thanks to @manverupl for the error report.
905
+
906
+ = 1.10.7 =
907
+ * New feature thanks to Todd Zaroban (@tzarob) now you can choose if override or not current roles of each user when you are updating them
908
+ * Problem solved in repeated email module thanks to @damienper (https://wordpress.org/support/topic/error-in-email_repeated-php/)
909
+ * Problem solved in mail sending with cron thanks to @khansadi (https://wordpress.org/support/topic/no-email-is-sent-to-new-users-when-created-via-corn-import/)
910
+
911
+ = 1.10.6.9 =
912
+ * Thanks to Peri Lane from Apis Productions you can now import roles from CSV. Read documentation to see the way to work.
913
+
914
+ = 1.10.6.8.1 =
915
+ * Thanks to @fiddla for debugging all this, as update_option with a value equals to true is saved as 1 in the database, we couldn't use the ==! or === operator to see if the option was active or not. Sorry for so many updates those days with this problems and thanks for the debugging
916
+
917
+ = 1.10.6.8 =
918
+ * Bug fixed (now yes) when moving file including date and time thanks to @fiddla
919
+
920
+ = 1.10.6.7 =
921
+ * Bug fixed when moving file including date and time
922
+
923
+ = 1.10.6.6 =
924
+ * Bug fixed thanks to @ov3rfly (https://wordpress.org/support/topic/wrong-path-to-users-page-after-import/)
925
+ * Documentation also included in home page of the plugins thanks to suggestions and threads in forum
926
+
927
+ = 1.10.6.5 =
928
+ * If multisite is enabled it adds the user to the blog thanks to Rudolph Koegelenberg
929
+ * Tested up to 4.8
930
+
931
+ = 1.10.6.4 =
932
+ * Documentation fixed: if user id is present in the CSV but not in the database, it cannot be used to create a new user
933
+
934
+ = 1.10.6.3 =
935
+ * New hook added do_action('post_acui_import_single_user', $headers, $data, $user_id );
936
+
937
+ = 1.10.6.2 =
938
+ * Added documentation about locale and BuddyPress Extendend Profile
939
+ * Header changed to avoid any problem about plugin header
940
+
941
+ = 1.10.6.1 =
942
+ * Fix error in importer.php about delete users (https://wordpress.org/support/topic/wp_delete_user-undefined/#post-8925051)
943
+
944
+ = 1.10.6 =
945
+ * Now you can hide the extra profile fields created with the plugin thanks to Steph O'Brien (Ruddy Good)
946
+
947
+ = 1.10.5 =
948
+ * Now you can import list of elements using :: as separator and it can also be done in BuddyPress profile fields thanks to Jon Eiseman
949
+ * Fixes in SMTP settings
950
+ * SMTP settings now is a new tab
951
+
952
+ = 1.10.4 =
953
+ * Now you can assign BuddyPress groups and assign roles in import thanks to TNTP (tntp.org)
954
+ * Import optimization
955
+ * Readme fixed
956
+
957
+ = 1.10.3.1 =
958
+ * Bug fixed in SMTP settings page
959
+
960
+ = 1.10.3 =
961
+ * Plugin is now prepared for internacionalization using translate.wordpress.org
962
+
963
+ = 1.10.2.2 =
964
+ * German translation fixed thanks to @mfgmicha
965
+ * locale now is considered a data from WordPress user so it won't be shown in profiles
966
+
967
+ = 1.10.2.1 =
968
+ * German translation fixed thanks to @barcelo
969
+ * System compatibility updated
970
+
971
+ = 1.10.2 =
972
+ * New User Approve support fixed thanks to @stephanemartinw (https://wordpress.org/support/topic/new-user-approve-support/#post-8749012)
973
+
974
+ = 1.10.1 =
975
+ * Plugin can now import serialized data.
976
+ * New filter added: $data[$i] = apply_filters( 'pre_acui_import_single_user_single_data', $data[$i], $headers[$i], $i); now you can manage each single data for each user, maybe easier to use than pre_acui_import_single_user_data
977
+
978
+
979
+ = 1.9.9.9 =
980
+ * Now you can automatically rename file after move it. Then you won't lost any file you have imported (thanks to @charlesgodwin)
981
+
982
+ = 1.9.9.8 =
983
+ * Password bug fixed. Now it works as it should (like it is explained in documentation)
984
+
985
+ = 1.9.9.7 =
986
+ * Bug fixed in importer now value 0 is not considered as empty thanks to @lafare (https://wordpress.org/support/topic/importing-values-equal-to-0/#post-8609191)
987
+
988
+ = 1.9.9.6 =
989
+ * From now we are going to keep old versions available in repository
990
+ * We don't delete loaded columns (and fields) when you deactivate the plugin
991
+ * Password is not auto generated when updating user in order to avoid problems (missing password column and update create new passwords and use to create problems)
992
+
993
+ = 1.9.9.5 =
994
+ * Now you can set the email to empty in each row thanks to @sternhagel
995
+
996
+ = 1.9.9.4 =
997
+ * German language added thanks to Wolfgang Kleinrath
998
+ * Added conditional to avoid error on mail sending
999
+
1000
+ = 1.9.9.3 =
1001
+ * Now you can choose if you want to not assign a role to users when you are making an import cron
1002
+
1003
+ = 1.9.9.2 =
1004
+ * Now you can choose if you want to assign to some user the posts of the users that can be deleted in cron task
1005
+
1006
+ = 1.9.9.1 =
1007
+ * French translation added thanks to @momo-fr
1008
+
1009
+ = 1.9.9 =
1010
+ * Plugin now is localized using i18n thanks to code provided by Toni Ginard @toniginard
1011
+
1012
+ = 1.9.8.1 =
1013
+ * Bug fixed in cron import, nonce conditional check, thanks to Ville Kokkala for showing the bug
1014
+
1015
+ = 1.9.8 =
1016
+ * Password reset url is now available to include in body email thanks to Mary Wheeler (https://wordpress.org/support/users/ransim/)
1017
+
1018
+ = 1.9.7 =
1019
+ * Thanks to Bruce MacPherson we can now choose if we don't want update users roles when importing data if user exist
1020
+ * Clearer English thanks to Bruce MacPherson
1021
+
1022
+ = 1.9.6 =
1023
+ * Thanks to Jason Lewis we can now choose if we don't want update users when importing data if user exist
1024
+
1025
+ = 1.9.5 =
1026
+ * Important security fixes added thanks to pluginvulnerabilities.com
1027
+
1028
+ = 1.9.4.6 =
1029
+ * New filter added, thanks to @burton-nerd
1030
+
1031
+ = 1.9.4.5 =
1032
+ * Renamed function to avoid collisions thanks to the message of Jason Lewis
1033
+
1034
+ = 1.9.4.4 =
1035
+ * Fix for the last one, we set true where it was false and vice versa
1036
+
1037
+ = 1.9.4.3 =
1038
+ * We try to make it clear to choose if mails (the one we talked in 1.9.4.2) are being sent or not
1039
+
1040
+ = 1.9.4.2 =
1041
+ * Automatic WordPress emails sending deactivated by default when user is created or updated, thanks to Peter Gariepy
1042
+
1043
+ = 1.9.4.1 =
1044
+ * wpautop added again
1045
+
1046
+ = 1.9.4 =
1047
+ * user_pass can be imported directly hashed thanks to Bad Yogi
1048
+
1049
+ = 1.9.3 =
1050
+ * Now you can move file after cron, thanks to Yme Brugts for supporting this new feature
1051
+
1052
+ = 1.9.2 =
1053
+ * New hook added, thanks to borkenkaefer
1054
+
1055
+ = 1.9.1 =
1056
+ * Fix new feature thanks to bixul ( https://wordpress.org/support/topic/problems-with-user-xxx-error-invalid-user-id?replies=3#post-8572766 )
1057
+
1058
+ = 1.9 =
1059
+ * New feature thanks to Ken Hagen - V3 Insurance Partners LLC, now you can import users directly with his ID or update it using his user ID, please read documentation tab for more information about it
1060
+ * New hooks added thank to the idea of borkenkaefer, in the future we will include more and better hooks (actions and filters)
1061
+ * Compatibility with New User Approve fixed
1062
+
1063
+ = 1.8.9 =
1064
+ * Lost password link included in the mail template thanks to alex@marckdesign.net
1065
+
1066
+ = 1.8.8 =
1067
+ * Checkbox included in order to avoid sending mail accidentally on password change or user updated.
1068
+
1069
+ = 1.8.7.4 =
1070
+ * Documentation updated.
1071
+
1072
+ = 1.8.7.3 =
1073
+ * Autoparagraph in email text to solve problem about all text in the same line.
1074
+ * Tested up to 4.5.1
1075
+
1076
+ = 1.8.7.2 =
1077
+ * Bug in delete_user_meta solved thanks for telling us lizzy2surge
1078
+
1079
+ = 1.8.7.1 =
1080
+ * Bug in HTML mails solved
1081
+
1082
+ = 1.8.7 =
1083
+ * You can choose between plugin mail settings or WordPress mail settings, thanks to Awaken Solutions web design (http://www.awakensolutions.com/)
1084
+
1085
+ = 1.8.6 =
1086
+ * Bug detected in mailer settings, thanks to Carlos (satrebil@gmail.com)
1087
+
1088
+ = 1.8.5 =
1089
+ * Include code changed, after BuddyPress adaptations we break the SMTP settings when activating
1090
+
1091
+ = 1.8.4 =
1092
+ * Labels for mail sending were creating some misunderstandings, we have changed it
1093
+
1094
+ = 1.8.3 =
1095
+ * Deleted var_dump message to debug left accidentally
1096
+
1097
+ = 1.8.2 =
1098
+ * BuddyPress fix in some installation to avoid a fatal error
1099
+
1100
+ = 1.8.1 =
1101
+ * Now you have to select at least a role, we want to prevent the problem of "No roles selected"
1102
+ * You can import now BuddyPress fields with this plugin thanks to André Ihlar
1103
+
1104
+ = 1.8 =
1105
+ * Email template has an own custom tab thanks to Amanda Ruggles
1106
+ * Email can be sent when you are doing a cron import thanks to Amanda Ruggles
1107
+
1108
+ = 1.7.9 =
1109
+ * Now you can choose if you want to send the email to all users or only to creted users (not to the updated one) thanks to Remy Medranda
1110
+ * Compatibility with New User Approve (https://es.wordpress.org/plugins/new-user-approve/) included thanks to Remy Medranda
1111
+
1112
+ = 1.7.8 =
1113
+ * Metadata can be sent in the mail thanks to Remy Medranda
1114
+
1115
+ = 1.7.7 =
1116
+ * Bad link fixed and new links added to the plugin
1117
+
1118
+ = 1.7.6 =
1119
+ * Capability changed from manage_options to create_users, this is a better capatibily to this plugin
1120
+
1121
+ = 1.7.5 =
1122
+ * Bug solved when opening tabs, it were opened in incorrect target
1123
+ * Documentation for WooCommerce integration included
1124
+
1125
+ = 1.7.4 =
1126
+ * Bug solved when saving path to file in Cron Import (thanks to Robert Zantow for reporting)
1127
+ * New tabs included: Shop and Need help
1128
+ * Banner background from WordPress.org updated
1129
+
1130
+ = 1.7.3 =
1131
+ * Users which are not administrator now can edit his extra fields thanks to downka (https://wordpress.org/support/topic/unable-to-edit-imported-custom-profile-fields?replies=1#post-7595520)
1132
+
1133
+ = 1.7.2 =
1134
+ * Plugin is now compatible with WordPress Access Areas plugin (https://wordpress.org/plugins/wp-access-areas/) thanks to Herbert (http://remark.no/)
1135
+ * Added some notes to clarify the proper working of the plugin.
1136
+
1137
+ = 1.7.1 =
1138
+ * Bug solved. Thanks for reporting this bug: https://wordpress.org/support/topic/version-17-just-doesnt-work?replies=3#post-7538427
1139
+
1140
+ = 1.7 =
1141
+ * New GUI based on tabs easier to use
1142
+ * Thanks to Michael Lancey ( Mckenzie Chase Management, Inc. ) we can now provide all this new features:
1143
+ * File can now be refered using a path and not only uploading.
1144
+ * You can now create a scheduled event to import users regularly.
1145
+
1146
+ = 1.6.4 =
1147
+ * Bugs detected and solved thanks to a message from Periu Lane and others users, the problem was a var bad named.
1148
+
1149
+ = 1.6.3 =
1150
+ * Default action for empty values now is: leave old value, in this way we prevent unintentional deletions of meta data.
1151
+ * Included donate link in plugin.
1152
+
1153
+ = 1.6.2 =
1154
+ * Thanks to Carmine Morra (carminemorra.com) for reporting problems with <p> and <br/> tags in body of emails.
1155
+
1156
+ = 1.6.1 =
1157
+ * Thanks to Matthijs Mons: now this plugin is able to work with Allow Multiple Accounts (https://wordpress.org/plugins/allow-multiple-accounts/) and allow the possibility of register/update users with same email instead as using thme in this case as a secondary reference to the user as the username.
1158
+
1159
+ = 1.6 =
1160
+ * Now options that are only useful if some other plugin is activated, they will only show when those plugins were activated
1161
+ * Thanks to Carmine Morra (carminemorra.com) for supporting the next two big features:
1162
+ * New role manager: instead of using a select list, you can choose roles now using checkboxes and you can choose more than one role per user
1163
+ * SMTP server: you can send now from your WordPress directly or using a external SMTP server (almost all SMTP config and SMTP sending logic are based in the original one from WP Mail SMTP - https://wordpress.org/plugins/wp-mail-smtp/). When the plugin finish sending mail, reset the phpmailer to his previous state, so it won't break another SMTP mail plugin.
1164
+ * And this little one, you can use **email** in mail body to send to users their email (as it existed before: **loginurl**, **username**, **password**)
1165
+
1166
+ = 1.5.2 =
1167
+ * Thanks to idealien, if we use username to update users, the email can be updated as the rest of the data and metadata of the user and we silence the email changing message generated by core.
1168
+
1169
+ = 1.5.1 =
1170
+ * Thanks to Mitch ( mitch AT themilkmob DOT org ) for reporting the bug, now headers do not appears twice.
1171
+
1172
+ = 1.5 =
1173
+ * Thanks to Adam Hunkapiller ( of dreambridgepartners.com ) have supported all this new functionalities.
1174
+ * You can choose the mail from and the from name of the mail sent.
1175
+ * Mail from, from name, mail subject and mail body are now saved in the system and reused anytime you used the plugin in order to make the mail sent easier.
1176
+ * You can include all this fields in the mail: "user_nicename", "user_url", "display_name", "nickname", "first_name", "last_name", "description", "jabber", "aim", "yim", "user_registered" if you used it in the CSV and you indicate it the mail body in this way **FIELD_NAME**, for example: **first_name**
1177
+
1178
+ = 1.4.2 =
1179
+ * Due to some support threads, we have add a different background-color and color in rows that are problematic: the email was found in the system but the username is not the same
1180
+
1181
+ = 1.4.1 =
1182
+ * Thanks to Peri Lane for supporting the new functionality which make possible to activate users at the same time they are being importing. Activate users as WP Members plugin (https://wordpress.org/plugins/wp-members/) consider a user is activated
1183
+
1184
+ = 1.4 =
1185
+ * Thanks to Kristopher Hutchison we have add an option to choose what you want to do with empty cells: 1) delete the meta-data or 2) ignore it and do not update, previous to this version, the plugin update the value to empty string
1186
+
1187
+ = 1.3.9.4 =
1188
+ * Previous version does not appear as updated in repository, with this version we try to fix it
1189
+
1190
+ = 1.3.9.3 =
1191
+ * In WordPress Network, admins can now use the plugin and not only superadmins. Thanks to @jephperro
1192
+
1193
+ = 1.3.9.2 =
1194
+ * Solved some typos. Thanks to Jonathan Lampe
1195
+
1196
+ = 1.3.9.1 =
1197
+ * JS bug fixed, thanks to Jess C
1198
+
1199
+ = 1.3.9 =
1200
+ * List of old CSV files created in order to prevent security problems.
1201
+ * Created a button to delete this files directly in the plugin, you can delete one by one or you can do a bulk delete.
1202
+
1203
+ = 1.3.8 =
1204
+ * Fixed a problem with iterator in columns count. Thanks to alysko for their message: https://wordpress.org/support/topic/3rd-colums-ignored?replies=1
1205
+
1206
+ = 1.3.7 =
1207
+ * After upload, CSV file is deleted in order to prevent security issues.
1208
+
1209
+ = 1.3.6 =
1210
+ * Thanks to idealien for telling us that we should check also if user exist using email (in addition to user login). Now we do this double check to prevent problems with users that exists but was registered using another user login. In the table we show this difference, the login is not changed, but all the rest of data is updated.
1211
+
1212
+ = 1.3.5 =
1213
+ * Bug in image fixed
1214
+ * Title changed
1215
+
1216
+ = 1.3.4 =
1217
+ * Warning with sends_mail parameter fixed
1218
+ * Button to donate included
1219
+
1220
+ = 1.3.3 =
1221
+ * Screenshot updated, now it has the correct format. Thank to gmsb for telling us the problem with screenshout outdated
1222
+
1223
+ = 1.3.2 =
1224
+ * Thanks to @jRausell for solving a bug with a count and an array
1225
+
1226
+ = 1.3.1 =
1227
+ * WooCommerce fields integration into profile
1228
+ * Duplicate fields detection into profile
1229
+ * Thanks to @derwentx to give us the code to make possible to include this new features
1230
+
1231
+ = 1.3 =
1232
+ * This is the biggest update in the history of this plugin: mails and passwords generation have been added.
1233
+ * Thanks to @jRausell to give us code to start with mail sending functionality. We have improved it and now it is available for everyone.
1234
+ * Mails are customizable and you can choose
1235
+ * Passwords are also generated, please read carefully the documentation in order to avoid passwords lost in user updates.
1236
+
1237
+ = 1.2.3 =
1238
+ * Extra format check done at the start of each row.
1239
+
1240
+ = 1.2.2 =
1241
+ * Thanks to twmoore3rd we have created a system to detect email collisions, username collision are not detected because plugin update metadata in this case
1242
+
1243
+ = 1.2.1 =
1244
+ * Thanks to Graham May we have fixed a problem when meta keys have a blank space and also we have improved plugin security using filter_input() and filter_input_array() functions instead of $_POSTs
1245
+
1246
+ = 1.2 =
1247
+ * From this version, plugin can both insert new users and update new ones. Thanks to Nick Gallop from Weston Graphics.
1248
+
1249
+ = 1.1.8 =
1250
+ * Donation button added.
1251
+
1252
+ = 1.1.7 =
1253
+ * Fixed problems with \n, \r and \n\r inside CSV fields. Thanks to Ted Stresen-Reuter for his help. We have changed our way to parse CSV files, now we use SplFileObject and we can solve this problem.
1254
+
1255
+ = 1.2 =
1256
+ * From this version, plugin can both insert new users and update new ones. Thanks to Nick Gallop from Weston Graphics.
1257
+
1258
+ = 1.1.8 =
1259
+ * Donation button added.
1260
+
1261
+ = 1.1.7 =
1262
+ * Fixed problems with \n, \r and \n\r inside CSV fields. Thanks to Ted Stresen-Reuter for his help. We have changed our way to parse CSV files, now we use SplFileObject and we can solve this problem.
1263
+
1264
+ = 1.1.6 =
1265
+ * You can import now user_registered but always in the correct format Y-m-d H:i:s
1266
+
1267
+ = 1.1.5 =
1268
+ * Now plugins is only shown to admins. Thanks to flegmatiq and his message https://wordpress.org/support/topic/the-plugin-name-apears-in-dashboard-menu-of-non-aministrators?replies=1#post-6126743
1269
+
1270
+ = 1.1.4 =
1271
+ * Problem solved appeared in 1.1.3: sometimes array was not correctly managed.
1272
+
1273
+ = 1.1.3 =
1274
+ * As fgetscsv() have problems with non UTF8 characters we changed it and now we had problems with commas inside fields, so we have rewritten it using str_getcsv() and declaring the function in case your current PHP version doesn't support it.
1275
+
1276
+ = 1.1.2 =
1277
+ * fgetscsv() have problems with non UTF8 characters, so we have changed it for fgetcsv() thanks to a hebrew user who had problems.
1278
+
1279
+ = 1.1.1 =
1280
+ * Some bugs found and solved managing custom columns after 1.1.0 upgrade.
1281
+ * If you have problems/bugs about custom headers, you should deactivate the plugin and then activate it and upload a CSV file with the correct headers again in order to solve some problems.
1282
+
1283
+ = 1.1.0 =
1284
+ * WordPress user profile default info is now saved correctly, the new fields are: "user_nicename", "user_url", "display_name", "nickname", "first_name", "last_name", "description", "jabber", "aim" and "yim"
1285
+ * New CSV example created.
1286
+ * Documentation adapted to new functionality.
1287
+
1288
+ = 1.0.9 =
1289
+ * Bug with some UTF-8 strings, fixed.
1290
+
1291
+ = 1.0.8 =
1292
+ * The list of roles is generated reading all the roles avaible in the system, instead of being the default always.
1293
+
1294
+ = 1.0.7 =
1295
+ * Issue: admin/super_admin change role when file is too large. Two checks done to avoid it.
1296
+
1297
+ = 1.0.6 =
1298
+ * Issue: Problems detecting extension solved (array('csv' => 'text/csv') added)
1299
+
1300
+ = 1.0.5 =
1301
+ * Issue: Existing users role change, fixed
1302
+
1303
+ = 1.0.0 =
1304
+ * First release
1305
+
1306
+ == Upgrade Notice ==
1307
+
1308
+ = 1.0 =
1309
+ * First installation
1310
+
1311
+ == Frequently Asked Questions ==
1312
+
1313
+ = Columns position =
1314
+
1315
+ You should fill the first two columns with the next values: Username, Email.
1316
+
1317
+ The next columns are totally customizable and you can use whatever you want. All rows must contains same columns. User profile will be adapted to the kind of data you have selected. If you want to disable the extra profile information, please deactivate this plugin after make the import.
1318
+
1319
+ = id column =
1320
+
1321
+ You can use a column called id in order to make inserts or updates of an user using the ID used by WordPress in the wp_users table. We have two different cases:
1322
+
1323
+ * If id doesn't exist in your users table: WordPress core does not allow us insert it, so it will throw an error of kind: invalid_user_id
1324
+ * If id exists: plugin check if username is the same, if yes, it will update the data, if not, it ignores the cell to avoid problems
1325
+
1326
+ = Passwords =
1327
+
1328
+ We can use a column called "Password" to manage a string that contains user passwords. We have different options for this case:
1329
+
1330
+ * If you don't create a column for passwords: passwords will be generated automatically
1331
+ * If you create a column for passwords: if cell is empty, password won't be updated; if cell has a value, it will be used
1332
+
1333
+ = Serialized data =
1334
+
1335
+ Plugin can import serialized data. You have to use the serialized string directly in the CSV cell in order the plugin will be able to understand it as an serialized data instead as any other string.
1336
+
1337
+ = Lists =
1338
+
1339
+ Plugin can import lists as an array. Use this separator: :: two colons, inside the cell in order to split the string in a list of items.
1340
+
1341
+ = WordPress default profile data =
1342
+
1343
+ You can use those labels if you want to set data adapted to the WordPress default user columns (the ones who use the function wp_update_user)
1344
+
1345
+ * user_nicename: A string that contains a URL-friendly name for the user. The default is the user's username.
1346
+ * user_url: A string containing the user's URL for the user's web site.
1347
+ * display_name: A string that will be shown on the site. Defaults to user's username. It is likely that you will want to change this, for both appearance and security through * obscurity (that is if you don't use and delete the default admin user).
1348
+ * nickname: The user's nickname, defaults to the user's username.
1349
+ * first_name: The user's first name.
1350
+ * last_name: The user's last name.
1351
+ * description: A string containing content about the user.
1352
+ * jabber: User's Jabber account.
1353
+ * aim: User's AOL IM account.
1354
+ * yim: User's Yahoo IM account.
1355
+ * user_registered: Using the WordPress format for this kind of data Y-m-d H:i:s.
1356
+
1357
+ = Multiple imports =
1358
+
1359
+ You can upload as many files as you want, but all must have the same columns. If you upload another file, the columns will change to the form of last file uploaded.
1360
+
1361
+ = Export =
1362
+
1363
+ You can export a file with all your users data using "Export" tab. There you will be able to find some filters and options to prepare your export.
1364
+
1365
+ = Hooks: actions and filter =
1366
+ If you want to extend this plugin or use this plugin with any other, [here you have a list with all hooks available in the plugin](https://codection.com/import-users-csv-meta/listado-de-hooks-de-import-and-exports-users-and-customers/).
1367
+
1368
+ = This plugin saved me a lot of time and work. Where can I donate? =
1369
+
1370
+ Thanks, donations help us to continue improving our plugins and allow us to give the best support in the forums [Donate Here via PayPal.](https://codection.com/go/donate-import-users-from-csv-with-meta/)
1371
+
1372
+ = I'm not sure I will be able to import all users with correct data and roles. Will you do it for me? =
1373
+
1374
+ Of course! In Codection we help you to import, migrate, synchronized, update or any other operation you will need to do with your users. Contact us at contacto@codection.com for more information.
1375
+
1376
+ = Free and premium support =
1377
+
1378
+ You can get:
1379
+
1380
+ * Free support [in WordPress forums](https://wordpress.org/support/plugin/import-users-from-csv-with-meta)
1381
+ * Premium support [writing directly to contacto@codection.com](mailto:contacto@codection.com).
1382
+
1383
+ = Customizations, addons, develops... =
1384
+ [Write us directly to contacto@codection.com](mailto:contacto@codection.com).
1385
+
1386
+ == Installation ==
1387
+
1388
+ ### **Installation**
1389
+
1390
+ * Install **Import and export users and customers** automatically through the WordPress Dashboard or by uploading the ZIP file in the _plugins_ directory.
1391
+ * Then, after the package is uploaded and extracted, click&nbsp;_Activate Plugin_.
1392
+
1393
+ Now going through the points above, you should now see a new&nbsp;_Import users from CSV_&nbsp;menu item under Tool menu in the sidebar of the admin panel, see figure below of how it looks like.
1394
+
1395
+ [Plugin link from dashboard](http://ps.w.org/import-users-from-csv-with-meta/assets/screenshot-1.png)
1396
+
1397
+ If you get any error after following through the steps above please contact us through item support comments so we can get back to you with possible helps in installing the plugin and more.
1398
+
1399
+ Please read documentation before start using this plugin.
trunk/samples/wcs-import-sample.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ Username,Email,subscription_status,start_date,trial_end_date,next_payment_date,last_payment_date,end_date,billing_period,billing_interval,order_shipping,order_shipping_tax,order_tax,cart_discount,cart_discount_tax,order_total,order_currency,payment_method,payment_method_title,payment_method_post_meta,payment_method_user_meta,shipping_method,billing_first_name,billing_last_name,billing_email,billing_phone,billing_address_1,billing_address_2,billing_postcode,billing_city,billing_state,billing_country,billing_company,shipping_first_name,shipping_last_name,shipping_address_1,shipping_address_2,shipping_postcode,shipping_city,shipping_state,shipping_country,shipping_company,customer_note,order_notes,coupon_items,fee_items,tax_items,download_permissions
2
+ johnadams,john@example.com,wc-active,2016-04-29 00:42:51,0,2016-05-29 00:42:51,2016-04-29 00:42:53,0,month,1,5.55,555,4.75,27.5,2.75,58.36,USD,manual,Manual,,,method_id:flat_rate|method_title:Flat Rate|total:5.55,John,Adams,john@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,John,Adams,969 Market,,94103,San Francisco,CA,US,,,Payment received.;Status changed from Pending to Active.,,,id:4|code:Sales Tax|total:5.31,0
3
+ benji,benji@example.com,wc-on-hold,2016-04-22 00:30:03,0,2016-06-20 03:00:00,2016-04-22 00:30:01,2016-08-20 03:00:04,month,1,3.33,333,3.6,12,1.2,43.26,USD,manual,Manual,,,method_id:flat_rate|method_title:Flat Rate|total:3.33,Benjamin,Franklin,benji@example.com,(123) 581-3213,36 Craven Street,,WC2N 5NF,London,London,GB,Prospress Inc.,Benjamin,Franklin,36 Craven Street,,WC2N 5NF,London,London,GB,,,"Payment method changed from ""Credit card (Stripe)"" to ""Credit card (Stripe)"" by the subscriber from their account page.;Payment received.;Status changed from Pending to Active.;Payment received.",,,id:4|code:Sales Tax|total:3.93,0
4
+ tj_rules,tj@example.com,wc-on-hold,2016-03-23 07:16:40,2016-04-23 07:16:40,2016-04-23 07:16:40,2016-03-29 10:14:14,0,month,1,0,0,0,0,0,11,USD,manual,Manual,,,method_id:free_shipping|method_title:Free Shipping|total:0.00,Thomas,Jefferson,tj@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,Thomas,Jefferson,969 Market,,94103,San Francisco,CA,US,,,"Payment failed.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6240 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6231 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6224 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6211 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Process renewal order action requested by admin.;Order #6208 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6195 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6188 created to record renewal.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6179 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6166 created to record renewal.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6157 created to record renewal.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6144 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6139 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6134 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6123 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6118 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6113 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6108 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Subscription status changed by bulk edit: Status changed from On hold to Active.;Payment failed.;Order #6104 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #6100 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #6096 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6092 created to record renewal.;Status changed from On hold to Active.;Payment received.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6077 created to record renewal.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6072 created to record renewal.;Payment received.;Status changed from On hold to Active.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6060 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6055 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Order #6046 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Subscription status changed by bulk edit: Status changed from On hold to Active.;Subscription status changed by bulk edit: Status changed from Active to On hold.;Payment received.;Status changed from On hold to Active.;Payment failed.;Payment failed.;Payment failed.;Process renewal order action requested by admin.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6027 created to record renewal.;Subscription status changed by bulk edit: Status changed from On hold to Active.;Subscription status changed by bulk edit: Status changed from Active to On hold.;Subscription status changed by bulk edit: Status changed from On hold to Active.;Subscription status changed by bulk edit: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6018 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Order #6010 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Process renewal order action requested by admin.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #6005 created to record renewal.;Status changed from On hold to Active.;Payment failed.;Order #6000 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #5995 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #5991 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #5987 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #5984 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Order #5981 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment failed.;Subscription renewal payment due: Status changed from Active to On hold.;Order #5978 created to record renewal.;Status changed from On hold to Active.;Order #5975 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Process renewal order action requested by admin.;Status changed from On hold to Active.;Payment received.;Order #5972 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Pickup location changed to Crown Colony, 377 Mandarin Drive, Daly City, CA 94015;Status changed from Pending to Active.;Sign-up complete.",,,id:4|code:Sales Tax|total:0.00,0
5
+ james,james@example.com,wc-active,2015-10-02 07:31:11,0,2016-03-04 07:31:09,2016-03-25 02:18:18,0,week,2,0,0,2.5,0,0,27.5,USD,manual,Manual,,,method_id:free_shipping|method_title:Free Shipping|total:0.00,James,Madison,james@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,James,Madison,969 Market,,94103,San Francisco,CA,US,,,Order #5746 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5605 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Subscription renewal payment due: Status changed from Active to On hold.;Order #5492 created to record renewal.;Status changed from On hold to Active.;Payment received.;Order #5436 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5350 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5259 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Subscription renewal payment due: Status changed from Active to On hold.;Order #5145 created to record renewal.;Status changed from On hold to Active.;Payment received.;Order #5016 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from Pending to Active.;Payment received.,,,id:4|code:Sales Tax|total:2.50,0
6
+ alexander,alex@example.com,wc-cancelled,2015-08-31 20:59:11,0,0,2015-08-31 20:59:11,2015-09-14 21:51:02,month,1,12,1.2,2,0,0,35.2,USD,manual,Manual,,,method_id:local_delivery|method_title:Local Delivery|total:12.00,Alexander,Hamilton,alex@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,Alexander,Hamilton,969 Market,,94103,San Francisco,CA,US,,,Subscription status changed by bulk edit: Status changed from Pending Cancellation to Cancelled.;Status changed from Active to Pending Cancellation.;Subscription cancelled by the subscriber from their account page.;Payment received.;Status changed from Pending to Active.,,,id:4|code:Sales Tax|total:3.20,0
7
+ jimmy_m,jimmy@example.com,wc-active,2015-07-22 19:24:09,0,2016-05-22 19:24:09,2016-04-25 18:44:11,0,month,1,6.66,666,2.4,0,0,33.73,USD,manual,Manual,,,method_id:flat_rate:flat-rate-per-item|method_title:Flat Rate Per Item|total:6.66,James,Monroe,jimmy@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,James,Monroe,969 Market,,94103,San Francisco,CA,US,,,"Status changed from On hold to Active.;Payment received.;Order #6436 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5912 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5617 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5440 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5287 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order #5059 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Payment received.;Status changed from On hold to Active.;Order #4815 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from On hold to Active.;Payment received.;Order <a href=""http://local.dev/subs20/wp-admin/post.php?post=#4481 created to record renewal.;Subscription renewal payment due: Status changed from Active to On hold.;Status changed from Pending to Active.",,,id:4|code:Sales Tax|total:3.07,0
8
+ johnadams,john@example.com,wc-active,2016-04-29 00:44:44,0,2016-05-29 00:44:44,2016-04-29 00:44:46,2018-04-29 00:44:44,month,1,4.44,444,4.3,22,2.2,46.68,USD,manual,Manual,,,method_id:flat_rate|method_title:Flat Rate|total:4.44,John,Adams,john@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,John,Adams,969 Market,,94103,San Francisco,CA,US,,,This is a note to the customer added by the store owner via Edit Subscription admin screen.;This is a private order note added by the store owner via Edit Subscription admin screen.;Payment received.;Status changed from Pending to Active.,code:rd5|description:|amount:20.00;code:rd5pc|description:|amount:2.00,name:Custom Fee|total:5.00|tax:0.50,id:4|code:Sales Tax|total:4.74,0
9
+ benji,benji@example.com,wc-active,2016-04-29 00:44:44,0,2016-05-29 00:44:44,2016-04-29 00:44:46,2018-04-29 00:44:44,month,1,4.44,444,4.3,22,2.2,46.68,USD,manual,Manual,,,method_id:flat_rate|method_title:Flat Rate|total:4.44,Benjamin,Franklin,benji@example.com,(123) 581-3213,36 Craven Street,,WC2N 5NF,London,London,GB,Prospress Inc.,Benjamin,Franklin,36 Craven Street,,WC2N 5NF,London,London,GB,,,This is a note to the customer added by the store owner via Edit Subscription admin screen.;This is a private order note added by the store owner via Edit Subscription admin screen.;Payment received.;Status changed from Pending to Active.,code:rd5|description:|amount:20.00;code:rd5pc|description:|amount:2.00,name:Custom Fee|total:5.00|tax:0.50,id:4|code:Sales Tax|total:4.74,1
10
+ tj_rules,tj@example.com,wc-active,2016-04-29 00:44:44,0,2016-05-29 00:44:44,2016-04-29 00:44:46,2018-04-29 00:44:44,month,1,4.44,444,4.3,22,2.2,46.68,USD,stripe,Credit card (Stripe),_stripe_customer_id:cus_fakeimportedtoken|_stripe_source_id:,,method_id:flat_rate|method_title:Flat Rate|total:4.44,Thomas,Jefferson,tj@example.com,(555) 555-5555,969 Market,,94103,San Francisco,CA,US,Prospress Inc.,Thomas,Jefferson,969 Market,,94103,San Francisco,CA,US,,This is a customer note placed on the order/subscription by the customer at checkout and displayed to the store owner via the Edit Subscription and Edit Order administration screens.,This is a note to the customer added by the store owner via Edit Subscription admin screen.;This is a private order note added by the store owner via Edit Subscription admin screen.;Payment received.;Status changed from Pending to Active.,,,id:4|code:Sales Tax|total:4.74,0
trunk/test.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ user_login,user_email,display_name,role,first_name,last_name,billing_first_name,billing_last_name,billing_company,billing_email,billing_phone,billing_country,billing_address_1,billing_address_2,billing_city,billing_state,billing_postcode,shipping_first_name,shipping_last_name,shipping_company,shipping_country,shipping_address_1,shipping_address_2,shipping_city,shipping_state,shipping_postcode
2
+ javier,carazo@correo.es,Javier Carazo,customer,Javier,Carazo,Javier,Carazo,,carazo@correo.es,600000000,ES,c/ Islas,,Córdoba,CO,14001,Javier,Carazo,,ES,c/ Islas,,Córdoba,CO,14001
3
+ inma,inma@email.com,Inma Pérez,subscriber,Inma,Pérez,,,,,,,,,,,,,,,,,,,,
trunk/wpml-config.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="acui_mail_subject"/>
4
+ <key name="acui_mail_body"/>
5
+ </admin-texts>
6
+ <custom-types>
7
+ <custom-type translate="1">acui_email_template</custom-type>
8
+ </custom-types>
9
+ </wpml-config>