Users: Ensure reset password emails are in the receiving user’s locale.
This ensures that reset password emails initiated by an administrator are sent to the user in their preferred locale. Follow up to [50129,50139-50141,50152]. Props chouby, davidbaumwald, audrasjb, johnbillion. Fixes #52605. See #34281. Built from https://develop.svn.wordpress.org/trunk@50415 git-svn-id: http://core.svn.wordpress.org/trunk@50026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2d34a1928e
commit
89f2e512f5
|
@ -2759,6 +2759,11 @@ function retrieve_password( $user_login = null ) {
|
|||
$site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
||||
}
|
||||
|
||||
// Localize password reset message content for user.
|
||||
$locale = get_user_locale( $user_data );
|
||||
|
||||
$switched_locale = switch_to_locale( $locale );
|
||||
|
||||
$message = __( 'Someone has requested a password reset for the following account:' ) . "\r\n\r\n";
|
||||
/* translators: %s: Site name. */
|
||||
$message .= sprintf( __( 'Site Name: %s' ), $site_name ) . "\r\n\r\n";
|
||||
|
@ -2807,6 +2812,10 @@ function retrieve_password( $user_login = null ) {
|
|||
*/
|
||||
$message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
|
||||
|
||||
if ( $switched_locale ) {
|
||||
restore_previous_locale();
|
||||
}
|
||||
|
||||
if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) {
|
||||
$errors->add(
|
||||
'retrieve_password_email_failure',
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.7-beta3-50414';
|
||||
$wp_version = '5.7-beta3-50415';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue