PluginProbe
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on / trunk
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on vtrunk
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 | controllers/SendPassword.php +6 -2 1.2.4trunk View file →
@@ -37,9 +37,8 @@
37 37 * SendPassword hooks.
38 38 */
39 39 public function doHooks(){
40 40 add_action('wp_ajax_settings_options', array($this,'settingsOptions'));
41 - add_action('wp_ajax_send_login_credentials_to_users', array($this,'send_login_credentials_to_users'));
42 41 add_action('wp_ajax_get_options', array($this,'showOptions'));
43 42 }
44 43
45 44 /**
@@ -46,8 +45,9 @@
46 45 * Function for save settings options
47 46 *
48 47 */
49 48 public function settingsOptions() {
49 + check_ajax_referer('smack-ultimate-csv-importer', 'securekey');
50 50 $ucisettings = get_option('sm_uci_pro_settings');
51 51 $option = sanitize_text_field($_POST['option']);
52 52 $value = sanitize_text_field($_POST['value']);
53 53 foreach ($ucisettings as $key => $val) {
@@ -64,8 +64,9 @@
64 64 * Function for show settings options
65 65 *
66 66 */
67 67 public function showOptions() {
68 + check_ajax_referer('smack-ultimate-csv-importer', 'securekey');
68 69 $ucisettings = get_option('sm_uci_pro_settings');
69 70 foreach ($ucisettings as $key => $val) {
70 71 $settings[$key] = json_decode($val);
71 72 }
@@ -78,13 +79,16 @@
78 79 * send login credential to user
79 80 *
80 81 */
81 82 public function send_login_credentials_to_users() {
83 +
82 84 require_once(ABSPATH . "wp-includes/pluggable.php");
83 85 global $wpdb;
84 86 $ucisettings = get_option('sm_uci_pro_settings');
85 87 if($ucisettings['send_user_password'] == "true") {
86 88 $get_user_meta_info = $wpdb->get_results( $wpdb->prepare("select *from {$wpdb->prefix}usermeta where meta_key like %s", '%' . 'smack_uci_import' . '%') );
89 + $get_send_password_info = $wpdb->get_results( $wpdb->prepare("select meta_value from {$wpdb->prefix}usermeta where meta_key like %s", '%' . 'sendPassword' . '%') );
90 + $send_password=$get_send_password_info[0]->meta_value;
87 91 if(!empty($get_user_meta_info)) {
88 92 foreach($get_user_meta_info as $key => $value) {
89 93 $data_array = maybe_unserialize($value->meta_value);
90 94 $currentUser = wp_get_current_user();
@@ -89,9 +93,9 @@
89 93 $data_array = maybe_unserialize($value->meta_value);
90 94 $currentUser = wp_get_current_user();
91 95 $admin_email = $currentUser->user_email;
92 96 $em_headers = "From: Administrator <$admin_email>"; # . "\r\n";
93 - $message = "Hi,You've been invited with the role of " . $data_array['role'] . ". Here, your login details." . "\n" . "username: " . $data_array['user_login'] . "\n" . "userpass: " . $data_array['user_pass'] . "\n" . "Please click here to login " . wp_login_url();
97 + $message = "Hi,You've been invited with the role of " . $data_array['role'] . ". Here, your login details." . "\n" . "username: " . $data_array['user_login'] . "\n" . "userpass: " . $send_password . "\n" . "Please click here to login " . wp_login_url();
94 98 $emailaddress = $data_array['user_email'];
95 99 $subject = 'Login Details';
96 100 if( wp_mail( $emailaddress, $subject, $message) ){
97 101 delete_user_meta($value->user_id, 'smack_uci_import');