Version Description
- Expot results included after export is done, including if some value has been altered because it can contains some spreadsheet formula characters at the beginning
- You can use now all the wildcards in subjects that were available in body
- Fixed some issues when exporting data using filtered columns, now source_user_id is filled correctly
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.21 |
Comparing to | |
See all releases |
Code changes from version 1.20.5 to 1.21
- addons/buddypress.php +7 -9
- assets/export.js +6 -0
- assets/style.css +11 -0
- classes/batch_exporter.php +21 -13
- classes/email-options.php +37 -33
- classes/export.php +38 -0
- import-users-from-csv-with-meta.php +2 -2
- readme.txt +12 -3
addons/buddypress.php
CHANGED
@@ -9,14 +9,13 @@ if( !is_plugin_active( 'buddypress/bp-loader.php' ) && !function_exists( 'bp_is_
|
|
9 |
class ACUI_Buddypress{
|
10 |
var $fields;
|
11 |
var $profile_groups;
|
|
|
12 |
|
13 |
function __construct(){
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
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();
|
@@ -84,9 +83,8 @@ class ACUI_Buddypress{
|
|
84 |
}
|
85 |
|
86 |
function get_groups( $user_id ){
|
87 |
-
if( !class_exists( "BP_Groups_Member" ) )
|
88 |
-
require_once(
|
89 |
-
}
|
90 |
|
91 |
$groups = BP_Groups_Member::get_group_ids( $user_id );
|
92 |
return implode( ",", $groups['groups'] );
|
9 |
class ACUI_Buddypress{
|
10 |
var $fields;
|
11 |
var $profile_groups;
|
12 |
+
var $plugin_path;
|
13 |
|
14 |
function __construct(){
|
15 |
+
$this->plugin_path = is_plugin_active( 'buddypress/bp-loader.php' ) ? WP_PLUGIN_DIR . "/buddypress/" : WP_PLUGIN_DIR . "/buddyboss-platform/";
|
16 |
+
|
17 |
+
if( !class_exists( 'BP_XProfile_Group' ) )
|
18 |
+
require_once( $this->plugin_path . "bp-xprofile/classes/class-bp-xprofile-group.php" );
|
|
|
|
|
19 |
|
20 |
$this->profile_groups = $this->get_profile_groups();
|
21 |
$this->fields = $this->get_fields();
|
83 |
}
|
84 |
|
85 |
function get_groups( $user_id ){
|
86 |
+
if( !class_exists( "BP_Groups_Member" ) )
|
87 |
+
require_once( $this->plugin_path . "bp-groups/classes/class-bp-groups-member.php" );
|
|
|
88 |
|
89 |
$groups = BP_Groups_Member::get_group_ids( $user_id );
|
90 |
return implode( ",", $groups['groups'] );
|
assets/export.js
CHANGED
@@ -73,6 +73,12 @@
|
|
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 );
|
73 |
setTimeout( function() {
|
74 |
$this.$form.removeClass( 'user-exporter__exporting' );
|
75 |
$( '#acui_download_csv_wrapper > td > input' ).prop( 'disabled', false );
|
76 |
+
|
77 |
+
if( response.data.results != '' ){
|
78 |
+
$( '#acui_export_results' )
|
79 |
+
.html( response.data.results )
|
80 |
+
.show()
|
81 |
+
}
|
82 |
}, 2000 );
|
83 |
} else {
|
84 |
$this.$form.find( '.user-exporter-progress' ).val( response.data.percentage );
|
assets/style.css
CHANGED
@@ -138,6 +138,17 @@ input[type=checkbox].acui-checkbox{
|
|
138 |
}
|
139 |
|
140 |
/* exporter */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
#acui_exporter .user-exporter-progress-wrapper{
|
142 |
padding: 5px;
|
143 |
background-color: white;
|
138 |
}
|
139 |
|
140 |
/* exporter */
|
141 |
+
#acui_export_results{
|
142 |
+
display: none;
|
143 |
+
background-color: #dcdcde;
|
144 |
+
padding: 20px;
|
145 |
+
margin-top: 10px;
|
146 |
+
}
|
147 |
+
|
148 |
+
#acui_export_results ul{
|
149 |
+
list-style: disc;
|
150 |
+
}
|
151 |
+
|
152 |
#acui_exporter .user-exporter-progress-wrapper{
|
153 |
padding: 5px;
|
154 |
background-color: white;
|
classes/batch_exporter.php
CHANGED
@@ -33,7 +33,6 @@ class ACUI_Batch_Exporter{
|
|
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' ), 8, 3 );
|
39 |
add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), 10, 3 );
|
@@ -61,10 +60,6 @@ class ACUI_Batch_Exporter{
|
|
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 |
}
|
@@ -585,8 +580,10 @@ class ACUI_Batch_Exporter{
|
|
585 |
$userdata = get_userdata( $user );
|
586 |
|
587 |
foreach ( $this->get_user_data( $this->get_filtered_columns() ) as $key ) {
|
588 |
-
$key
|
589 |
-
|
|
|
|
|
590 |
}
|
591 |
|
592 |
if( count( $this->get_filtered_columns() ) == 0 || in_array( 'role', $this->get_filtered_columns() ) )
|
@@ -600,17 +597,17 @@ class ACUI_Batch_Exporter{
|
|
600 |
$row = $this->maybe_fill_empty_data( $row, $user, $this->get_filtered_columns() );
|
601 |
|
602 |
$row = apply_filters( 'acui_export_data', $row, $user, array( 'columns' => $this->get_columns_to_export(), 'datetime_format' => $this->get_datetime_format(), '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 );
|
@@ -635,7 +632,7 @@ class ACUI_Batch_Exporter{
|
|
635 |
return $value;
|
636 |
}
|
637 |
|
638 |
-
function clean_bad_characters_formulas( $value ){
|
639 |
if( is_array( $value ) )
|
640 |
return $value;
|
641 |
|
@@ -644,12 +641,23 @@ class ACUI_Batch_Exporter{
|
|
644 |
|
645 |
$bad_characters = array( "\t", "\r", "+", "-", "=", "@" );
|
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 |
}
|
@@ -683,7 +691,7 @@ class ACUI_Batch_Exporter{
|
|
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() ) )
|
33 |
|
34 |
function __construct() {
|
35 |
add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_alphabetacally' ), 10, 2 );
|
|
|
36 |
add_filter( 'acui_export_columns', array( $this, 'maybe_order_columns_filtered_columns_parameter' ), 11, 2 );
|
37 |
add_filter( 'acui_export_data', array( $this, 'maybe_double_encapsulate_serialized_values' ), 8, 3 );
|
38 |
add_filter( 'acui_export_data', array( $this, 'maybe_order_row_alphabetically' ), 10, 3 );
|
60 |
return array_merge( $first_two_columns, $to_order_columns );
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
63 |
function maybe_order_columns_filtered_columns_parameter( $row, $args ){
|
64 |
return ( !is_array( $args['filtered_columns'] ) || count( $args['filtered_columns'] ) == 0 ) ? $row : $args['filtered_columns'];
|
65 |
}
|
580 |
$userdata = get_userdata( $user );
|
581 |
|
582 |
foreach ( $this->get_user_data( $this->get_filtered_columns() ) as $key ) {
|
583 |
+
if( $key == 'source_user_id' )
|
584 |
+
$row[ $key ] = $this->prepare( $key, $userdata->ID, $this->get_datetime_format(), $user );
|
585 |
+
else
|
586 |
+
$row[ $key ] = $this->prepare( $key, $userdata->data->{$key}, $this->get_datetime_format(), $user );
|
587 |
}
|
588 |
|
589 |
if( count( $this->get_filtered_columns() ) == 0 || in_array( 'role', $this->get_filtered_columns() ) )
|
597 |
$row = $this->maybe_fill_empty_data( $row, $user, $this->get_filtered_columns() );
|
598 |
|
599 |
$row = apply_filters( 'acui_export_data', $row, $user, array( 'columns' => $this->get_columns_to_export(), 'datetime_format' => $this->get_datetime_format(), 'order_fields_alphabetically' => $this->get_order_fields_alphabetically(), 'double_encapsulate_serialized_values' => $this->get_double_encapsulate_serialized_values(), 'filtered_columns' => $this->get_filtered_columns() ));
|
600 |
+
|
601 |
$this->row_data[] = array_values( $row );
|
602 |
}
|
603 |
}
|
604 |
|
605 |
+
function prepare( $key, $value, $datetime_format = '', $user = 0 ){
|
606 |
$acui_helper = new ACUI_Helper();
|
607 |
|
608 |
$timestamp_keys = apply_filters( 'acui_export_timestamp_keys', array( 'wc_last_active' ) );
|
609 |
$original_value = $value;
|
610 |
+
$value = $this->clean_bad_characters_formulas( $value, $key, $user );
|
611 |
|
612 |
if( has_filter( 'acui_export_prepare' ) ){
|
613 |
return apply_filters( 'acui_export_prepare', $value, $original_value );
|
632 |
return $value;
|
633 |
}
|
634 |
|
635 |
+
function clean_bad_characters_formulas( $value, $key, $user ){
|
636 |
if( is_array( $value ) )
|
637 |
return $value;
|
638 |
|
641 |
|
642 |
$bad_characters = array( "\t", "\r", "+", "-", "=", "@" );
|
643 |
$first_character = substr( $value, 0, 1 );
|
644 |
+
if( in_array( $first_character, $bad_characters ) ){
|
645 |
$value = "'" . $first_character . substr( $value, 1 );
|
646 |
+
$this->add_bad_character_formulas_values_cleaned( $key, $value, $user );
|
647 |
+
}
|
648 |
|
649 |
return $value;
|
650 |
}
|
651 |
|
652 |
+
function add_bad_character_formulas_values_cleaned( $key, $value, $user ){
|
653 |
+
$current = get_transient( 'acui_export_bad_character_formulas_values_cleaned' );
|
654 |
+
if( !is_array( $current ) )
|
655 |
+
$current = array();
|
656 |
+
|
657 |
+
$current[] = array( 'key' => $key, 'value' => $value, 'user_id' => $user );
|
658 |
+
set_transient( 'acui_export_bad_character_formulas_values_cleaned', $current );
|
659 |
+
}
|
660 |
+
|
661 |
function is_valid_timestamp( $timestamp ){
|
662 |
return ( (string) (int) $timestamp === $timestamp ) && ( $timestamp <= PHP_INT_MAX ) && ( $timestamp >= ~PHP_INT_MAX );
|
663 |
}
|
691 |
}
|
692 |
|
693 |
foreach( $usermeta as $key => $value) {
|
694 |
+
if( $value["meta_key"] == 'role' || $value["meta_key"] == 'source_user_id' )
|
695 |
continue;
|
696 |
|
697 |
if( count( $this->get_filtered_columns() ) == 0 || in_array( $value["meta_key"], $this->get_filtered_columns() ) )
|
classes/email-options.php
CHANGED
@@ -197,8 +197,33 @@ class ACUI_Email_Options{
|
|
197 |
}
|
198 |
|
199 |
static function send_email( $user_object, $positions = array(), $headers = array(), $data = array(), $created = false, $password = '' ){
|
200 |
-
$
|
|
|
|
|
|
|
|
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
$key = get_password_reset_key( $user_object );
|
203 |
$wp_users_fields = $acui_helper->get_wp_users_fields();
|
204 |
|
@@ -206,63 +231,42 @@ class ACUI_Email_Options{
|
|
206 |
$user_login= $user_object->user_login;
|
207 |
$user_email = $user_object->user_email;
|
208 |
|
209 |
-
$
|
210 |
-
$
|
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 |
-
$
|
220 |
|
221 |
$passwordreseturllink = wp_sprintf( '<a href="%s">%s</a>', $passwordreseturl, __( 'Password reset link', 'import-users-from-csv-with-meta' ) );
|
222 |
-
$
|
223 |
}
|
224 |
|
225 |
if( empty( $password ) && !$created ){
|
226 |
$password = __( 'Password has not been changed', 'import-users-from-csv-with-meta' );
|
227 |
}
|
228 |
|
229 |
-
$
|
230 |
-
$
|
231 |
|
232 |
foreach ( $wp_users_fields as $wp_users_field ) {
|
233 |
if( $positions[ $wp_users_field ] != false && $wp_users_field != "password" ){
|
234 |
-
$
|
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( $
|
243 |
continue;
|
244 |
|
245 |
$data[ $i ] = ( is_array( $data[ $i ] ) ) ? implode( "-", $data[ $i ] ) : $data[ $i ];
|
246 |
-
$
|
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 |
-
|
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 ) {
|
197 |
}
|
198 |
|
199 |
static function send_email( $user_object, $positions = array(), $headers = array(), $data = array(), $created = false, $password = '' ){
|
200 |
+
$user_id = $user_object->ID;
|
201 |
+
$user_email = $user_object->user_email;
|
202 |
+
|
203 |
+
$body = apply_filters( 'acui_import_email_body_source', get_option( "acui_mail_body" ), $headers, $data, $created, $user_id );
|
204 |
+
$subject = apply_filters( 'acui_import_email_subject_source', get_option( "acui_mail_subject" ), $headers, $data, $created, $user_id );
|
205 |
|
206 |
+
$body = self::apply_wildcards( $body, $user_object, $created, $positions, $headers, $data );
|
207 |
+
$subject = self::apply_wildcards( $subject, $user_object, $created, $positions, $headers, $data );
|
208 |
+
|
209 |
+
$body = apply_filters( 'acui_import_email_body_before_wpautop', $body, $headers, $data, $created, $user_id );
|
210 |
+
|
211 |
+
$attachments = array();
|
212 |
+
$attachment_id = get_option( 'acui_mail_attachment_id' );
|
213 |
+
if( !empty( $attachment_id ) )
|
214 |
+
$attachments[] = get_attached_file( $attachment_id );
|
215 |
+
|
216 |
+
$email_to = apply_filters( 'acui_import_email_to', $user_email, $headers, $data, $created, $user_id );
|
217 |
+
$subject = apply_filters( 'acui_import_email_subject', $subject, $headers, $data, $created, $user_id );
|
218 |
+
$body = apply_filters( 'acui_import_email_body', wpautop( $body ), $headers, $data, $created, $user_id );
|
219 |
+
$headers_mail = apply_filters( 'acui_import_email_headers', array( 'Content-Type: text/html; charset=UTF-8' ), $headers, $data, $created, $user_id );
|
220 |
+
$attachments = apply_filters( 'acui_import_email_attachments', $attachments, $headers, $data, $created, $user_id );
|
221 |
+
|
222 |
+
wp_mail( $email_to, $subject, $body, $headers_mail, $attachments );
|
223 |
+
}
|
224 |
+
|
225 |
+
static function apply_wildcards( $string, $user_object, $created, $positions, $headers, $data ){
|
226 |
+
$acui_helper = new ACUI_Helper();
|
227 |
$key = get_password_reset_key( $user_object );
|
228 |
$wp_users_fields = $acui_helper->get_wp_users_fields();
|
229 |
|
231 |
$user_login= $user_object->user_login;
|
232 |
$user_email = $user_object->user_email;
|
233 |
|
234 |
+
$string = str_replace( "**loginurl**", wp_login_url(), $string );
|
235 |
+
$string = str_replace( "**username**", $user_login, $string );
|
236 |
+
$string = str_replace( "**lostpasswordurl**", wp_lostpassword_url(), $string );
|
|
|
|
|
|
|
|
|
237 |
|
238 |
if( !is_wp_error( $key ) ){
|
239 |
$passwordreseturl = apply_filters( 'acui_email_passwordreseturl', network_site_url( 'wp-login.php?action=rp&key=' . $key . '&login=' . rawurlencode( $user_login ), 'login' ) );
|
240 |
+
$string = str_replace( "**passwordreseturl**", $passwordreseturl, $string );
|
241 |
|
242 |
$passwordreseturllink = wp_sprintf( '<a href="%s">%s</a>', $passwordreseturl, __( 'Password reset link', 'import-users-from-csv-with-meta' ) );
|
243 |
+
$string = str_replace( "**passwordreseturllink**", $passwordreseturllink, $string );
|
244 |
}
|
245 |
|
246 |
if( empty( $password ) && !$created ){
|
247 |
$password = __( 'Password has not been changed', 'import-users-from-csv-with-meta' );
|
248 |
}
|
249 |
|
250 |
+
$string = str_replace( "**password**", $password, $string );
|
251 |
+
$string = str_replace( "**email**", $user_email, $string );
|
252 |
|
253 |
foreach ( $wp_users_fields as $wp_users_field ) {
|
254 |
if( $positions[ $wp_users_field ] != false && $wp_users_field != "password" ){
|
255 |
+
$string = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $string );
|
|
|
256 |
}
|
257 |
}
|
258 |
|
259 |
for( $i = 0 ; $i < count( $headers ); $i++ ) {
|
260 |
$to_replace = "**" . $headers[ $i ] . "**";
|
261 |
|
262 |
+
if( strpos( $string, $to_replace ) === false )
|
263 |
continue;
|
264 |
|
265 |
$data[ $i ] = ( is_array( $data[ $i ] ) ) ? implode( "-", $data[ $i ] ) : $data[ $i ];
|
266 |
+
$string = str_replace( $to_replace, $data[ $i ] , $string );
|
|
|
267 |
}
|
|
|
|
|
268 |
|
269 |
+
return $string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
}
|
271 |
|
272 |
function load_scripts( $hook ) {
|
classes/export.php
CHANGED
@@ -28,6 +28,12 @@ class ACUI_Exporter{
|
|
28 |
static function styles(){
|
29 |
?>
|
30 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
#acui_exporter .user-exporter-progress-wrapper{
|
32 |
padding: 5px;
|
33 |
background-color: white;
|
@@ -81,6 +87,8 @@ class ACUI_Exporter{
|
|
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">
|
@@ -194,6 +202,32 @@ class ACUI_Exporter{
|
|
194 |
}
|
195 |
}
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
function export_users_csv(){
|
198 |
check_ajax_referer( 'codection-security', 'security' );
|
199 |
|
@@ -204,6 +238,9 @@ class ACUI_Exporter{
|
|
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'] ) );
|
@@ -233,6 +270,7 @@ class ACUI_Exporter{
|
|
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 {
|
28 |
static function styles(){
|
29 |
?>
|
30 |
<style>
|
31 |
+
#acui_export_results{
|
32 |
+
display: none;
|
33 |
+
background-color: #dcdcde;
|
34 |
+
padding: 20px;
|
35 |
+
}
|
36 |
+
|
37 |
#acui_exporter .user-exporter-progress-wrapper{
|
38 |
padding: 5px;
|
39 |
background-color: white;
|
87 |
|
88 |
static function admin_gui(){
|
89 |
?>
|
90 |
+
<div id="acui_export_results"></div>
|
91 |
+
|
92 |
<h3 id="acui_export_users_header"><?php _e( 'Export users', 'import-users-from-csv-with-meta' ); ?></h3>
|
93 |
<form id="acui_exporter">
|
94 |
<table class="form-table">
|
202 |
}
|
203 |
}
|
204 |
|
205 |
+
function get_results(){
|
206 |
+
$bad_character_formulas_values_cleaned = get_transient( 'acui_export_bad_character_formulas_values_cleaned' );
|
207 |
+
delete_transient( 'acui_export_bad_character_formulas_values_cleaned' );
|
208 |
+
|
209 |
+
if( empty( $bad_character_formulas_values_cleaned ) ){
|
210 |
+
return '';
|
211 |
+
}
|
212 |
+
|
213 |
+
$results = array();
|
214 |
+
|
215 |
+
foreach( $bad_character_formulas_values_cleaned as $info ){
|
216 |
+
$results[] = sprintf( __( 'User with id: %s has the cell of the column: %s edited because has content that may auto-run formulas in certain spreadsheet apps, new value is: %s', 'import-users-from-csv-with-meta' ), $info['user_id'], $info['key'], $info['value'] );
|
217 |
+
}
|
218 |
+
|
219 |
+
$ret = '<h3>' . __( 'Export results','import-users-from-csv-with-meta' ) . '</h3>';
|
220 |
+
$ret .= '<h4>' . __( 'Some values has been altered','import-users-from-csv-with-meta' ) . '</h4>';
|
221 |
+
$ret .= '<ul>';
|
222 |
+
foreach( $results as $result ){
|
223 |
+
$ret .= '<li>' . $result . '</li>';
|
224 |
+
}
|
225 |
+
|
226 |
+
$ret .= '</ul>';
|
227 |
+
|
228 |
+
return $ret;
|
229 |
+
}
|
230 |
+
|
231 |
function export_users_csv(){
|
232 |
check_ajax_referer( 'codection-security', 'security' );
|
233 |
|
238 |
$step = isset( $_POST['step'] ) ? absint( $_POST['step'] ) : 1;
|
239 |
|
240 |
$exporter = new ACUI_Batch_Exporter();
|
241 |
+
|
242 |
+
if( $step == 1 )
|
243 |
+
delete_transient( 'acui_export_bad_character_formulas_values_cleaned' );
|
244 |
|
245 |
$exporter->set_page( $step );
|
246 |
$exporter->set_delimiter( sanitize_text_field( $_POST['delimiter'] ) );
|
270 |
'step' => 'done',
|
271 |
'percentage' => 100,
|
272 |
'url' => add_query_arg( $query_args, admin_url( 'tools.php?page=acui&tab=export' ) ),
|
273 |
+
'results' => $this->get_results()
|
274 |
)
|
275 |
);
|
276 |
} else {
|
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.
|
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.
|
18 |
|
19 |
class ImportExportUsersCustomers{
|
20 |
var $file;
|
3 |
Plugin Name: Import and export users and customers
|
4 |
Plugin URI: https://www.codection.com
|
5 |
Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
|
6 |
+
Version: 1.21
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
14 |
if ( ! defined( 'ABSPATH' ) )
|
15 |
exit;
|
16 |
|
17 |
+
define( 'ACUI_VERSION', '1.21' );
|
18 |
|
19 |
class ImportExportUsersCustomers{
|
20 |
var $file;
|
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: 6.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -64,8 +64,9 @@ In Codection we have more plugins, please take a look to them.
|
|
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 |
-
* [
|
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 |
|
@@ -107,6 +108,14 @@ Plugin will automatically detect:
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= 1.20.5 =
|
111 |
* Improved the way the plugin sanitize values when exporting data to avoid any formula (for spreadsheets) to be exported
|
112 |
|
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: 6.1
|
7 |
+
Stable tag: 1.21
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
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 |
+
* [Products Restricted Users for WooCommerce 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 |
+
* [Payment Schedule for WooCommerce Subscriptions](https://import-wp.com/payment-schedule-for-woocommerce-subscriptions) (premium)
|
70 |
|
71 |
### **Basics**
|
72 |
|
108 |
|
109 |
== Changelog ==
|
110 |
|
111 |
+
= 1.21 =
|
112 |
+
* Expot results included after export is done, including if some value has been altered because it can contains some spreadsheet formula characters at the beginning
|
113 |
+
* You can use now all the wildcards in subjects that were available in body
|
114 |
+
* Fixed some issues when exporting data using filtered columns, now source_user_id is filled correctly
|
115 |
+
|
116 |
+
= 1.20.6 =
|
117 |
+
* Fixed a problem with BuddyBoss when exporting users if groups were getting used
|
118 |
+
|
119 |
= 1.20.5 =
|
120 |
* Improved the way the plugin sanitize values when exporting data to avoid any formula (for spreadsheets) to be exported
|
121 |
|