WordPress.org

Make WordPress Core

Ticket #32430: 32430.rmarks.patch

File 32430.rmarks.patch, 2.8 KB (added by RMarks, 3 years ago)

First draft of password notice to user.

  • wp-includes/pluggable.php

    diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
    index 4c2cc01..a5a792f 100644
    a b if ( !function_exists('wp_password_change_notification') ) : 
    16541654/** 
    16551655 * Notify the blog admin of a user changing password, normally via email. 
    16561656 * 
     1657 * Notify the user of any change to their password, also via email. 
     1658 * 
    16571659 * @since 2.7.0 
    16581660 * 
    16591661 * @param object $user User Object 
    16601662 */ 
    16611663function wp_password_change_notification(&$user) { 
    1662         // send a copy of password change notification to the admin 
     1664        // send password change notification to the admin 
    16631665        // but check to see if it's the admin whose password we're changing, and skip this 
    16641666        if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) { 
    16651667                $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; 
    function wp_password_change_notification(&$user) { 
    16671669                // we want to reverse this for the plain text arena of emails. 
    16681670                $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 
    16691671                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message); 
     1672 
     1673        //send password change notification to the user 
     1674        } else { 
     1675                /* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 
     1676                $email_text = __( 'Howdy ###USERNAME###, 
     1677 
     1678This notice is confirming you recently changed your password on ###SITENAME###. 
     1679 
     1680If you did not change your password, please contact the Site Administrator at 
     1681###ADMIN_EMAIL### 
     1682 
     1683This email has been sent to ###EMAIL### 
     1684 
     1685Regards, 
     1686All at ###SITENAME### 
     1687###SITEURL###' ); 
     1688 
     1689                /** 
     1690                 * Filter the email text sent when the user's password is changed. 
     1691                 * 
     1692                 * The following strings have a special meaning and will get replaced dynamically: 
     1693                 * ###USERNAME###    The current user's username. 
     1694                 * ###ADMIN_EMAIL### The link to click on to confirm the email change. 
     1695                 * ###EMAIL###       The new email. 
     1696                 * ###SITENAME###    The name of the site. 
     1697                 * ###SITEURL###     The URL to the site. 
     1698                 * 
     1699                 * @since 4.3 
     1700                 * 
     1701                 * @param string $email_text      Text in the email. 
     1702                 */ 
     1703                $content = apply_filters( 'user_password_change_email_content', $email_text ); 
     1704 
     1705                $content = str_replace( '###USERNAME###', $user->user_login, $content ); 
     1706                $content = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $content ); 
     1707                $content = str_replace( '###EMAIL###', $user->user_email, $content ); 
     1708                $content = str_replace( '###SITENAME###', get_option( 'blogname' ), $content ); 
     1709                $content = str_replace( '###SITEURL###', get_option( 'siteurl' ), $content ); 
     1710 
     1711                wp_mail( $user->user_email, sprintf( __( '[%s] Notice of Password Change' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content ); 
    16701712        } 
    16711713} 
    16721714endif;