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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-04-14 06:24:10 +00:00
parent ecce0c2f57
commit 050a2947cf
2 changed files with 9 additions and 13 deletions

View File

@ -3094,9 +3094,11 @@ function retrieve_password( $user_login = null ) {
* *
* @since 6.0.0 * @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; return true;
} }
@ -3190,8 +3192,6 @@ function retrieve_password( $user_login = null ) {
'headers' => '', 'headers' => '',
); );
$data = compact( 'key', 'user_login', 'user_data' );
/** /**
* Filters the contents of the reset password notification email sent to the user. * 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 $message The body of the email.
* @type string $headers The headers of the email. * @type string $headers The headers of the email.
* } * }
* @param array $data { * @type string $key The activation key.
* Additional information for extenders. * @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 ) { if ( $switched_locale ) {
restore_previous_locale(); restore_previous_locale();

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-beta1-53177'; $wp_version = '6.0-beta1-53178';
/** /**
* 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.