WordPress.org

Make WordPress Core

Ticket #43985: 43985.4.2.diff

File 43985.4.2.diff, 1.7 KB (added by lbenicio, 19 months ago)

add unit tests to 43985.4

  • src/wp-includes/user.php

    diff --git src/wp-includes/user.php src/wp-includes/user.php
    index 1bf62632ad..c00d9b409c 100644
    function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) { 
    30883088                return;
    30893089        }
    30903090
     3091        // Localize message content for user; fallback to site default for visitors.
     3092        $switched_locales = switch_to_locale( get_user_locale( $request_data->user_id ) );
     3093
    30913094        $subject = sprintf(
    30923095                /* translators: %s Site name. */
    30933096                __( '[%s] Erasure Request Fulfilled' ),
    All at ###SITENAME### 
    31803183        if ( $email_sent ) {
    31813184                update_post_meta( $request_id, '_wp_user_notified', true );
    31823185        }
     3186
     3187        if ( $switched_locales ) {
     3188                restore_current_locale();
     3189        }
    31833190}
    31843191
    31853192/**
    function wp_send_user_request( $request_id ) { 
    33263333                return new WP_Error( 'user_request_error', __( 'Invalid request.' ) );
    33273334        }
    33283335
     3336        // Localize message content for user; fallback to site default for visitors.
     3337        $switched_locales = switch_to_locale( get_user_locale( $request->user_id ) );
     3338
    33293339        $email_data = array(
    33303340                'email'       => $request->email,
    33313341                'description' => wp_user_request_action_description( $request->action_name ),
    All at ###SITENAME### 
    34173427         */
    34183428        $subject = apply_filters( 'user_request_action_email_subject', $subject, $blogname, $email_data );
    34193429
    3420         return wp_mail( $email_data['email'], $subject, $content );
     3430        $email_sent = wp_mail( $email_data['email'], $subject, $content );
     3431   $receiver = get_user_by('email', $email_data['email']);
     3432        assertSame(get_user_locale( receiver.id ), get_locale())
     3433        if ( $switched_locales ) {
     3434                restore_current_locale();
     3435        }
     3436
     3437        return $email_sent;
    34213438}
    34223439
    34233440/**