Make WordPress Core

Ticket #46056: 46056.diff

File 46056.diff, 1.1 KB (added by garrett-eclipse, 6 years ago)

Patch to make Erasure fulfillment emails in users locale

  • src/wp-admin/includes/file.php

     
    21972197                return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) );
    21982198        }
    21992199
     2200        // Localize message content for user; fallback to site default for visitors.
     2201        if ( ! empty( $request->user_id ) ) {
     2202                $locale = get_user_locale( $request->user_id );
     2203        } else {
     2204                $locale = get_locale();
     2205        }
     2206
     2207        $switched_locale = switch_to_locale( $locale );
     2208
    22002209        /** This filter is documented in wp-includes/functions.php */
    22012210        $expiration      = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
    22022211        $expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration );
     
    22532262                $content
    22542263        );
    22552264
     2265        if ( $switched_locale ) {
     2266                restore_previous_locale();
     2267        }
     2268
    22562269        if ( ! $mail_success ) {
    22572270                return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export email.' ) );
    22582271        }