Users: Add an action hook on `wp_set_password()`.

This changeset introduces the `wp_set_password` action hook, triggered after a password is set for a given user. As several plugins are calling `wp_set_password()` directly, adding an action to the end of the function will help plugin authors to catch all instances of password setting.

Props tanner-m, audrasjb.
Fixes #57436.

Built from https://develop.svn.wordpress.org/trunk@55056


git-svn-id: http://core.svn.wordpress.org/trunk@54589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-01-12 09:05:15 +00:00
parent 2c0a6fefae
commit 00ed89ffb1
2 changed files with 11 additions and 1 deletions

View File

@ -2740,6 +2740,16 @@ if ( ! function_exists( 'wp_set_password' ) ) :
); );
clean_user_cache( $user_id ); clean_user_cache( $user_id );
/**
* Fires after the password is set.
*
* @since 6.2.0
*
* @param string $password The plain text password just set.
* @param mixed $user_id The ID of the user whose password was just set.
*/
do_action( 'wp_set_password', $password, $user_id );
} }
endif; endif;

View File

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