WordPress.org

Make WordPress Core

Ticket #12184: changes.diff

File changes.diff, 6.4 KB (added by jfarthing84, 8 years ago)

Modifications to wp-login.php and pluggable.php

  • wp-includes/pluggable.php

     
    11291129}
    11301130endif;
    11311131
    1132 if ( !function_exists('wp_password_change_notification') ) :
    1133 /**
    1134  * Notify the blog admin of a user changing password, normally via email.
    1135  *
    1136  * @since 2.7
    1137  *
    1138  * @param object $user User Object
    1139  */
    1140 function wp_password_change_notification(&$user) {
    1141         // send a copy of password change notification to the admin
    1142         // but check to see if it's the admin whose password we're changing, and skip this
    1143         if ( $user->user_email != get_option('admin_email') ) {
    1144                 $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
    1145                 // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    1146                 // we want to reverse this for the plain text arena of emails.
    1147                 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    1148                 wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
    1149         }
    1150 }
    1151 endif;
    1152 
    1153 if ( !function_exists('wp_new_user_notification') ) :
    1154 /**
    1155  * Notify the blog admin of a new user, normally via email.
    1156  *
    1157  * @since 2.0
    1158  *
    1159  * @param int $user_id User ID
    1160  * @param string $plaintext_pass Optional. The user's plaintext password
    1161  */
    1162 function wp_new_user_notification($user_id, $plaintext_pass = '') {
    1163         $user = new WP_User($user_id);
    1164 
    1165         $user_login = stripslashes($user->user_login);
    1166         $user_email = stripslashes($user->user_email);
    1167 
    1168         // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    1169         // we want to reverse this for the plain text arena of emails.
    1170         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    1171 
    1172         $message  = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
    1173         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    1174         $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
    1175 
    1176         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
    1177 
    1178         if ( empty($plaintext_pass) )
    1179                 return;
    1180 
    1181         $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
    1182         $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    1183         $message .= wp_login_url() . "\r\n";
    1184 
    1185         wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
    1186 
    1187 }
    1188 endif;
    1189 
    11901132if ( !function_exists('wp_nonce_tick') ) :
    11911133/**
    11921134 * Get the time-dependent variable for nonce creation.
  • wp-login.php

     
    317317        return $user_id;
    318318}
    319319
     320if ( !function_exists('wp_password_change_notification') ) :
     321/**
     322 * Notify the blog admin of a user changing password, normally via email.
     323 *
     324 * NOTE: The method of overriding this function has been deprecated. The provided hooks should be used instead.
     325 *
     326 * @since 2.7
     327 *
     328 * @param object $user User Object
     329 */
     330function wp_password_change_notification(&$user) {
     331        // Allow plugins to short-circuit notification
     332        $disable = apply_filters('disable_password_change_notification', false, $user);
     333        if ( $disable )
     334                return;
     335
     336        do_action('password_change_notification', $user);
     337        // send a copy of password change notification to the admin
     338        // but check to see if it's the admin whose password we're changing, and skip this
     339        if ( $user->user_email != get_option('admin_email') ) {
     340                $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
     341                // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     342                // we want to reverse this for the plain text arena of emails.
     343                $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     344               
     345                $title = sprintf(__('[%s] Password Lost/Changed'), $blogname);
     346               
     347                $title = apply_filters('password_change_admin_notification_title', $title);
     348                $message = apply_fitlers('password_change_admin_notification_message', $message, $user);
     349               
     350                @wp_mail(get_option('admin_email'), $title, $message);
     351        }
     352}
     353endif;
     354
     355if ( !function_exists('wp_new_user_notification') ) :
     356/**
     357 * Notify the blog admin of a new user, normally via email.
     358 *
     359 * NOTE: The method of overriding this function has been deprecated. The provided hooks should be used instead.
     360 *
     361 * @since 2.0
     362 *
     363 * @param int $user_id User ID
     364 * @param string $plaintext_pass Optional. The user's plaintext password
     365 */
     366function wp_new_user_notification($user_id, $plaintext_pass = '') {
     367        $user = new WP_User($user_id);
     368       
     369        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     370        // we want to reverse this for the plain text arena of emails.
     371        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     372       
     373        // Allow plugins to short-circuit admin notification
     374        $disable = apply_filters('disable_new_user_admin_notification', false, $user);
     375        if ( ! $disable ) {             
     376                do_action('new_user_admin_notification', $user);
     377
     378                $user_login = stripslashes($user->user_login);
     379                $user_email = stripslashes($user->user_email);
     380
     381                $message  = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
     382                $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
     383                $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
     384       
     385                $title = sprintf(__('[%s] New User Registration'), $blogname);
     386       
     387                $title = apply_filters('new_user_admin_notification_title', $title);
     388                $message = apply_filters('new_user_admin_notification_message', $message, $user);
     389
     390                @wp_mail(get_option('admin_email'), $title, $message);
     391        }
     392       
     393        if ( empty($plaintext_pass) )
     394                return;
     395       
     396        // Allow plugins to short-circuit user notification
     397        $disable = apply_filters('disable_new_user_notification', false, $user);
     398        if ( ! $disable ) {
     399                do_action('new_user_notification', $user, $plaintext_pass);
     400
     401                $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
     402                $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
     403                $message .= wp_login_url() . "\r\n";
     404       
     405                $title = sprintf(__('[%s] Your username and password'), $blogname);
     406       
     407                $title = apply_filters('new_user_notification', $title);
     408                $message = apply_filters('new_user_notification', $message, $user, $plaintext_pass);
     409
     410                wp_mail($user_email, $title, $message);
     411        }
     412}
     413endif;
     414
    320415//
    321416// Main
    322417//