From af941d438c99192f7ed5955f7cec7ee19a948490 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 19 Nov 2019 09:59:19 +0000 Subject: [PATCH] Login and Registration: Pass `$user_data` parameter to the `lostpassword_post` action in `retrieve_password()`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Props wpgurudev, pagewidth, lukecavanagh, johnbillion, kkarpieszuk. Fixes #38334. git-svn-id: https://develop.svn.wordpress.org/trunk@46749 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-login.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-login.php b/src/wp-login.php index ace097d9c0..a82bb75734 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -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', __( 'ERROR: 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;