Privacy: Improve naming of user confimed action email filters.

The filters `user_confirmed_action_email_content`, `user_erasure_complete_email_subject`, and `user_erasure_complete_email_headers` have been deprecated.

They have been replaced with `user_erasure_fulfillment_email_content`, `user_erasure_fulfillment_email_subject`, and `user_erasure_fulfillment_email_headers`.

Props desrosj, garrett-eclipse, birgire, DrewAPicture, lifeforceinst, ocean90, pbiron, pento, coffee2code, TZ-Media, SergeyBiryukov, johnbillion, audrasjb, davidbaumwald, hellofromTonya, helen, xkon, antpb, peterwilsoncc, lukecarbis.
Fixes #44314.


Built from https://develop.svn.wordpress.org/trunk@51129


git-svn-id: http://core.svn.wordpress.org/trunk@50738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2021-06-09 01:35:58 +00:00
parent af81b98b92
commit 06cddbd3b3
3 changed files with 242 additions and 94 deletions

View File

@ -662,7 +662,8 @@ function wp_privacy_send_personal_data_export_email( $request_id ) {
/* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Howdy,
// phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect, PEAR.Functions.FunctionCallSignature.Indent
'Howdy,
Your request for an export of personal data has been completed. You may
download your personal data by clicking on the link below. For privacy

View File

@ -3646,59 +3646,6 @@ function _wp_privacy_send_request_confirmation_notification( $request_id ) {
'admin_email' => $admin_email,
);
/* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */
$email_text = __(
'Howdy,
A user data privacy request has been confirmed on ###SITENAME###:
User: ###USER_EMAIL###
Request: ###DESCRIPTION###
You can view and manage these data privacy requests here:
###MANAGE_URL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
/**
* Filters the body of the user request confirmation email.
*
* The email is sent to an administrator when an user request is confirmed.
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###USER_EMAIL### The user email for the request.
* ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
* ###MANAGE_URL### The URL to manage requests.
* ###SITEURL### The URL to the site.
*
* @since 4.9.6
*
* @param string $email_text Text in the email.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
$content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
$content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );
$content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
$subject = sprintf(
/* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */
__( '[%1$s] Action Confirmed: %2$s' ),
@ -3727,6 +3674,106 @@ All at ###SITENAME###
*/
$subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );
/* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */
$content = __(
// phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect, PEAR.Functions.FunctionCallSignature.Indent
'Howdy,
A user data privacy request has been confirmed on ###SITENAME###:
User: ###USER_EMAIL###
Request: ###DESCRIPTION###
You can view and manage these data privacy requests here:
###MANAGE_URL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
/**
* Filters the body of the user request confirmation email.
*
* Use {@see 'user_request_confirmed_email_content'} instead.
*
* The email is sent to an administrator when an user request is confirmed.
*
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###USER_EMAIL### The user email for the request.
* ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
* ###MANAGE_URL### The URL to manage requests.
* ###SITEURL### The URL to the site.
*
* For fulfillment email content use {@see 'user_erasure_fulfillment_email_content'} instead.
*
* @since 4.9.6
*
* @deprecated 5.8.0 Use {@see 'user_request_confirmed_email_content'} instead. For fulfillment email content use {@see 'user_erasure_fulfillment_email_content'} instead.
*
* @param string $content The email content.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$content = apply_filters_deprecated(
'user_confirmed_action_email_content',
array( $content, $email_data ),
'5.8.0',
sprintf(
/* translators: 1 & 2: Deprecation replacement options */
__( '%1$s or %2$s' ),
'user_request_confirmed_email_content',
'user_erasure_fulfillment_email_content'
)
);
/**
* Filters the body of the user request confirmation email.
*
* The email is sent to an administrator when an user request is confirmed.
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###USER_EMAIL### The user email for the request.
* ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
* ###MANAGE_URL### The URL to manage requests.
* ###SITEURL### The URL to the site.
*
* @since 5.8.0
*
* @param string $content The email content.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data );
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
$content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
$content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );
$content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
$headers = '';
/**
@ -3817,8 +3864,12 @@ function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
/**
* Filters the subject of the email sent when an erasure request is completed.
*
* Use {@see 'user_erasure_fulfillment_email_subject'} instead.
*
* @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 {
@ -3833,12 +3884,33 @@ function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data );
$subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.8.0', 'user_erasure_fulfillment_email_subject' );
if ( empty( $email_data['privacy_policy_url'] ) ) {
/* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
$email_text = __(
'Howdy,
/**
* 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 = __(
// phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect, PEAR.Functions.FunctionCallSignature.Indent
'Howdy,
Your request to erase your personal data on ###SITENAME### has been completed.
@ -3847,11 +3919,13 @@ If you have any follow-up questions or concerns, please contact the site adminis
Regards,
All at ###SITENAME###
###SITEURL###'
);
} else {
);
if ( ! empty( $email_data['privacy_policy_url'] ) ) {
/* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
$email_text = __(
'Howdy,
$content = __(
// phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect, PEAR.Functions.FunctionCallSignature.Indent
'Howdy,
Your request to erase your personal data on ###SITENAME### has been completed.
@ -3868,6 +3942,8 @@ All at ###SITENAME###
/**
* Filters the body of the data erasure fulfillment notification.
*
* Use {@see 'user_erasure_fulfillment_email_content'} instead.
*
* The email is sent to a user when a their data erasure request is fulfilled
* by an administrator.
*
@ -3877,9 +3953,13 @@ All at ###SITENAME###
* ###PRIVACY_POLICY_URL### Privacy policy page URL.
* ###SITEURL### The URL to the site.
*
* For user request confirmation email content use {@see 'user_request_confirmed_email_content'} instead.
*
* @since 4.9.6
*
* @param string $email_text Text in the email.
* @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_content'} instead. For user request confirmation email content use {@see 'user_request_confirmed_email_content'} instead.
*
* @param string $content The email content.
* @param array $email_data {
* Data relating to the account action email.
*
@ -3892,7 +3972,46 @@ All at ###SITENAME###
* @type string $siteurl The site URL sending the mail.
* }
*/
$content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
$content = apply_filters_deprecated(
'user_confirmed_action_email_content',
array( $content, $email_data ),
'5.8.0',
sprintf(
/* translators: 1 & 2: Deprecation replacement options */
__( '%1$s or %2$s' ),
'user_erasure_fulfillment_email_content',
'user_request_confirmed_email_content'
)
);
/**
* Filters the body of the data erasure fulfillment notification.
*
* The email is sent to a user when a their data erasure request is fulfilled
* by an administrator.
*
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###PRIVACY_POLICY_URL### Privacy policy page URL.
* ###SITEURL### The URL to the site.
*
* @since 5.8.0
*
* @param string $content The email content.
* @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.
* }
*/
$content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data );
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content );
@ -3903,8 +4022,12 @@ All at ###SITENAME###
/**
* Filters the headers of the data erasure fulfillment notification.
*
* Use {@see 'user_erasure_fulfillment_email_headers'} instead.
*
* @since 5.4.0
*
* @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead.
*
* @param string|array $headers The email headers.
* @param string $subject The email subject.
* @param string $content The email content.
@ -3921,7 +4044,30 @@ All at ###SITENAME###
* @type string $siteurl The site URL sending the mail.
* }
*/
$headers = apply_filters( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data );
$headers = apply_filters_deprecated( 'user_erasure_complete_email_headers', array( $headers, $subject, $content, $request_id, $email_data ), '5.8.0', 'user_erasure_fulfillment_email_headers' );
/**
* Filters the headers of the data erasure fulfillment notification.
*
* @since 5.7.0
*
* @param string|array $headers The email headers.
* @param string $subject The email subject.
* @param string $content The email content.
* @param int $request_id The request ID.
* @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.
* }
*/
$headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data );
$email_sent = wp_mail( $user_email, $subject, $content, $headers );
@ -4119,9 +4265,33 @@ function wp_send_user_request( $request_id ) {
'siteurl' => home_url(),
);
/* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
$subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );
/**
* Filters the subject of the email sent when an account action is attempted.
*
* @since 4.9.6
*
* @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 $email The email address this is being sent to.
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $confirm_url The link to click on to confirm the account action.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
/* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Howdy,
$content = __(
// phpcs:ignore Generic.WhiteSpace.ScopeIndent.Incorrect, PEAR.Functions.FunctionCallSignature.Indent
'Howdy,
A request has been made to perform the following action on your account:
@ -4150,7 +4320,7 @@ All at ###SITENAME###
*
* @since 4.9.6
*
* @param string $email_text Text in the email.
* @param string $content Text in the email.
* @param array $email_data {
* Data relating to the account action email.
*
@ -4162,7 +4332,7 @@ All at ###SITENAME###
* @type string $siteurl The site URL sending the mail.
* }
*/
$content = apply_filters( 'user_request_action_email_content', $email_text, $email_data );
$content = apply_filters( 'user_request_action_email_content', $content, $email_data );
$content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
$content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content );
@ -4170,29 +4340,6 @@ All at ###SITENAME###
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
/* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
$subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );
/**
* Filters the subject of the email sent when an account action is attempted.
*
* @since 4.9.6
*
* @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 $email The email address this is being sent to.
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $confirm_url The link to click on to confirm the account action.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
$headers = '';
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-51128';
$wp_version = '5.8-alpha-51129';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.