Version Description
- Email notification can be sent to administrator of the website when someone use the frontend importer
- Code improvement
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.15.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.15.5.2 to 1.15.5.3
- addons/allow-multiple-accounts.php +26 -1
- classes/cron.php +104 -1
- classes/frontend.php +50 -0
- import-users-from-csv-with-meta.php +2 -151
- importer.php +6 -6
- readme.txt +5 -1
addons/allow-multiple-accounts.php
CHANGED
@@ -8,7 +8,6 @@ if( !is_plugin_active( 'allow-multiple-accounts/allow-multiple-accounts.php' ) )
|
|
8 |
|
9 |
add_action( 'acui_tab_import_before_import_button', 'acui_allow_multiple_accounts_tab_import_before_import_button' );
|
10 |
add_action( 'acui_tab_cron_before_log', 'acui_allow_multiple_accounts_tab_cron_before_log' );
|
11 |
-
|
12 |
function acui_allow_multiple_accounts_tab_import_before_import_button(){
|
13 |
?>
|
14 |
<h2><?php _e( 'Allow multiple accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
|
@@ -47,4 +46,30 @@ function acui_allow_multiple_accounts_tab_cron_before_log(){
|
|
47 |
</tbody>
|
48 |
</table>
|
49 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
8 |
|
9 |
add_action( 'acui_tab_import_before_import_button', 'acui_allow_multiple_accounts_tab_import_before_import_button' );
|
10 |
add_action( 'acui_tab_cron_before_log', 'acui_allow_multiple_accounts_tab_cron_before_log' );
|
|
|
11 |
function acui_allow_multiple_accounts_tab_import_before_import_button(){
|
12 |
?>
|
13 |
<h2><?php _e( 'Allow multiple accounts compatibility', 'import-users-from-csv-with-meta'); ?></h2>
|
46 |
</tbody>
|
47 |
</table>
|
48 |
<?php
|
49 |
+
}
|
50 |
+
|
51 |
+
function acui_hack_email( $email ) {
|
52 |
+
if ( ! is_email( $email ) ) {
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
|
56 |
+
$old_email = $email;
|
57 |
+
|
58 |
+
for ( $i = 0; ! $skip_remap && email_exists( $email ); $i++ ) {
|
59 |
+
$email = str_replace( '@', "+ama{$i}@", $old_email );
|
60 |
+
}
|
61 |
+
|
62 |
+
return $email;
|
63 |
+
}
|
64 |
+
|
65 |
+
function acui_hack_restore_remapped_email_address( $user_id, $email ) {
|
66 |
+
global $wpdb;
|
67 |
+
|
68 |
+
$wpdb->update(
|
69 |
+
$wpdb->users,
|
70 |
+
array( 'user_email' => $email ),
|
71 |
+
array( 'ID' => $user_id )
|
72 |
+
);
|
73 |
+
|
74 |
+
clean_user_cache( $user_id );
|
75 |
}
|
classes/cron.php
CHANGED
@@ -3,6 +3,107 @@
|
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
5 |
class ACUI_Cron{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function admin_gui(){
|
7 |
$cron_activated = get_option( "acui_cron_activated");
|
8 |
$send_mail_cron = get_option( "acui_cron_send_mail");
|
@@ -278,4 +379,6 @@ class ACUI_Cron{
|
|
278 |
</script>
|
279 |
<?php
|
280 |
}
|
281 |
-
}
|
|
|
|
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 |
+
}
|
10 |
+
|
11 |
+
function save_settings( $form_data ){
|
12 |
+
if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
|
13 |
+
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
14 |
+
}
|
15 |
+
|
16 |
+
$next_timestamp = wp_next_scheduled( 'acui_cron_process' );
|
17 |
+
$period = sanitize_text_field( $form_data[ "period" ] );
|
18 |
+
|
19 |
+
if( isset( $form_data["cron-activated"] ) && $form_data["cron-activated"] == "yes" ){
|
20 |
+
update_option( "acui_cron_activated", true );
|
21 |
+
|
22 |
+
$old_period = get_option( "acui_cron_period" );
|
23 |
+
|
24 |
+
if( $old_period != $period ){
|
25 |
+
wp_unschedule_event( $next_timestamp, 'acui_cron_process');
|
26 |
+
wp_schedule_event( time(), $period, 'acui_cron_process' );
|
27 |
+
}
|
28 |
+
elseif( !$next_timestamp ) {
|
29 |
+
wp_schedule_event( time(), $period, 'acui_cron_process' );
|
30 |
+
}
|
31 |
+
}
|
32 |
+
else{
|
33 |
+
update_option( "acui_cron_activated", false );
|
34 |
+
wp_unschedule_event( $next_timestamp, 'acui_cron_process');
|
35 |
+
}
|
36 |
+
|
37 |
+
update_option( "acui_cron_send_mail", isset( $form_data["send-mail-cron"] ) && $form_data["send-mail-cron"] == "yes" );
|
38 |
+
update_option( "acui_cron_send_mail_updated", isset( $form_data["send-mail-updated"] ) && $form_data["send-mail-updated"] == "yes" );
|
39 |
+
update_option( "acui_cron_delete_users", isset( $form_data["cron-delete-users"] ) && $form_data["cron-delete-users"] == "yes" );
|
40 |
+
update_option( "acui_cron_delete_users_assign_posts", sanitize_text_field( $form_data["cron-delete-users-assign-posts"] ) );
|
41 |
+
update_option( "acui_move_file_cron", isset( $form_data["move-file-cron"] ) && $form_data["move-file-cron"] == "yes" );
|
42 |
+
update_option( "acui_cron_path_to_move_auto_rename", isset( $form_data["path_to_move_auto_rename"] ) && $form_data["path_to_move_auto_rename"] == "yes" );
|
43 |
+
update_option( "acui_cron_allow_multiple_accounts", ( isset( $form_data["allow_multiple_accounts"] ) && $form_data["allow_multiple_accounts"] == "yes" ) ? "allowed" : "not_allowed" );
|
44 |
+
update_option( "acui_cron_path_to_file", sanitize_text_field( $form_data["path_to_file"] ) );
|
45 |
+
update_option( "acui_cron_path_to_move", sanitize_text_field( $form_data["path_to_move"] ) );
|
46 |
+
update_option( "acui_cron_period", sanitize_text_field( $form_data["period"] ) );
|
47 |
+
update_option( "acui_cron_role", sanitize_text_field( $form_data["role"] ) );
|
48 |
+
update_option( "acui_cron_update_roles_existing_users", isset( $form_data["update-roles-existing-users"] ) && $form_data["update-roles-existing-users"] == "yes" );
|
49 |
+
update_option( "acui_cron_change_role_not_present", isset( $form_data["cron-change-role-not-present"] ) && $form_data["cron-change-role-not-present"] == "yes" );
|
50 |
+
update_option( "acui_cron_change_role_not_present_role", sanitize_text_field( $form_data["cron-change-role-not-present-role"] ) );
|
51 |
+
?>
|
52 |
+
<div class="updated">
|
53 |
+
<p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
|
54 |
+
</div>
|
55 |
+
<?php
|
56 |
+
}
|
57 |
+
|
58 |
+
function process(){
|
59 |
+
$message = __('Import cron task starts at', 'import-users-from-csv-with-meta' ) . ' ' . date("Y-m-d H:i:s") . '<br/>';
|
60 |
+
|
61 |
+
$form_data = array();
|
62 |
+
$form_data[ "path_to_file" ] = get_option( "acui_cron_path_to_file");
|
63 |
+
$form_data[ "role" ] = get_option( "acui_cron_role");
|
64 |
+
$form_data[ "update_roles_existing_users" ] = ( get_option( "acui_cron_update_roles_existing_users" ) ) ? 'yes' : 'no';
|
65 |
+
$form_data[ "empty_cell_action" ] = "leave";
|
66 |
+
$form_data[ "allow_update_emails" ] = "disallow";
|
67 |
+
$form_data[ "security" ] = wp_create_nonce( "codection-security" );
|
68 |
+
|
69 |
+
ob_start();
|
70 |
+
acui_fileupload_process( $form_data, true );
|
71 |
+
$message .= "<br/>" . ob_get_contents() . "<br/>";
|
72 |
+
ob_end_clean();
|
73 |
+
|
74 |
+
$move_file_cron = get_option( "acui_move_file_cron");
|
75 |
+
|
76 |
+
if( $move_file_cron ){
|
77 |
+
$path_to_file = get_option( "acui_cron_path_to_file");
|
78 |
+
$path_to_move = get_option( "acui_cron_path_to_move");
|
79 |
+
|
80 |
+
rename( $path_to_file, $path_to_move );
|
81 |
+
|
82 |
+
$this->auto_rename(); // optionally rename with date and time included
|
83 |
+
}
|
84 |
+
$message .= __( '--Finished at', 'import-users-from-csv-with-meta' ) . ' ' . date("Y-m-d H:i:s") . '<br/><br/>';
|
85 |
+
|
86 |
+
update_option( "acui_cron_log", $message );
|
87 |
+
}
|
88 |
+
|
89 |
+
function auto_rename() {
|
90 |
+
if( get_option( "acui_cron_path_to_move_auto_rename" ) != true )
|
91 |
+
return;
|
92 |
+
|
93 |
+
$movefile = get_option( "acui_cron_path_to_move");
|
94 |
+
|
95 |
+
if ( $movefile && file_exists( $movefile ) ) {
|
96 |
+
$parts = pathinfo( $movefile );
|
97 |
+
$filename = $parts['filename'];
|
98 |
+
|
99 |
+
if ( $filename ){
|
100 |
+
$date = date( 'YmdHis' );
|
101 |
+
$newfile = $parts['dirname'] . '/' . $filename .'_' . $date . '.' . $parts['extension'];
|
102 |
+
rename( $movefile , $newfile );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
public static function admin_gui(){
|
108 |
$cron_activated = get_option( "acui_cron_activated");
|
109 |
$send_mail_cron = get_option( "acui_cron_send_mail");
|
379 |
</script>
|
380 |
<?php
|
381 |
}
|
382 |
+
}
|
383 |
+
|
384 |
+
new ACUI_Cron();
|
classes/frontend.php
CHANGED
@@ -4,12 +4,15 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
4 |
|
5 |
class ACUI_Frontend{
|
6 |
function __construct(){
|
|
|
|
|
7 |
add_shortcode( 'import-users-from-csv-with-meta', array( $this, 'shortcode' ) );
|
8 |
}
|
9 |
|
10 |
public static function admin_gui(){
|
11 |
$send_mail_frontend = get_option( "acui_frontend_send_mail" );
|
12 |
$send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated" );
|
|
|
13 |
$delete_users_frontend = get_option( "acui_frontend_delete_users" );
|
14 |
$delete_users_assign_posts_frontend = get_option( "acui_frontend_delete_users_assign_posts" );
|
15 |
$change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
|
@@ -25,6 +28,9 @@ class ACUI_Frontend{
|
|
25 |
if( empty( $send_mail_updated_frontend ) )
|
26 |
$send_mail_updated_frontend = false;
|
27 |
|
|
|
|
|
|
|
28 |
if( empty( $update_existing_users ) )
|
29 |
$update_existing_users = 'no';
|
30 |
|
@@ -87,6 +93,13 @@ class ACUI_Frontend{
|
|
87 |
<input type="checkbox" name="send-mail-updated-frontend" value="yes" <?php if( $send_mail_updated_frontend == true ) echo "checked='checked'"; ?>/>
|
88 |
</td>
|
89 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</tbody>
|
91 |
</table>
|
92 |
|
@@ -190,6 +203,39 @@ class ACUI_Frontend{
|
|
190 |
<?php
|
191 |
}
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
function shortcode( $atts ) {
|
194 |
$atts = shortcode_atts( array( 'role' => '' ), $atts );
|
195 |
|
@@ -203,6 +249,8 @@ class ACUI_Frontend{
|
|
203 |
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
204 |
}
|
205 |
|
|
|
|
|
206 |
$file = array_keys( $_FILES );
|
207 |
$csv_file_id = $this->upload_file( $file[0] );
|
208 |
|
@@ -235,6 +283,8 @@ class ACUI_Frontend{
|
|
235 |
acui_fileupload_process( $form_data, false, true );
|
236 |
|
237 |
wp_delete_attachment( $csv_file_id, true );
|
|
|
|
|
238 |
else:
|
239 |
?>
|
240 |
<form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" class="acui_frontend_form">
|
4 |
|
5 |
class ACUI_Frontend{
|
6 |
function __construct(){
|
7 |
+
add_action( 'acui_frontend_save_settings', array( $this, 'save_settings' ), 10, 1 );
|
8 |
+
add_action( 'acui_post_frontend_import', array( $this, 'email_admin' ) );
|
9 |
add_shortcode( 'import-users-from-csv-with-meta', array( $this, 'shortcode' ) );
|
10 |
}
|
11 |
|
12 |
public static function admin_gui(){
|
13 |
$send_mail_frontend = get_option( "acui_frontend_send_mail" );
|
14 |
$send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated" );
|
15 |
+
$send_mail_admin_frontend = get_option( "acui_frontend_mail_admin" );
|
16 |
$delete_users_frontend = get_option( "acui_frontend_delete_users" );
|
17 |
$delete_users_assign_posts_frontend = get_option( "acui_frontend_delete_users_assign_posts" );
|
18 |
$change_role_not_present_frontend = get_option( "acui_frontend_change_role_not_present" );
|
28 |
if( empty( $send_mail_updated_frontend ) )
|
29 |
$send_mail_updated_frontend = false;
|
30 |
|
31 |
+
if( empty( $send_mail_admin_frontend ) )
|
32 |
+
$send_mail_admin_frontend = false;
|
33 |
+
|
34 |
if( empty( $update_existing_users ) )
|
35 |
$update_existing_users = 'no';
|
36 |
|
93 |
<input type="checkbox" name="send-mail-updated-frontend" value="yes" <?php if( $send_mail_updated_frontend == true ) echo "checked='checked'"; ?>/>
|
94 |
</td>
|
95 |
</tr>
|
96 |
+
|
97 |
+
<tr class="form-field form-required">
|
98 |
+
<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>
|
99 |
+
<td>
|
100 |
+
<input type="checkbox" name="send-mail-admin-frontend" value="yes" <?php if( $send_mail_admin_frontend == true ) echo "checked='checked'"; ?>/>
|
101 |
+
</td>
|
102 |
+
</tr>
|
103 |
</tbody>
|
104 |
</table>
|
105 |
|
203 |
<?php
|
204 |
}
|
205 |
|
206 |
+
function save_settings( $form_data ){
|
207 |
+
if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
|
208 |
+
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
209 |
+
}
|
210 |
+
|
211 |
+
update_option( "acui_frontend_send_mail", isset( $form_data["send-mail-frontend"] ) && $form_data["send-mail-frontend"] == "yes" );
|
212 |
+
update_option( "acui_frontend_send_mail_updated", isset( $form_data["send-mail-updated-frontend"] ) && $form_data["send-mail-updated-frontend"] == "yes" );
|
213 |
+
update_option( "acui_frontend_mail_admin", isset( $form_data["send-mail-admin-frontend"] ) && $form_data["send-mail-admin-frontend"] == "yes" );
|
214 |
+
update_option( "acui_frontend_delete_users", isset( $form_data["delete-users-frontend"] ) && $form_data["delete-users-frontend"] == "yes" );
|
215 |
+
update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
|
216 |
+
update_option( "acui_frontend_change_role_not_present", isset( $form_data["change-role-not-present-frontend"] ) && $form_data["change-role-not-present-frontend"] == "yes" );
|
217 |
+
update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change-role-not-present-role-frontend"] ) );
|
218 |
+
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' );
|
219 |
+
|
220 |
+
update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
|
221 |
+
update_option( "acui_frontend_update_existing_users", sanitize_text_field( $form_data["update_existing_users"] ) );
|
222 |
+
update_option( "acui_frontend_update_roles_existing_users", sanitize_text_field( $form_data["update_roles_existing_users"] ) );
|
223 |
+
?>
|
224 |
+
<div class="updated">
|
225 |
+
<p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
|
226 |
+
</div>
|
227 |
+
<?php
|
228 |
+
}
|
229 |
+
|
230 |
+
function email_admin(){
|
231 |
+
$current_user = wp_get_current_user();
|
232 |
+
$current_user_name = ( empty( $current_user ) ) ? 'User not logged in' : $current_user->user_login;
|
233 |
+
|
234 |
+
$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 );
|
235 |
+
|
236 |
+
wp_mail( get_option( 'admin_email' ), '[Import and export users and customers] Frontend import has been executed', $body_mail, array( 'Content-Type: text/html; charset=UTF-8' ) );
|
237 |
+
}
|
238 |
+
|
239 |
function shortcode( $atts ) {
|
240 |
$atts = shortcode_atts( array( 'role' => '' ), $atts );
|
241 |
|
249 |
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
250 |
}
|
251 |
|
252 |
+
do_action( 'acui_pre_frontend_import' );
|
253 |
+
|
254 |
$file = array_keys( $_FILES );
|
255 |
$csv_file_id = $this->upload_file( $file[0] );
|
256 |
|
283 |
acui_fileupload_process( $form_data, false, true );
|
284 |
|
285 |
wp_delete_attachment( $csv_file_id, true );
|
286 |
+
|
287 |
+
do_action ( 'acui_post_frontend_import' );
|
288 |
else:
|
289 |
?>
|
290 |
<form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" class="acui_frontend_form">
|
import-users-from-csv-with-meta.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Import and export users and customers
|
4 |
Plugin URI: https://www.codection.com
|
5 |
Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
|
6 |
-
Version: 1.15.5.
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
@@ -11,7 +11,6 @@ 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 |
-
|
15 |
if ( ! defined( 'ABSPATH' ) )
|
16 |
exit;
|
17 |
|
@@ -36,7 +35,6 @@ function acui_loader(){
|
|
36 |
add_action( 'admin_init', 'acui_modify_user_edit_admin' );
|
37 |
add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );
|
38 |
add_action( 'wp_ajax_acui_bulk_delete_attachment', 'acui_bulk_delete_attachment' );
|
39 |
-
add_action( 'acui_cron_process', 'acui_cron_process', 10 );
|
40 |
add_filter( 'wp_check_filetype_and_ext', 'acui_wp_check_filetype_and_ext', PHP_INT_MAX, 4 );
|
41 |
|
42 |
if( is_plugin_active( 'buddypress/bp-loader.php' ) && file_exists( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' ) ){
|
@@ -101,6 +99,7 @@ function acui_get_default_options_list(){
|
|
101 |
// frontend
|
102 |
'acui_frontend_send_mail'=> false,
|
103 |
'acui_frontend_send_mail_updated' => false,
|
|
|
104 |
'acui_frontend_delete_users' => false,
|
105 |
'acui_frontend_delete_users_assign_posts' => 0,
|
106 |
'acui_frontend_change_role_not_present' => false,
|
@@ -324,29 +323,6 @@ function acui_fileupload_process( $form_data, $is_cron = false, $is_frontend =
|
|
324 |
endif;
|
325 |
}
|
326 |
|
327 |
-
function acui_manage_frontend_process( $form_data ){
|
328 |
-
if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
|
329 |
-
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
330 |
-
}
|
331 |
-
|
332 |
-
update_option( "acui_frontend_send_mail", isset( $form_data["send-mail-frontend"] ) && $form_data["send-mail-frontend"] == "yes" );
|
333 |
-
update_option( "acui_frontend_send_mail_updated", isset( $form_data["send-mail-updated-frontend"] ) && $form_data["send-mail-updated-frontend"] == "yes" );
|
334 |
-
update_option( "acui_frontend_delete_users", isset( $form_data["delete-users-frontend"] ) && $form_data["delete-users-frontend"] == "yes" );
|
335 |
-
update_option( "acui_frontend_delete_users_assign_posts", sanitize_text_field( $form_data["delete-users-assign-posts-frontend"] ) );
|
336 |
-
update_option( "acui_frontend_change_role_not_present", isset( $form_data["change-role-not-present-frontend"] ) && $form_data["change-role-not-present-frontend"] == "yes" );
|
337 |
-
update_option( "acui_frontend_change_role_not_present_role", sanitize_text_field( $form_data["change-role-not-present-role-frontend"] ) );
|
338 |
-
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' );
|
339 |
-
|
340 |
-
update_option( "acui_frontend_role", sanitize_text_field( $form_data["role-frontend"] ) );
|
341 |
-
update_option( "acui_frontend_update_existing_users", sanitize_text_field( $form_data["update_existing_users"] ) );
|
342 |
-
update_option( "acui_frontend_update_roles_existing_users", sanitize_text_field( $form_data["update_roles_existing_users"] ) );
|
343 |
-
?>
|
344 |
-
<div class="updated">
|
345 |
-
<p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
|
346 |
-
</div>
|
347 |
-
<?php
|
348 |
-
}
|
349 |
-
|
350 |
function acui_manage_extra_profile_fields( $form_data ){
|
351 |
if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
|
352 |
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
@@ -392,100 +368,6 @@ function acui_save_mail_template( $form_data ){
|
|
392 |
<?php
|
393 |
}
|
394 |
|
395 |
-
function acui_manage_cron_process( $form_data ){
|
396 |
-
if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
|
397 |
-
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
398 |
-
}
|
399 |
-
|
400 |
-
$next_timestamp = wp_next_scheduled( 'acui_cron_process' );
|
401 |
-
$period = sanitize_text_field( $form_data[ "period" ] );
|
402 |
-
|
403 |
-
if( isset( $form_data["cron-activated"] ) && $form_data["cron-activated"] == "yes" ){
|
404 |
-
update_option( "acui_cron_activated", true );
|
405 |
-
|
406 |
-
$old_period = get_option( "acui_cron_period" );
|
407 |
-
|
408 |
-
if( $old_period != $period ){
|
409 |
-
wp_unschedule_event( $next_timestamp, 'acui_cron_process');
|
410 |
-
wp_schedule_event( time(), $period, 'acui_cron_process' );
|
411 |
-
}
|
412 |
-
elseif( !$next_timestamp ) {
|
413 |
-
wp_schedule_event( time(), $period, 'acui_cron_process' );
|
414 |
-
}
|
415 |
-
}
|
416 |
-
else{
|
417 |
-
update_option( "acui_cron_activated", false );
|
418 |
-
wp_unschedule_event( $next_timestamp, 'acui_cron_process');
|
419 |
-
}
|
420 |
-
|
421 |
-
update_option( "acui_cron_send_mail", isset( $form_data["send-mail-cron"] ) && $form_data["send-mail-cron"] == "yes" );
|
422 |
-
update_option( "acui_cron_send_mail_updated", isset( $form_data["send-mail-updated"] ) && $form_data["send-mail-updated"] == "yes" );
|
423 |
-
update_option( "acui_cron_delete_users", isset( $form_data["cron-delete-users"] ) && $form_data["cron-delete-users"] == "yes" );
|
424 |
-
update_option( "acui_cron_delete_users_assign_posts", sanitize_text_field( $form_data["cron-delete-users-assign-posts"] ) );
|
425 |
-
update_option( "acui_move_file_cron", isset( $form_data["move-file-cron"] ) && $form_data["move-file-cron"] == "yes" );
|
426 |
-
update_option( "acui_cron_path_to_move_auto_rename", isset( $form_data["path_to_move_auto_rename"] ) && $form_data["path_to_move_auto_rename"] == "yes" );
|
427 |
-
update_option( "acui_cron_allow_multiple_accounts", ( isset( $form_data["allow_multiple_accounts"] ) && $form_data["allow_multiple_accounts"] == "yes" ) ? "allowed" : "not_allowed" );
|
428 |
-
update_option( "acui_cron_path_to_file", sanitize_text_field( $form_data["path_to_file"] ) );
|
429 |
-
update_option( "acui_cron_path_to_move", sanitize_text_field( $form_data["path_to_move"] ) );
|
430 |
-
update_option( "acui_cron_period", sanitize_text_field( $form_data["period"] ) );
|
431 |
-
update_option( "acui_cron_role", sanitize_text_field( $form_data["role"] ) );
|
432 |
-
update_option( "acui_cron_update_roles_existing_users", isset( $form_data["update-roles-existing-users"] ) && $form_data["update-roles-existing-users"] == "yes" );
|
433 |
-
update_option( "acui_cron_change_role_not_present", isset( $form_data["cron-change-role-not-present"] ) && $form_data["cron-change-role-not-present"] == "yes" );
|
434 |
-
update_option( "acui_cron_change_role_not_present_role", sanitize_text_field( $form_data["cron-change-role-not-present-role"] ) );
|
435 |
-
?>
|
436 |
-
<div class="updated">
|
437 |
-
<p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
|
438 |
-
</div>
|
439 |
-
<?php
|
440 |
-
}
|
441 |
-
|
442 |
-
function acui_cron_process(){
|
443 |
-
$message = __('Import cron task starts at', 'import-users-from-csv-with-meta' ) . ' ' . date("Y-m-d H:i:s") . '<br/>';
|
444 |
-
|
445 |
-
$form_data = array();
|
446 |
-
$form_data[ "path_to_file" ] = get_option( "acui_cron_path_to_file");
|
447 |
-
$form_data[ "role" ] = get_option( "acui_cron_role");
|
448 |
-
$form_data[ "update_roles_existing_users" ] = ( get_option( "acui_cron_update_roles_existing_users" ) ) ? 'yes' : 'no';
|
449 |
-
$form_data[ "empty_cell_action" ] = "leave";
|
450 |
-
$form_data[ "allow_update_emails" ] = "disallow";
|
451 |
-
$form_data[ "security" ] = wp_create_nonce( "codection-security" );
|
452 |
-
|
453 |
-
ob_start();
|
454 |
-
acui_fileupload_process( $form_data, true );
|
455 |
-
$message .= "<br/>" . ob_get_contents() . "<br/>";
|
456 |
-
ob_end_clean();
|
457 |
-
|
458 |
-
$move_file_cron = get_option( "acui_move_file_cron");
|
459 |
-
|
460 |
-
if( $move_file_cron ){
|
461 |
-
$path_to_file = get_option( "acui_cron_path_to_file");
|
462 |
-
$path_to_move = get_option( "acui_cron_path_to_move");
|
463 |
-
|
464 |
-
rename( $path_to_file, $path_to_move );
|
465 |
-
|
466 |
-
acui_cron_process_auto_rename(); // optionally rename with date and time included
|
467 |
-
}
|
468 |
-
$message .= __( '--Finished at', 'import-users-from-csv-with-meta' ) . ' ' . date("Y-m-d H:i:s") . '<br/><br/>';
|
469 |
-
|
470 |
-
update_option( "acui_cron_log", $message );
|
471 |
-
}
|
472 |
-
|
473 |
-
function acui_cron_process_auto_rename() {
|
474 |
-
if( get_option( "acui_cron_path_to_move_auto_rename" ) != true )
|
475 |
-
return;
|
476 |
-
|
477 |
-
$movefile = get_option( "acui_cron_path_to_move");
|
478 |
-
if ($movefile && file_exists($movefile)) {
|
479 |
-
$parts = pathinfo($movefile);
|
480 |
-
$filename = $parts['filename'];
|
481 |
-
if ($filename){
|
482 |
-
$date = date('YmdHis');
|
483 |
-
$newfile = $parts['dirname'] . '/' . $filename .'_' . $date . '.' . $parts['extension'];
|
484 |
-
rename($movefile , $newfile);
|
485 |
-
}
|
486 |
-
}
|
487 |
-
}
|
488 |
-
|
489 |
function acui_extra_user_profile_fields( $user ) {
|
490 |
$acui_restricted_fields = acui_get_restricted_fields();
|
491 |
$headers = get_option("acui_columns");
|
@@ -714,35 +596,4 @@ function acui_get_attachment_id_by_url( $url ) {
|
|
714 |
}
|
715 |
|
716 |
return false;
|
717 |
-
}
|
718 |
-
|
719 |
-
function acui_return_false(){
|
720 |
-
return false;
|
721 |
-
}
|
722 |
-
|
723 |
-
// email repeated
|
724 |
-
function acui_hack_email( $email ) {
|
725 |
-
if ( ! is_email( $email ) ) {
|
726 |
-
return;
|
727 |
-
}
|
728 |
-
|
729 |
-
$old_email = $email;
|
730 |
-
|
731 |
-
for ( $i = 0; ! $skip_remap && email_exists( $email ); $i++ ) {
|
732 |
-
$email = str_replace( '@', "+ama{$i}@", $old_email );
|
733 |
-
}
|
734 |
-
|
735 |
-
return $email;
|
736 |
-
}
|
737 |
-
|
738 |
-
function acui_hack_restore_remapped_email_address( $user_id, $email ) {
|
739 |
-
global $wpdb;
|
740 |
-
|
741 |
-
$wpdb->update(
|
742 |
-
$wpdb->users,
|
743 |
-
array( 'user_email' => $email ),
|
744 |
-
array( 'ID' => $user_id )
|
745 |
-
);
|
746 |
-
|
747 |
-
clean_user_cache( $user_id );
|
748 |
}
|
3 |
Plugin Name: Import and export users and customers
|
4 |
Plugin URI: https://www.codection.com
|
5 |
Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
|
6 |
+
Version: 1.15.5.3
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
11 |
Text Domain: import-users-from-csv-with-meta
|
12 |
Domain Path: /languages
|
13 |
*/
|
|
|
14 |
if ( ! defined( 'ABSPATH' ) )
|
15 |
exit;
|
16 |
|
35 |
add_action( 'admin_init', 'acui_modify_user_edit_admin' );
|
36 |
add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );
|
37 |
add_action( 'wp_ajax_acui_bulk_delete_attachment', 'acui_bulk_delete_attachment' );
|
|
|
38 |
add_filter( 'wp_check_filetype_and_ext', 'acui_wp_check_filetype_and_ext', PHP_INT_MAX, 4 );
|
39 |
|
40 |
if( is_plugin_active( 'buddypress/bp-loader.php' ) && file_exists( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' ) ){
|
99 |
// frontend
|
100 |
'acui_frontend_send_mail'=> false,
|
101 |
'acui_frontend_send_mail_updated' => false,
|
102 |
+
'acui_frontend_mail_admin' => false,
|
103 |
'acui_frontend_delete_users' => false,
|
104 |
'acui_frontend_delete_users_assign_posts' => 0,
|
105 |
'acui_frontend_change_role_not_present' => false,
|
323 |
endif;
|
324 |
}
|
325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
function acui_manage_extra_profile_fields( $form_data ){
|
327 |
if ( !isset( $form_data['security'] ) || !wp_verify_nonce( $form_data['security'], 'codection-security' ) ) {
|
328 |
wp_die( __( 'Nonce check failed', 'import-users-from-csv-with-meta' ) );
|
368 |
<?php
|
369 |
}
|
370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
function acui_extra_user_profile_fields( $user ) {
|
372 |
$acui_restricted_fields = acui_get_restricted_fields();
|
373 |
$headers = get_option("acui_columns");
|
596 |
}
|
597 |
|
598 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
}
|
importer.php
CHANGED
@@ -66,8 +66,8 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
66 |
|
67 |
// disable WordPress default emails if this must be disabled
|
68 |
if( !get_option('acui_automatic_wordpress_email') ){
|
69 |
-
add_filter( 'send_email_change_email',
|
70 |
-
add_filter( 'send_password_change_email',
|
71 |
}
|
72 |
|
73 |
// action
|
@@ -623,8 +623,8 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
623 |
|
624 |
// let the filter of default WordPress emails as it were before deactivating them
|
625 |
if( !get_option('acui_automatic_wordpress_email') ){
|
626 |
-
remove_filter( 'send_email_change_email',
|
627 |
-
remove_filter( 'send_password_change_email',
|
628 |
}
|
629 |
|
630 |
if( $attach_id != 0 )
|
@@ -737,7 +737,7 @@ function acui_options(){
|
|
737 |
break;
|
738 |
|
739 |
case 'frontend':
|
740 |
-
|
741 |
break;
|
742 |
|
743 |
case 'columns':
|
@@ -749,7 +749,7 @@ function acui_options(){
|
|
749 |
break;
|
750 |
|
751 |
case 'cron':
|
752 |
-
|
753 |
break;
|
754 |
}
|
755 |
endif;
|
66 |
|
67 |
// disable WordPress default emails if this must be disabled
|
68 |
if( !get_option('acui_automatic_wordpress_email') ){
|
69 |
+
add_filter( 'send_email_change_email', function() { return false; }, 999 );
|
70 |
+
add_filter( 'send_password_change_email', function() { return false; }, 999 );
|
71 |
}
|
72 |
|
73 |
// action
|
623 |
|
624 |
// let the filter of default WordPress emails as it were before deactivating them
|
625 |
if( !get_option('acui_automatic_wordpress_email') ){
|
626 |
+
remove_filter( 'send_email_change_email', function() { return false; }, 999 );
|
627 |
+
remove_filter( 'send_password_change_email', function() { return false; }, 999 );
|
628 |
}
|
629 |
|
630 |
if( $attach_id != 0 )
|
737 |
break;
|
738 |
|
739 |
case 'frontend':
|
740 |
+
do_action( 'acui_frontend_save_settings', $_POST );
|
741 |
break;
|
742 |
|
743 |
case 'columns':
|
749 |
break;
|
750 |
|
751 |
case 'cron':
|
752 |
+
do_action( 'acui_cron_save_settings', $_POST );
|
753 |
break;
|
754 |
}
|
755 |
endif;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://codection.com/go/donate-import-users-from-csv-with-meta/
|
|
4 |
Tags: csv, import, importer, meta data, meta, user, users, user meta, editor, profile, custom, fields, delimiter, update, insert
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 5.3.2
|
7 |
-
Stable tag: 1.15.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -98,6 +98,10 @@ Plugin will automatically detect:
|
|
98 |
|
99 |
== Changelog ==
|
100 |
|
|
|
|
|
|
|
|
|
101 |
= 1.15.5.2 =
|
102 |
* Bug found on export fixed
|
103 |
|
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.3.2
|
7 |
+
Stable tag: 1.15.5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
98 |
|
99 |
== Changelog ==
|
100 |
|
101 |
+
= 1.15.5.3 =
|
102 |
+
* Email notification can be sent to administrator of the website when someone use the frontend importer
|
103 |
+
* Code improvement
|
104 |
+
|
105 |
= 1.15.5.2 =
|
106 |
* Bug found on export fixed
|
107 |
|