Make WordPress Core


Ignore:
Timestamp:
03/27/2019 07:41:01 PM (6 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r44930 r45039  
    31413141    }
    31423142
     3143    // Localize message content for user; fallback to site default for visitors.
     3144    if ( ! empty( $request->user_id ) ) {
     3145        $locale = get_user_locale( $request->user_id );
     3146    } else {
     3147        $locale = get_locale();
     3148    }
     3149
     3150    $switched_locale = switch_to_locale( $locale );
     3151
    31433152    /**
    31443153     * Filters the recipient of the data erasure fulfillment notification.
     
    32503259
    32513260    $email_sent = wp_mail( $user_email, $subject, $content );
     3261
     3262    if ( $switched_locale ) {
     3263        restore_previous_locale();
     3264    }
    32523265
    32533266    if ( $email_sent ) {
Note: See TracChangeset for help on using the changeset viewer.