Users: Pass the previous state of the user as context to the wp_set_password hook.

Follow-up to [55056], [55250].

Props dd32.
Fixes #61541.
Built from https://develop.svn.wordpress.org/trunk@58653


git-svn-id: http://core.svn.wordpress.org/trunk@58068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-07-03 16:10:16 +00:00
parent f59d23e7f1
commit ed0762ad01
2 changed files with 8 additions and 4 deletions

View File

@ -2768,6 +2768,8 @@ if ( ! function_exists( 'wp_set_password' ) ) :
function wp_set_password( $password, $user_id ) {
global $wpdb;
$old_user_data = get_userdata( $user_id );
$hash = wp_hash_password( $password );
$wpdb->update(
$wpdb->users,
@ -2784,11 +2786,13 @@ if ( ! function_exists( 'wp_set_password' ) ) :
* Fires after the user password is set.
*
* @since 6.2.0
* @since 6.7.0 The `$old_user_data` parameter was added.
*
* @param string $password The plaintext password just set.
* @param int $user_id The ID of the user whose password was just set.
* @param string $password The plaintext password just set.
* @param int $user_id The ID of the user whose password was just set.
* @param WP_User $old_user_data Object containing user's data prior to update.
*/
do_action( 'wp_set_password', $password, $user_id );
do_action( 'wp_set_password', $password, $user_id, $old_user_data );
}
endif;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-58645';
$wp_version = '6.7-alpha-58653';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.