Make WordPress Core

Changeset 34107


Ignore:
Timestamp:
09/14/2015 02:44:41 AM (9 years ago)
Author:
boonebgorges
Message:

Send password-change email notifications via hook.

wp_password_change_notification() is now called at the 'after_password_reset'
action, rather than being invoked directly from the reset_password() function.

In order to make it possible to call wp_password_change_notification() as a
do_action() callback, the function signature has to be changed so that the
$user parameter is expected to be a value rather than a reference. Since
PHP 5.0, objects are passed by reference, so &$user was unnecessary anyway.

Props dshanske, thomaswm.
See #33587.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r34106 r34107  
    338338add_action( 'comment_post', 'wp_new_comment_notify_moderator', 10, 2 );
    339339add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
     340add_action( 'after_password_reset', 'wp_password_change_notification' );
    340341
    341342/**
  • trunk/src/wp-includes/pluggable.php

    r34052 r34107  
    16681668 * @since 2.7.0
    16691669 *
    1670  * @param object $user User Object
    1671  */
    1672 function wp_password_change_notification(&$user) {
     1670 * @param WP_User $user User object.
     1671 */
     1672function wp_password_change_notification( $user ) {
    16731673    // send a copy of password change notification to the admin
    16741674    // but check to see if it's the admin whose password we're changing, and skip this
  • trunk/src/wp-includes/user-functions.php

    r33954 r34107  
    19171917    update_user_option( $user->ID, 'default_password_nag', false, true );
    19181918
    1919     wp_password_change_notification( $user );
     1919    /**
     1920     * Fires after the user's password is reset.
     1921     *
     1922     * @since 4.4.0
     1923     *
     1924     * @param object $user     The user.
     1925     * @param string $new_pass New user password.
     1926     */
     1927    do_action( 'after_password_reset', $user, $new_pass );
    19201928}
    19211929
Note: See TracChangeset for help on using the changeset viewer.