_wp_privacy_send_erasure_fulfillment_notification() – Notifies the user when their erasure request is fulfilled.

You appear to be a bot. Output may be restricted

Description

Notifies the user when their erasure request is fulfilled.

Without this, the user would never know if their data was actually erased.

Usage

_wp_privacy_send_erasure_fulfillment_notification( $request_id );

Parameters

$request_id
( int ) required – The privacy request post ID associated with this request.

Returns

void

Source

File name: wordpress/wp-includes/user.php


Lines:

1 to 100 of 271
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
  $request = wp_get_user_request( $request_id );

  if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
    return;
  }

  $already_notified = (bool) get_post_meta( $request_id, '_wp_user_notified', true );

  if ( $already_notified ) {
    return;
  }

  // Localize message content for user; fallback to site default for visitors.
  if ( ! empty( $request->user_id ) ) {
    $locale = get_user_locale( $request->user_id );
  } else {
    $locale = get_locale();
  }

  $switched_locale = switch_to_locale( $locale );

  
/**
 * Filters the recipient of the data erasure fulfillment notification.
 *
 * @since 4.9.6
 *
 * @param string          $user_email The email address of the notification recipient.
 * @param WP_User_Request $request    The request that is initiating the notification.
 */
  $user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request );

  $email_data = array(
    'request'            => $request,
    'message_recipient'  => $user_email,
    'privacy_policy_url' => get_privacy_policy_url(),
    'sitename'           => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
    'siteurl'            => home_url(),
  );

  $subject = sprintf(
    /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
    __( '[%s] Erasure Request Fulfilled' ),
    $email_data['sitename']
  );

  
/**
 * Filters the subject of the email sent when an erasure request is completed.
 *
 * @since 4.9.8
 * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead.
 *
 * @param string $subject    The email subject.
 * @param string $sitename   The name of the site.
 * @param array  $email_data {
 *     Data relating to the account action email.
 *
 *     @type WP_User_Request $request            User request object.
 *     @type string          $message_recipient  The address that the email will be sent to. Defaults
 *                                               to the value of `$request->email`, but can be changed
 *                                               by the `user_erasure_fulfillment_email_to` filter.
 *     @type string          $privacy_policy_url Privacy policy URL.
 *     @type string          $sitename           The site name sending the mail.
 *     @type string          $siteurl            The site URL sending the mail.
 * }
 */
  $subject = apply_filters_deprecated(
    'user_erasure_complete_email_subject',
    array( $subject, $email_data['sitename'], $email_data ),
    '5.8.0',
    'user_erasure_fulfillment_email_subject'
  );

  
/**
 * Filters the subject of the email sent when an erasure request is completed.
 *
 * @since 5.8.0
 *
 * @param string $subject    The email subject.
 * @param string $sitename   The name of the site.
 * @param array  $email_data {
 *     Data relating to the account action email.
 *
 *     @type WP_User_Request $request            User request object.
 *     @type string          $message_recipient  The address that the email will be sent to. Defaults
 *                                               to the value of `$request->email`, but can be changed
 *                                               by the `user_erasure_fulfillment_email_to` filter.
 *     @type string          $privacy_policy_url Privacy policy URL.
 *     @type string          $sitename           The site name sending the mail.
 *     @type string          $siteurl            The site URL sending the mail.
 * }
 */
  $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data );

  /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
  $content = __(
    'Howdy,

 View on GitHub View on Trac