Ticket #44314: 44314.6.diff
File 44314.6.diff, 20.0 KB (added by , 4 years ago) |
---|
-
src/wp-admin/includes/privacy-tools.php
628 628 629 629 /* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */ 630 630 $email_text = __( 631 631 'Howdy, 632 632 633 633 Your request for an export of personal data has been completed. You may 634 634 download your personal data by clicking on the link below. For privacy -
src/wp-includes/user.php
3436 3436 'admin_email' => $admin_email, 3437 3437 ); 3438 3438 3439 $subject = sprintf( 3440 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */ 3441 __( '[%1$s] Action Confirmed: %2$s' ), 3442 $email_data['sitename'], 3443 $action_description 3444 ); 3445 3446 /** 3447 * Filters the subject of the user request confirmation email. 3448 * 3449 * @since 4.9.8 3450 * 3451 * @param string $subject The email subject. 3452 * @param string $sitename The name of the site. 3453 * @param array $email_data { 3454 * Data relating to the account action email. 3455 * 3456 * @type WP_User_Request $request User request object. 3457 * @type string $user_email The email address confirming a request 3458 * @type string $description Description of the action being performed so the user knows what the email is for. 3459 * @type string $manage_url The link to click manage privacy requests of this type. 3460 * @type string $sitename The site name sending the mail. 3461 * @type string $siteurl The site URL sending the mail. 3462 * @type string $admin_email The administrator email receiving the mail. 3463 * } 3464 */ 3465 $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); 3466 3439 3467 /* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */ 3440 $ email_text = __(3441 3468 $content = __( 3469 'Howdy, 3442 3470 3443 3471 A user data privacy request has been confirmed on ###SITENAME###: 3444 3472 … … 3457 3485 /** 3458 3486 * Filters the body of the user request confirmation email. 3459 3487 * 3488 * Use the {@see 'user_request_confirmed_email_content'} filter instead. 3489 * 3460 3490 * The email is sent to an administrator when an user request is confirmed. 3491 * 3461 3492 * The following strings have a special meaning and will get replaced dynamically: 3462 3493 * 3463 3494 * ###SITENAME### The name of the site. … … 3466 3497 * ###MANAGE_URL### The URL to manage requests. 3467 3498 * ###SITEURL### The URL to the site. 3468 3499 * 3500 * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3501 * 3469 3502 * @since 4.9.6 3470 3503 * 3471 * @param string $email_text Text in the email. 3504 * @deprecated 5.7.0 Use {@see 'user_request_confirmed_email_content'} filter instead. 3505 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3506 * 3507 * @param string $content The email content. 3472 3508 * @param array $email_data { 3473 3509 * Data relating to the account action email. 3474 3510 * … … 3481 3517 * @type string $admin_email The administrator email receiving the mail. 3482 3518 * } 3483 3519 */ 3484 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3520 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.6.0', 'user_request_confirmed_email_content' ); 3485 3521 3486 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );3487 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );3488 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );3489 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );3490 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );3491 3492 $subject = sprintf(3493 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */3494 __( '[%1$s] Action Confirmed: %2$s' ),3495 $email_data['sitename'],3496 $action_description3497 );3498 3499 3522 /** 3500 * Filters the subjectof the user request confirmation email.3523 * Filters the body of the user request confirmation email. 3501 3524 * 3502 * @since 4.9.8 3525 * The email is sent to an administrator when an user request is confirmed. 3526 * The following strings have a special meaning and will get replaced dynamically: 3503 3527 * 3504 * @param string $subject The email subject. 3505 * @param string $sitename The name of the site. 3528 * ###SITENAME### The name of the site. 3529 * ###USER_EMAIL### The user email for the request. 3530 * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for. 3531 * ###MANAGE_URL### The URL to manage requests. 3532 * ###SITEURL### The URL to the site. 3533 * 3534 * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3535 * 3536 * @since 5.7.0 3537 * 3538 * @param string $content The email content. 3506 3539 * @param array $email_data { 3507 3540 * Data relating to the account action email. 3508 3541 * … … 3515 3548 * @type string $admin_email The administrator email receiving the mail. 3516 3549 * } 3517 3550 */ 3518 $ subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );3551 $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data ); 3519 3552 3553 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3554 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content ); 3555 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 3556 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content ); 3557 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 3558 3520 3559 $headers = ''; 3521 3560 3522 3561 /** … … 3607 3646 /** 3608 3647 * Filters the subject of the email sent when an erasure request is completed. 3609 3648 * 3649 * Use the {@see 'user_erasure_fulfillment_email_subject'} filter instead. 3650 * 3610 3651 * @since 4.9.8 3611 3652 * 3653 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_subject'} filter instead. 3654 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3655 * 3612 3656 * @param string $subject The email subject. 3613 3657 * @param string $sitename The name of the site. 3614 3658 * @param array $email_data { … … 3623 3667 * @type string $siteurl The site URL sending the mail. 3624 3668 * } 3625 3669 */ 3626 $subject = apply_filters ( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);3670 $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.6.0', 'user_erasure_fulfillment_email_subject' ); 3627 3671 3628 if ( empty( $email_data['privacy_policy_url'] ) ) { 3629 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3630 $email_text = __( 3631 'Howdy, 3672 /** 3673 * Filters the subject of the email sent when an erasure request is completed. 3674 * 3675 * @since 5.6.0 3676 * 3677 * @param string $subject The email subject. 3678 * @param string $sitename The name of the site. 3679 * @param array $email_data { 3680 * Data relating to the account action email. 3681 * 3682 * @type WP_User_Request $request User request object. 3683 * @type string $message_recipient The address that the email will be sent to. Defaults 3684 * to the value of `$request->email`, but can be changed 3685 * by the `user_erasure_fulfillment_email_to` filter. 3686 * @type string $privacy_policy_url Privacy policy URL. 3687 * @type string $sitename The site name sending the mail. 3688 * @type string $siteurl The site URL sending the mail. 3689 * } 3690 */ 3691 $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data ); 3632 3692 3693 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3694 $content = __( 3695 'Howdy, 3696 3633 3697 Your request to erase your personal data on ###SITENAME### has been completed. 3634 3698 3635 3699 If you have any follow-up questions or concerns, please contact the site administrator. … … 3637 3701 Regards, 3638 3702 All at ###SITENAME### 3639 3703 ###SITEURL###' 3640 ); 3641 } else { 3704 ); 3705 3706 if ( ! empty( $email_data['privacy_policy_url'] ) ) { 3642 3707 /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */ 3643 $ email_text = __(3644 3708 $content = __( 3709 'Howdy, 3645 3710 3646 3711 Your request to erase your personal data on ###SITENAME### has been completed. 3647 3712 … … 3658 3723 /** 3659 3724 * Filters the body of the data erasure fulfillment notification. 3660 3725 * 3726 * Use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3727 * 3661 3728 * The email is sent to a user when a their data erasure request is fulfilled 3662 3729 * by an administrator. 3663 3730 * … … 3669 3736 * 3670 3737 * @since 4.9.6 3671 3738 * 3672 * @param string $email_text Text in the email. 3739 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_content'} filter instead. 3740 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3741 * 3742 * @param string $content The email content. 3673 3743 * @param array $email_data { 3674 3744 * Data relating to the account action email. 3675 3745 * … … 3682 3752 * @type string $siteurl The site URL sending the mail. 3683 3753 * } 3684 3754 */ 3685 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3755 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.6.0', 'user_erasure_fulfillment_email_content' ); 3686 3756 3757 /** 3758 * Filters the body of the data erasure fulfillment notification. 3759 * 3760 * The email is sent to a user when a their data erasure request is fulfilled 3761 * by an administrator. 3762 * 3763 * The following strings have a special meaning and will get replaced dynamically: 3764 * 3765 * ###SITENAME### The name of the site. 3766 * ###PRIVACY_POLICY_URL### Privacy policy page URL. 3767 * ###SITEURL### The URL to the site. 3768 * 3769 * @since 5.7.0 3770 * 3771 * @param string $content The email content. 3772 * @param array $email_data { 3773 * Data relating to the account action email. 3774 * 3775 * @type WP_User_Request $request User request object. 3776 * @type string $message_recipient The address that the email will be sent to. Defaults 3777 * to the value of `$request->email`, but can be changed 3778 * by the `user_erasure_fulfillment_email_to` filter. 3779 * @type string $privacy_policy_url Privacy policy URL. 3780 * @type string $sitename The site name sending the mail. 3781 * @type string $siteurl The site URL sending the mail. 3782 * } 3783 */ 3784 $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data ); 3785 3687 3786 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3688 3787 $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content ); 3689 3788 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); … … 3693 3792 /** 3694 3793 * Filters the headers of the data erasure fulfillment notification. 3695 3794 * 3795 * Use the {@see 'user_erasure_fulfillment_email_headers'} filter instead. 3796 * 3696 3797 * @since 5.4.0 3697 3798 * 3799 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_headers'} filter instead. 3800 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3801 * 3698 3802 * @param string|array $headers The email headers. 3699 3803 * @param string $subject The email subject. 3700 3804 * @param string $content The email content. … … 3711 3815 * @type string $siteurl The site URL sending the mail. 3712 3816 * } 3713 3817 */ 3714 $headers = apply_filters ( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data);3818 $headers = apply_filters_deprecated( 'user_erasure_complete_email_headers', array( $headers, $subject, $content, $request_id, $email_data ), '5.6.0', 'user_erasure_fulfillment_email_headers' ); 3715 3819 3820 /** 3821 * Filters the headers of the data erasure fulfillment notification. 3822 * 3823 * @since 5.7.0 3824 * 3825 * @param string|array $headers The email headers. 3826 * @param string $subject The email subject. 3827 * @param string $content The email content. 3828 * @param int $request_id The request ID. 3829 * @param array $email_data { 3830 * Data relating to the account action email. 3831 * 3832 * @type WP_User_Request $request User request object. 3833 * @type string $message_recipient The address that the email will be sent to. Defaults 3834 * to the value of `$request->email`, but can be changed 3835 * by the `user_erasure_fulfillment_email_to` filter. 3836 * @type string $privacy_policy_url Privacy policy URL. 3837 * @type string $sitename The site name sending the mail. 3838 * @type string $siteurl The site URL sending the mail. 3839 * } 3840 */ 3841 $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data ); 3842 3716 3843 $email_sent = wp_mail( $user_email, $subject, $content, $headers ); 3717 3844 3718 3845 if ( $switched_locale ) { … … 3901 4028 'siteurl' => home_url(), 3902 4029 ); 3903 4030 4031 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */ 4032 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); 4033 4034 /** 4035 * Filters the subject of the email sent when an account action is attempted. 4036 * 4037 * @since 4.9.6 4038 * 4039 * @param string $subject The email subject. 4040 * @param string $sitename The name of the site. 4041 * @param array $email_data { 4042 * Data relating to the account action email. 4043 * 4044 * @type WP_User_Request $request User request object. 4045 * @type string $email The email address this is being sent to. 4046 * @type string $description Description of the action being performed so the user knows what the email is for. 4047 * @type string $confirm_url The link to click on to confirm the account action. 4048 * @type string $sitename The site name sending the mail. 4049 * @type string $siteurl The site URL sending the mail. 4050 * } 4051 */ 4052 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); 4053 3904 4054 /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */ 3905 $ email_text = __(3906 4055 $content = __( 4056 'Howdy, 3907 4057 3908 4058 A request has been made to perform the following action on your account: 3909 4059 … … 3932 4082 * 3933 4083 * @since 4.9.6 3934 4084 * 3935 * @param string $ email_text Text in the email.4085 * @param string $content Text in the email. 3936 4086 * @param array $email_data { 3937 4087 * Data relating to the account action email. 3938 4088 * … … 3944 4094 * @type string $siteurl The site URL sending the mail. 3945 4095 * } 3946 4096 */ 3947 $content = apply_filters( 'user_request_action_email_content', $ email_text, $email_data );4097 $content = apply_filters( 'user_request_action_email_content', $content, $email_data ); 3948 4098 3949 4099 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 3950 4100 $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); … … 3952 4102 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3953 4103 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 3954 4104 3955 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */3956 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );3957 3958 /**3959 * Filters the subject of the email sent when an account action is attempted.3960 *3961 * @since 4.9.63962 *3963 * @param string $subject The email subject.3964 * @param string $sitename The name of the site.3965 * @param array $email_data {3966 * Data relating to the account action email.3967 *3968 * @type WP_User_Request $request User request object.3969 * @type string $email The email address this is being sent to.3970 * @type string $description Description of the action being performed so the user knows what the email is for.3971 * @type string $confirm_url The link to click on to confirm the account action.3972 * @type string $sitename The site name sending the mail.3973 * @type string $siteurl The site URL sending the mail.3974 * }3975 */3976 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );3977 3978 4105 $headers = ''; 3979 4106 3980 4107 /** -
tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php
210 210 * @ticket 44234 211 211 */ 212 212 public function test_email_subject_should_be_filterable() { 213 add_filter( 'user_erasure_ complete_email_subject', array( $this, 'filter_email_subject' ) );213 add_filter( 'user_erasure_fulfillment_email_subject', array( $this, 'filter_email_subject' ) ); 214 214 _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); 215 215 216 216 $mailer = tests_retrieve_phpmailer_instance(); … … 236 236 * @ticket 44234 237 237 */ 238 238 public function test_email_body_text_should_be_filterable() { 239 add_filter( 'user_ confirmed_action_email_content', array( $this, 'filter_email_body_text' ) );239 add_filter( 'user_erasure_fulfillment_email_content', array( $this, 'filter_email_body_text' ) ); 240 240 _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); 241 241 242 242 $mailer = tests_retrieve_phpmailer_instance(); … … 264 264 * @ticket 44501 265 265 */ 266 266 public function test_email_headers_should_be_filterable() { 267 add_filter( 'user_erasure_ complete_email_headers', array( $this, 'modify_email_headers' ) );267 add_filter( 'user_erasure_fulfillment_email_headers', array( $this, 'modify_email_headers' ) ); 268 268 _wp_privacy_send_erasure_fulfillment_notification( self::$request_id ); 269 269 270 270 $mailer = tests_retrieve_phpmailer_instance(); -
tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php
176 176 177 177 _wp_privacy_account_request_confirmed( $request_id ); 178 178 179 add_filter( 'user_ confirmed_action_email_content', array( $this, 'modify_email_content' ), 10, 2 );179 add_filter( 'user_request_confirmed_email_content', array( $this, 'modify_email_content' ), 10, 2 ); 180 180 _wp_privacy_send_request_confirmation_notification( $request_id ); 181 remove_filter( 'user_ confirmed_action_email_content', array( $this, 'modify_email_content' ), 10 );181 remove_filter( 'user_request_confirmed_email_content', array( $this, 'modify_email_content' ), 10 ); 182 182 183 183 $mailer = tests_retrieve_phpmailer_instance(); 184 184 $this->assertContains( 'Custom content containing email address:' . $email, $mailer->get_sent()->body );