From b8370ff5f6173138c5de38f033f90a00de8529ac Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 14 Apr 2022 06:22:37 +0000 Subject: [PATCH] Users: Update parameters passed to the new `send_retrieve_password_email` and `retrieve_password_notification_email` filters. For consistency with some similar filters like `send_password_change_email` or `send_email_change_email`, and for more flexibility, pass `$user_login` and `$user_data` parameters directly to the new `send_retrieve_password_email` and `retrieve_password_notification_email` filters. Follow-up to [52604], [52605], [52606], [52607]. Props SergeyBiryukov, costdev, peterwilsoncc. Fixes #54690. git-svn-id: https://develop.svn.wordpress.org/trunk@53178 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 8d60d06619..4a22e5ca7f 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -3094,9 +3094,11 @@ function retrieve_password( $user_login = null ) { * * @since 6.0.0 * - * @param bool $send Whether to send the email. + * @param bool $send Whether to send the email. + * @param string $user_login The username for the user. + * @param WP_User $user_data WP_User object. */ - if ( ! apply_filters( 'send_retrieve_password_email', true ) ) { + if ( ! apply_filters( 'send_retrieve_password_email', true, $user_login, $user_data ) ) { return true; } @@ -3190,8 +3192,6 @@ function retrieve_password( $user_login = null ) { 'headers' => '', ); - $data = compact( 'key', 'user_login', 'user_data' ); - /** * Filters the contents of the reset password notification email sent to the user. * @@ -3205,15 +3205,11 @@ function retrieve_password( $user_login = null ) { * @type string $message The body of the email. * @type string $headers The headers of the email. * } - * @param array $data { - * Additional information for extenders. - * - * @type string $key The activation key. - * @type string $user_login The username for the user. - * @type WP_User $user_data WP_User object. - * } + * @type string $key The activation key. + * @type string $user_login The username for the user. + * @type WP_User $user_data WP_User object. */ - $notification_email = apply_filters( 'retrieve_password_notification_email', $defaults, $data ); + $notification_email = apply_filters( 'retrieve_password_notification_email', $defaults, $key, $user_login, $user_data ); if ( $switched_locale ) { restore_previous_locale();