Ticket #44314: 44314.cc.diff
File 44314.cc.diff, 19.6 KB (added by , 4 years ago) |
---|
-
src/wp-admin/includes/privacy-tools.php
640 640 641 641 /* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */ 642 642 $email_text = __( 643 643 'Howdy, 644 644 645 645 Your request for an export of personal data has been completed. You may 646 646 download your personal data by clicking on the link below. For privacy -
src/wp-includes/user.php
3603 3603 'admin_email' => $admin_email, 3604 3604 ); 3605 3605 3606 $subject = sprintf( 3607 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */ 3608 __( '[%1$s] Action Confirmed: %2$s' ), 3609 $email_data['sitename'], 3610 $action_description 3611 ); 3612 3613 /** 3614 * Filters the subject of the user request confirmation email. 3615 * 3616 * @since 4.9.8 3617 * 3618 * @param string $subject The email subject. 3619 * @param string $sitename The name of the site. 3620 * @param array $email_data { 3621 * Data relating to the account action email. 3622 * 3623 * @type WP_User_Request $request User request object. 3624 * @type string $user_email The email address confirming a request 3625 * @type string $description Description of the action being performed so the user knows what the email is for. 3626 * @type string $manage_url The link to click manage privacy requests of this type. 3627 * @type string $sitename The site name sending the mail. 3628 * @type string $siteurl The site URL sending the mail. 3629 * @type string $admin_email The administrator email receiving the mail. 3630 * } 3631 */ 3632 $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); 3633 3606 3634 /* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */ 3607 $ email_text = __(3608 3635 $content = __( 3636 'Howdy, 3609 3637 3610 3638 A user data privacy request has been confirmed on ###SITENAME###: 3611 3639 … … 3624 3652 /** 3625 3653 * Filters the body of the user request confirmation email. 3626 3654 * 3655 * Use the {@see 'user_request_confirmed_email_content'} filter instead. 3656 * 3627 3657 * The email is sent to an administrator when an user request is confirmed. 3658 * 3628 3659 * The following strings have a special meaning and will get replaced dynamically: 3629 3660 * 3630 3661 * ###SITENAME### The name of the site. … … 3633 3664 * ###MANAGE_URL### The URL to manage requests. 3634 3665 * ###SITEURL### The URL to the site. 3635 3666 * 3667 * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3668 * 3636 3669 * @since 4.9.6 3637 3670 * 3638 * @param string $email_text Text in the email. 3671 * @deprecated 5.7.0 Use {@see 'user_request_confirmed_email_content'} filter instead. 3672 * 3673 * @param string $content The email content. 3639 3674 * @param array $email_data { 3640 3675 * Data relating to the account action email. 3641 3676 * … … 3648 3683 * @type string $admin_email The administrator email receiving the mail. 3649 3684 * } 3650 3685 */ 3651 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3686 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.7.0', 'user_request_confirmed_email_content' ); 3652 3687 3653 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );3654 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );3655 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );3656 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );3657 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );3658 3659 $subject = sprintf(3660 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */3661 __( '[%1$s] Action Confirmed: %2$s' ),3662 $email_data['sitename'],3663 $action_description3664 );3665 3666 3688 /** 3667 * Filters the subjectof the user request confirmation email.3689 * Filters the body of the user request confirmation email. 3668 3690 * 3669 * @since 4.9.8 3691 * The email is sent to an administrator when an user request is confirmed. 3692 * The following strings have a special meaning and will get replaced dynamically: 3670 3693 * 3671 * @param string $subject The email subject. 3672 * @param string $sitename The name of the site. 3694 * ###SITENAME### The name of the site. 3695 * ###USER_EMAIL### The user email for the request. 3696 * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for. 3697 * ###MANAGE_URL### The URL to manage requests. 3698 * ###SITEURL### The URL to the site. 3699 * 3700 * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3701 * 3702 * @since 5.7.0 3703 * 3704 * @param string $content The email content. 3673 3705 * @param array $email_data { 3674 3706 * Data relating to the account action email. 3675 3707 * … … 3682 3714 * @type string $admin_email The administrator email receiving the mail. 3683 3715 * } 3684 3716 */ 3685 $ subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );3717 $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data ); 3686 3718 3719 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3720 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content ); 3721 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 3722 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content ); 3723 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 3724 3687 3725 $headers = ''; 3688 3726 3689 3727 /** … … 3774 3812 /** 3775 3813 * Filters the subject of the email sent when an erasure request is completed. 3776 3814 * 3815 * Use the {@see 'user_erasure_fulfillment_email_subject'} filter instead. 3816 * 3777 3817 * @since 4.9.8 3778 3818 * 3819 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_subject'} filter instead. 3820 * 3779 3821 * @param string $subject The email subject. 3780 3822 * @param string $sitename The name of the site. 3781 3823 * @param array $email_data { … … 3790 3832 * @type string $siteurl The site URL sending the mail. 3791 3833 * } 3792 3834 */ 3793 $subject = apply_filters ( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);3835 $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.7.0', 'user_erasure_fulfillment_email_subject' ); 3794 3836 3795 if ( empty( $email_data['privacy_policy_url'] ) ) { 3796 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3797 $email_text = __( 3798 'Howdy, 3837 /** 3838 * Filters the subject of the email sent when an erasure request is completed. 3839 * 3840 * @since 5.7.0 3841 * 3842 * @param string $subject The email subject. 3843 * @param string $sitename The name of the site. 3844 * @param array $email_data { 3845 * Data relating to the account action email. 3846 * 3847 * @type WP_User_Request $request User request object. 3848 * @type string $message_recipient The address that the email will be sent to. Defaults 3849 * to the value of `$request->email`, but can be changed 3850 * by the `user_erasure_fulfillment_email_to` filter. 3851 * @type string $privacy_policy_url Privacy policy URL. 3852 * @type string $sitename The site name sending the mail. 3853 * @type string $siteurl The site URL sending the mail. 3854 * } 3855 */ 3856 $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data ); 3799 3857 3858 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3859 $content = __( 3860 'Howdy, 3861 3800 3862 Your request to erase your personal data on ###SITENAME### has been completed. 3801 3863 3802 3864 If you have any follow-up questions or concerns, please contact the site administrator. … … 3804 3866 Regards, 3805 3867 All at ###SITENAME### 3806 3868 ###SITEURL###' 3807 ); 3808 } else { 3869 ); 3870 3871 if ( ! empty( $email_data['privacy_policy_url'] ) ) { 3809 3872 /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */ 3810 $ email_text = __(3811 3873 $content = __( 3874 'Howdy, 3812 3875 3813 3876 Your request to erase your personal data on ###SITENAME### has been completed. 3814 3877 … … 3825 3888 /** 3826 3889 * Filters the body of the data erasure fulfillment notification. 3827 3890 * 3891 * Use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3892 * 3828 3893 * The email is sent to a user when a their data erasure request is fulfilled 3829 3894 * by an administrator. 3830 3895 * … … 3836 3901 * 3837 3902 * @since 4.9.6 3838 3903 * 3839 * @param string $email_text Text in the email. 3904 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_content'} filter instead. 3905 * 3906 * @param string $content The email content. 3840 3907 * @param array $email_data { 3841 3908 * Data relating to the account action email. 3842 3909 * … … 3849 3916 * @type string $siteurl The site URL sending the mail. 3850 3917 * } 3851 3918 */ 3852 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3919 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.7.0', 'user_erasure_fulfillment_email_content' ); 3853 3920 3921 /** 3922 * Filters the body of the data erasure fulfillment notification. 3923 * 3924 * The email is sent to a user when a their data erasure request is fulfilled 3925 * by an administrator. 3926 * 3927 * The following strings have a special meaning and will get replaced dynamically: 3928 * 3929 * ###SITENAME### The name of the site. 3930 * ###PRIVACY_POLICY_URL### Privacy policy page URL. 3931 * ###SITEURL### The URL to the site. 3932 * 3933 * @since 5.7.0 3934 * 3935 * @param string $content The email content. 3936 * @param array $email_data { 3937 * Data relating to the account action email. 3938 * 3939 * @type WP_User_Request $request User request object. 3940 * @type string $message_recipient The address that the email will be sent to. Defaults 3941 * to the value of `$request->email`, but can be changed 3942 * by the `user_erasure_fulfillment_email_to` filter. 3943 * @type string $privacy_policy_url Privacy policy URL. 3944 * @type string $sitename The site name sending the mail. 3945 * @type string $siteurl The site URL sending the mail. 3946 * } 3947 */ 3948 $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data ); 3949 3854 3950 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3855 3951 $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content ); 3856 3952 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); … … 3860 3956 /** 3861 3957 * Filters the headers of the data erasure fulfillment notification. 3862 3958 * 3959 * Use the {@see 'user_erasure_fulfillment_email_headers'} filter instead. 3960 * 3863 3961 * @since 5.4.0 3864 3962 * 3963 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_headers'} filter instead. 3964 * 3865 3965 * @param string|array $headers The email headers. 3866 3966 * @param string $subject The email subject. 3867 3967 * @param string $content The email content. … … 3878 3978 * @type string $siteurl The site URL sending the mail. 3879 3979 * } 3880 3980 */ 3881 $headers = apply_filters ( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data);3981 $headers = apply_filters_deprecated( 'user_erasure_complete_email_headers', array( $headers, $subject, $content, $request_id, $email_data ), '5.7.0', 'user_erasure_fulfillment_email_headers' ); 3882 3982 3983 /** 3984 * Filters the headers of the data erasure fulfillment notification. 3985 * 3986 * @since 5.7.0 3987 * 3988 * @param string|array $headers The email headers. 3989 * @param string $subject The email subject. 3990 * @param string $content The email content. 3991 * @param int $request_id The request ID. 3992 * @param array $email_data { 3993 * Data relating to the account action email. 3994 * 3995 * @type WP_User_Request $request User request object. 3996 * @type string $message_recipient The address that the email will be sent to. Defaults 3997 * to the value of `$request->email`, but can be changed 3998 * by the `user_erasure_fulfillment_email_to` filter. 3999 * @type string $privacy_policy_url Privacy policy URL. 4000 * @type string $sitename The site name sending the mail. 4001 * @type string $siteurl The site URL sending the mail. 4002 * } 4003 */ 4004 $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data ); 4005 3883 4006 $email_sent = wp_mail( $user_email, $subject, $content, $headers ); 3884 4007 3885 4008 if ( $switched_locale ) { … … 4076 4199 'siteurl' => home_url(), 4077 4200 ); 4078 4201 4202 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */ 4203 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); 4204 4205 /** 4206 * Filters the subject of the email sent when an account action is attempted. 4207 * 4208 * @since 4.9.6 4209 * 4210 * @param string $subject The email subject. 4211 * @param string $sitename The name of the site. 4212 * @param array $email_data { 4213 * Data relating to the account action email. 4214 * 4215 * @type WP_User_Request $request User request object. 4216 * @type string $email The email address this is being sent to. 4217 * @type string $description Description of the action being performed so the user knows what the email is for. 4218 * @type string $confirm_url The link to click on to confirm the account action. 4219 * @type string $sitename The site name sending the mail. 4220 * @type string $siteurl The site URL sending the mail. 4221 * } 4222 */ 4223 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); 4224 4079 4225 /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */ 4080 $ email_text = __(4081 4226 $content = __( 4227 'Howdy, 4082 4228 4083 4229 A request has been made to perform the following action on your account: 4084 4230 … … 4107 4253 * 4108 4254 * @since 4.9.6 4109 4255 * 4110 * @param string $ email_text Text in the email.4256 * @param string $content Text in the email. 4111 4257 * @param array $email_data { 4112 4258 * Data relating to the account action email. 4113 4259 * … … 4119 4265 * @type string $siteurl The site URL sending the mail. 4120 4266 * } 4121 4267 */ 4122 $content = apply_filters( 'user_request_action_email_content', $ email_text, $email_data );4268 $content = apply_filters( 'user_request_action_email_content', $content, $email_data ); 4123 4269 4124 4270 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 4125 4271 $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); … … 4127 4273 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 4128 4274 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 4129 4275 4130 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */4131 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );4132 4133 /**4134 * Filters the subject of the email sent when an account action is attempted.4135 *4136 * @since 4.9.64137 *4138 * @param string $subject The email subject.4139 * @param string $sitename The name of the site.4140 * @param array $email_data {4141 * Data relating to the account action email.4142 *4143 * @type WP_User_Request $request User request object.4144 * @type string $email The email address this is being sent to.4145 * @type string $description Description of the action being performed so the user knows what the email is for.4146 * @type string $confirm_url The link to click on to confirm the account action.4147 * @type string $sitename The site name sending the mail.4148 * @type string $siteurl The site URL sending the mail.4149 * }4150 */4151 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );4152 4153 4276 $headers = ''; 4154 4277 4155 4278 /** -
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 );