PluginProbe
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on / 1.2
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on v1.2
2.0 1.7.1 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.5 1.6 1.7 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8
← All changes | importExtensions/UsersImport.php +9 -22 1.41.2 View file →
@@ -1,10 +1,11 @@
1 1 <?php
2 -/**
3 - * Import Users plugin file.
4 - *
5 - * Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com
6 - */
2 +/******************************************************************************************
3 + * Copyright (C) Smackcoders. - All Rights Reserved under Smackcoders Proprietary License
4 + * Unauthorized copying of this file, via any medium is strictly prohibited
5 + * Proprietary and confidential
6 + * You can contact Smackcoders at email address info@smackcoders.com.
7 + *******************************************************************************************/
7 8
8 9 namespace Smackcoders\SMUSERS;
9 10
10 11 if ( ! defined( 'ABSPATH' ) )
@@ -32,9 +33,9 @@
32 33 $created_count = $updated_row_counts['created'];
33 34 $updated_count = $updated_row_counts['updated'];
34 35 $skipped_count = $updated_row_counts['skipped'];
35 36
36 - $data_array['role'] = trim(isset($data_array['role']));
37 + $data_array['role'] = trim($data_array['role']);
37 38 if ( isset( $data_array['role'] ) && $data_array['role'] != '') {
38 39 $user_capability = '';
39 40 if ( !is_numeric( $data_array['role'] ) ) {
40 41 $roles = $this->getRoles();
@@ -64,13 +65,9 @@
64 65 $data_array['role'] = 'subscriber'; #TODO: Add log message for assigning the default role
65 66 }
66 67 $user_email = $data_array['user_email'];
67 68
68 - //filter to change user meta values before import
69 - $data_array = apply_filters('smack_csv_modify_userdata_filter', $data_array);
70 -
71 69 if ( $mode == 'Insert' ) {
72 - $send_password = $data_array['user_pass'] ;
73 70 if ( empty( $data_array['user_pass'] ) ) {
74 71 $data_array['user_pass'] = wp_generate_password( 12, false );
75 72 $additional_meta_info = array(
76 73 'user_login' => $data_array['user_login'],
@@ -79,12 +76,9 @@
79 76 'role' => $data_array['role']
80 77 );
81 78 $data_array['smack_uci_import'] = $additional_meta_info;
82 79 }
83 - else{
84 - if (strlen($data_array['user_pass'])!== 34 && $data_array['user_pass'][0]!=='$'){
85 - $data_array['user_pass']=wp_hash_password($data_array['user_pass']);
86 - }
80 + else{
87 81 $additional_meta_info = array(
88 82 'user_login' => $data_array['user_login'],
89 83 'user_pass' => $data_array['user_pass'],
90 84 'user_email' => $data_array['user_email'],
@@ -92,12 +86,8 @@
92 86 );
93 87 $data_array['smack_uci_import'] = $additional_meta_info;
94 88 }
95 89 $retID = wp_insert_user($data_array);
96 - update_user_meta($retID, 'sendPassword', $send_password);
97 - if ( !is_wp_error($retID) && !empty( $data_array['user_pass'] ) ) {
98 - $wpdb->get_results("UPDATE {$wpdb->prefix}users SET user_pass = '{$data_array['user_pass']}' WHERE ID = $retID");
99 - }
100 90 $mode_of_affect = 'Inserted';
101 91
102 92 if ( is_wp_error( $retID ) ) {
103 93 $core_instance->detailed_log[$line_number]['Message'] = "Skipped, Due to duplicate User found with same email!.";
@@ -162,17 +152,14 @@
162 152
163 153 if ( ! empty ( $metaData ) ) {
164 154 foreach ( $metaData as $meta_key => $meta_value ) {
165 155 update_user_meta( $retID, $meta_key, $meta_value );
166 -
167 - //filter for modifying user metadata after import
168 - apply_filters('smack_csv_modify_metadata_filter', $retID, $meta_key, $meta_value);
169 156 }
170 157 }
171 158 $core_instance->detailed_log[$line_number]['Email'] = $data_array['user_email'];
172 159 $core_instance->detailed_log[$line_number]['Role'] = $data_array['role'];
173 160 $ucisettings = get_option('sm_uci_pro_settings');
174 - if(isset($ucisettings['send_user_password']) && $ucisettings['send_user_password'] == "true") {
161 + if($ucisettings['send_user_password'] == "true") {
175 162 $send_user_password = new SendPassword;
176 163 $send_user_password->send_login_credentials_to_users();
177 164 }
178 165 $returnArr['ID'] = $retID;