function wp_password_reset_hook($user, $pass)
 {
     $swpm_user = SwpmMemberUtils::get_user_by_user_name($user->user_login);
     $swpm_id = $swpm_user->member_id;
     if (!empty($swpm_id)) {
         $password_hash = SwpmUtils::encrypt_password($pass);
         global $wpdb;
         $wpdb->update($wpdb->prefix . "swpm_members_tbl", array('password' => $password_hash), array('member_id' => $swpm_id));
     }
 }
 protected function send_reg_email()
 {
     global $wpdb;
     if (empty($this->member_info)) {
         return false;
     }
     $member_info = $this->member_info;
     $settings = SwpmSettings::get_instance();
     $subject = $settings->get_value('reg-complete-mail-subject');
     $body = $settings->get_value('reg-complete-mail-body');
     $from_address = $settings->get_value('email-from');
     $login_link = $settings->get_value('login-page-url');
     $headers = 'From: ' . $from_address . "\r\n";
     $member_info['membership_level_name'] = SwpmPermission::get_instance($member_info['membership_level'])->get('alias');
     $member_info['password'] = $member_info['plain_password'];
     $member_info['login_link'] = $login_link;
     $values = array_values($member_info);
     $keys = array_map('swpm_enclose_var', array_keys($member_info));
     $body = html_entity_decode($body);
     $body = str_replace($keys, $values, $body);
     $swpm_user = SwpmMemberUtils::get_user_by_user_name($member_info['user_name']);
     $member_id = $swpm_user->member_id;
     $body = SwpmMiscUtils::replace_dynamic_tags($body, $member_id);
     //Do the standard merge var replacement.
     $email = sanitize_email(filter_input(INPUT_POST, 'email', FILTER_UNSAFE_RAW));
     //Send notification email to the member
     wp_mail(trim($email), $subject, $body, $headers);
     SwpmLog::log_simple_debug('Member notification email sent to: ' . $email, true);
     if ($settings->get_value('enable-admin-notification-after-reg')) {
         //Send notification email to the site admin
         $admin_notification = $settings->get_value('admin-notification-email');
         $admin_notification = empty($admin_notification) ? $from_address : $admin_notification;
         $notify_emails_array = explode(",", $admin_notification);
         $headers = 'From: ' . $from_address . "\r\n";
         $subject = "Notification of New Member Registration";
         $admin_notify_body = $settings->get_value('reg-complete-mail-body-admin');
         if (empty($admin_notify_body)) {
             $admin_notify_body = "A new member has completed the registration.\n\n" . "Username: {user_name}\n" . "Email: {email}\n\n" . "Please login to the admin dashboard to view details of this user.\n\n" . "You can customize this email message from the Email Settings menu of the plugin.\n\n" . "Thank You";
         }
         $admin_notify_body = SwpmMiscUtils::replace_dynamic_tags($admin_notify_body, $member_id);
         //Do the standard merge var replacement.
         foreach ($notify_emails_array as $to_email) {
             $to_email = trim($to_email);
             wp_mail($to_email, $subject, $admin_notify_body, $headers);
             SwpmLog::log_simple_debug('Admin notification email sent to: ' . $to_email, true);
         }
     }
     return true;
 }