WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/11/2020 09:41:26 PM (21 months ago)
Author:
SergeyBiryukov
Message:

Privacy: Introduce filters for the headers of all the privacy-related e-mails:

  • wp_privacy_personal_data_email_headers
  • user_request_confirmed_email_headers
  • user_erasure_complete_email_headers
  • user_request_action_email_headers

Props xkon, garrett-eclipse, zaffarn, desrosj.
Fixes #44501.

File:
1 edited

Legend:

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

    r47277 r47279  
    32953295    $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );
    32963296
    3297     $email_sent = wp_mail( $email_data['admin_email'], $subject, $content );
     3297    $headers = '';
     3298
     3299    /**
     3300     * Filters the headers of the user request confirmation email.
     3301     *
     3302     * @since 5.4.0
     3303     *
     3304     * @param string|array $headers    The email headers.
     3305     * @param string       $subject    The email subject.
     3306     * @param string       $content    The email content.
     3307     * @param int          $request_id The request ID.
     3308     * @param array        $email_data {
     3309     *     Data relating to the account action email.
     3310     *
     3311     *     @type WP_User_Request $request     User request object.
     3312     *     @type string          $user_email  The email address confirming a request
     3313     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     3314     *     @type string          $manage_url  The link to click manage privacy requests of this type.
     3315     *     @type string          $sitename    The site name sending the mail.
     3316     *     @type string          $siteurl     The site URL sending the mail.
     3317     *     @type string          $admin_email The administrator email receiving the mail.
     3318     * }
     3319     */
     3320    $headers = apply_filters( 'user_request_confirmed_email_headers', $headers, $subject, $content, $request_id, $email_data );
     3321
     3322    $email_sent = wp_mail( $email_data['admin_email'], $subject, $content, $headers );
    32983323
    32993324    if ( $email_sent ) {
     
    34413466    $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
    34423467
    3443     $email_sent = wp_mail( $user_email, $subject, $content );
     3468    $headers = '';
     3469
     3470    /**
     3471     * Filters the headers of the data erasure fulfillment notification.
     3472     *
     3473     * @since 5.4.0
     3474     *
     3475     * @param string|array $headers    The email headers.
     3476     * @param string       $subject    The email subject.
     3477     * @param string       $content    The email content.
     3478     * @param int          $request_id The request ID.
     3479     * @param array        $email_data {
     3480     *     Data relating to the account action email.
     3481     *
     3482     *     @type WP_User_Request $request            User request object.
     3483     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     3484     *                                               to the value of `$request->email`, but can be changed
     3485     *                                               by the `user_erasure_fulfillment_email_to` filter.
     3486     *     @type string          $privacy_policy_url Privacy policy URL.
     3487     *     @type string          $sitename           The site name sending the mail.
     3488     *     @type string          $siteurl            The site URL sending the mail.
     3489     * }
     3490     */
     3491    $headers = apply_filters( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data );
     3492
     3493    $email_sent = wp_mail( $user_email, $subject, $content, $headers );
    34443494
    34453495    if ( $switched_locale ) {
     
    37033753    $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
    37043754
    3705     $email_sent = wp_mail( $email_data['email'], $subject, $content );
     3755    $headers = '';
     3756
     3757    /**
     3758     * Filters the headers of the email sent when an account action is attempted.
     3759     *
     3760     * @since 5.4.0
     3761     *
     3762     * @param string|array $headers    The email headers.
     3763     * @param string       $subject    The email subject.
     3764     * @param string       $content    The email content.
     3765     * @param int          $request_id The request ID.
     3766     * @param array        $email_data {
     3767     *     Data relating to the account action email.
     3768     *
     3769     *     @type WP_User_Request $request     User request object.
     3770     *     @type string          $email       The email address this is being sent to.
     3771     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     3772     *     @type string          $confirm_url The link to click on to confirm the account action.
     3773     *     @type string          $sitename    The site name sending the mail.
     3774     *     @type string          $siteurl     The site URL sending the mail.
     3775     * }
     3776     */
     3777    $headers = apply_filters( 'user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data );
     3778
     3779    $email_sent = wp_mail( $email_data['email'], $subject, $content, $headers );
    37063780
    37073781    if ( $switched_locale ) {
Note: See TracChangeset for help on using the changeset viewer.