Make WordPress Core


Ignore:
Timestamp:
03/28/2019 09:28:37 PM (6 years ago)
Author:
SergeyBiryukov
Message:

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

Props garrett-eclipse.
Fixes #46056.

File:
1 edited

Legend:

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

    r44966 r45062  
    23542354    }
    23552355
     2356    // Localize message content for user; fallback to site default for visitors.
     2357    if ( ! empty( $request->user_id ) ) {
     2358        $locale = get_user_locale( $request->user_id );
     2359    } else {
     2360        $locale = get_locale();
     2361    }
     2362
     2363    $switched_locale = switch_to_locale( $locale );
     2364
    23562365    /** This filter is documented in wp-includes/functions.php */
    23572366    $expiration      = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
     
    24092418        $content
    24102419    );
     2420
     2421    if ( $switched_locale ) {
     2422        restore_previous_locale();
     2423    }
    24112424
    24122425    if ( ! $mail_success ) {
Note: See TracChangeset for help on using the changeset viewer.