Privacy: Ensure the privacy data erase fulfillment email is sent in the locale of the user whose data is being erased (or the site's default locale if they are not a registered user) when the administrator fulfilling the request uses a different locale.

Props desrosj, birgire, garrett-eclipse.
Fixes #44721.
Built from https://develop.svn.wordpress.org/trunk@45039


git-svn-id: http://core.svn.wordpress.org/trunk@44848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-03-27 19:41:53 +00:00
parent 7bedcf0bee
commit b6a145ccb5
2 changed files with 14 additions and 1 deletions

View File

@ -3140,6 +3140,15 @@ function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
return;
}
// Localize message content for user; fallback to site default for visitors.
if ( ! empty( $request->user_id ) ) {
$locale = get_user_locale( $request->user_id );
} else {
$locale = get_locale();
}
$switched_locale = switch_to_locale( $locale );
/**
* Filters the recipient of the data erasure fulfillment notification.
*
@ -3250,6 +3259,10 @@ All at ###SITENAME###
$email_sent = wp_mail( $user_email, $subject, $content );
if ( $switched_locale ) {
restore_previous_locale();
}
if ( $email_sent ) {
update_post_meta( $request_id, '_wp_user_notified', true );
}

View File

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