Users: Use localized site title for password reset emails.

When sending password reset emails, switch to the user's locale prior to obtaining the site title to allow for plugins filtering based on locale.

Follow up to [50129,50139-50141,50152,50415].

Props chouby.
Fixes #52605. See #34281.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2021-02-26 00:52:02 +00:00
parent ba60f353f8
commit 7b26eac3a3
2 changed files with 6 additions and 6 deletions

View File

@ -2749,6 +2749,11 @@ function retrieve_password( $user_login = null ) {
return $key;
}
// Localize password reset message content for user.
$locale = get_user_locale( $user_data );
$switched_locale = switch_to_locale( $locale );
if ( is_multisite() ) {
$site_name = get_network()->site_name;
} else {
@ -2759,11 +2764,6 @@ 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";

View File

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