Login and Registration: Pass $user_data parameter to the lostpassword_post action in retrieve_password().

Props wpgurudev, pagewidth, lukecavanagh, johnbillion, kkarpieszuk.
Fixes #38334.
Built from https://develop.svn.wordpress.org/trunk@46749


git-svn-id: http://core.svn.wordpress.org/trunk@46549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-11-19 10:01:04 +00:00
parent c0950c1d50
commit a6cecef42f
2 changed files with 6 additions and 3 deletions

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-46748';
$wp_version = '5.4-alpha-46749';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -363,7 +363,8 @@ function wp_login_viewport_meta() {
* @return bool|WP_Error True: when finish. WP_Error on error
*/
function retrieve_password() {
$errors = new WP_Error();
$errors = new WP_Error();
$user_data = false;
if ( empty( $_POST['user_login'] ) || ! is_string( $_POST['user_login'] ) ) {
$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.' ) );
@ -382,11 +383,13 @@ function retrieve_password() {
*
* @since 2.1.0
* @since 4.4.0 Added the `$errors` parameter.
* @since 5.4.0 Added the `$user_data` parameter.
*
* @param WP_Error $errors A WP_Error object containing any errors generated
* by using invalid credentials.
* @param WP_User|false WP_User object if found, false if the user does not exist.
*/
do_action( 'lostpassword_post', $errors );
do_action( 'lostpassword_post', $errors, $user_data );
if ( $errors->has_errors() ) {
return $errors;