| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Import Users plugin file. | |
| 4 | - * | |
| 5 | - * Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com | |
| 6 | - */ | |
| 7 | - | |
| 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 | + *******************************************************************************************/ | |
| 8 | 8 | namespace Smackcoders\SMUSERS; |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) |
| 11 | 11 | exit; // Exit if accessed directly |
| @@ -37,8 +37,9 @@ | ||
| 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')); | |
| 41 | 42 | add_action('wp_ajax_get_options', array($this,'showOptions')); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | /** |
| @@ -45,9 +46,8 @@ | ||
| 45 | 46 | * Function for save settings options |
| 46 | 47 | * |
| 47 | 48 | */ |
| 48 | 49 | 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,9 +64,8 @@ | ||
| 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'); | |
| 69 | 68 | $ucisettings = get_option('sm_uci_pro_settings'); |
| 70 | 69 | foreach ($ucisettings as $key => $val) { |
| 71 | 70 | $settings[$key] = json_decode($val); |
| 72 | 71 | } |
| @@ -79,16 +78,13 @@ | ||
| 79 | 78 | * send login credential to user |
| 80 | 79 | * |
| 81 | 80 | */ |
| 82 | 81 | public function send_login_credentials_to_users() { |
| 83 | - | |
| 84 | 82 | require_once(ABSPATH . "wp-includes/pluggable.php"); |
| 85 | 83 | global $wpdb; |
| 86 | 84 | $ucisettings = get_option('sm_uci_pro_settings'); |
| 87 | 85 | if($ucisettings['send_user_password'] == "true") { |
| 88 | 86 | $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; | |
| 91 | 87 | if(!empty($get_user_meta_info)) { |
| 92 | 88 | foreach($get_user_meta_info as $key => $value) { |
| 93 | 89 | $data_array = maybe_unserialize($value->meta_value); |
| 94 | 90 | $currentUser = wp_get_current_user(); |
| @@ -93,9 +89,9 @@ | ||
| 93 | 89 | $data_array = maybe_unserialize($value->meta_value); |
| 94 | 90 | $currentUser = wp_get_current_user(); |
| 95 | 91 | $admin_email = $currentUser->user_email; |
| 96 | 92 | $em_headers = "From: Administrator <$admin_email>"; # . "\r\n"; |
| 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(); | |
| 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(); | |
| 98 | 94 | $emailaddress = $data_array['user_email']; |
| 99 | 95 | $subject = 'Login Details'; |
| 100 | 96 | if( wp_mail( $emailaddress, $subject, $message) ){ |
| 101 | 97 | delete_user_meta($value->user_id, 'smack_uci_import'); |