Ticket #44314: 44314.cc.2.diff
File 44314.cc.2.diff, 19.9 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
3614 3614 'admin_email' => $admin_email, 3615 3615 ); 3616 3616 3617 $subject = sprintf( 3618 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */ 3619 __( '[%1$s] Action Confirmed: %2$s' ), 3620 $email_data['sitename'], 3621 $action_description 3622 ); 3623 3624 /** 3625 * Filters the subject of the user request confirmation email. 3626 * 3627 * @since 4.9.8 3628 * 3629 * @param string $subject The email subject. 3630 * @param string $sitename The name of the site. 3631 * @param array $email_data { 3632 * Data relating to the account action email. 3633 * 3634 * @type WP_User_Request $request User request object. 3635 * @type string $user_email The email address confirming a request 3636 * @type string $description Description of the action being performed so the user knows what the email is for. 3637 * @type string $manage_url The link to click manage privacy requests of this type. 3638 * @type string $sitename The site name sending the mail. 3639 * @type string $siteurl The site URL sending the mail. 3640 * @type string $admin_email The administrator email receiving the mail. 3641 * } 3642 */ 3643 $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data ); 3644 3617 3645 /* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */ 3618 $ email_text = __(3619 3646 $content = __( 3647 'Howdy, 3620 3648 3621 3649 A user data privacy request has been confirmed on ###SITENAME###: 3622 3650 … … 3635 3663 /** 3636 3664 * Filters the body of the user request confirmation email. 3637 3665 * 3666 * Use {@see 'user_request_confirmed_email_content'} instead. 3667 * 3638 3668 * The email is sent to an administrator when an user request is confirmed. 3669 * 3639 3670 * The following strings have a special meaning and will get replaced dynamically: 3640 3671 * 3641 3672 * ###SITENAME### The name of the site. … … 3644 3675 * ###MANAGE_URL### The URL to manage requests. 3645 3676 * ###SITEURL### The URL to the site. 3646 3677 * 3678 * For fulfillment email content use {@see 'user_erasure_fulfillment_email_content'} instead. 3679 * 3647 3680 * @since 4.9.6 3648 3681 * 3649 * @param string $email_text Text in the email. 3682 * @deprecated 5.7.0 Use {@see 'user_request_confirmed_email_content'} instead. For fulfillment email content use {@see 'user_erasure_fulfillment_email_content'} instead. 3683 * 3684 * @param string $content The email content. 3650 3685 * @param array $email_data { 3651 3686 * Data relating to the account action email. 3652 3687 * … … 3659 3694 * @type string $admin_email The administrator email receiving the mail. 3660 3695 * } 3661 3696 */ 3662 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3697 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.7.0', 'user_request_confirmed_email_content or user_erasure_fulfillment_email_content' ); 3663 3698 3664 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );3665 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );3666 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );3667 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );3668 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );3669 3670 $subject = sprintf(3671 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */3672 __( '[%1$s] Action Confirmed: %2$s' ),3673 $email_data['sitename'],3674 $action_description3675 );3676 3677 3699 /** 3678 * Filters the subjectof the user request confirmation email.3700 * Filters the body of the user request confirmation email. 3679 3701 * 3680 * @since 4.9.8 3702 * The email is sent to an administrator when an user request is confirmed. 3703 * The following strings have a special meaning and will get replaced dynamically: 3681 3704 * 3682 * @param string $subject The email subject. 3683 * @param string $sitename The name of the site. 3705 * ###SITENAME### The name of the site. 3706 * ###USER_EMAIL### The user email for the request. 3707 * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for. 3708 * ###MANAGE_URL### The URL to manage requests. 3709 * ###SITEURL### The URL to the site. 3710 * 3711 * @since 5.7.0 3712 * 3713 * @param string $content The email content. 3684 3714 * @param array $email_data { 3685 3715 * Data relating to the account action email. 3686 3716 * … … 3693 3723 * @type string $admin_email The administrator email receiving the mail. 3694 3724 * } 3695 3725 */ 3696 $ subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );3726 $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data ); 3697 3727 3728 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3729 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content ); 3730 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 3731 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content ); 3732 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 3733 3698 3734 $headers = ''; 3699 3735 3700 3736 /** … … 3785 3821 /** 3786 3822 * Filters the subject of the email sent when an erasure request is completed. 3787 3823 * 3824 * Use {@see 'user_erasure_fulfillment_email_subject'} instead. 3825 * 3788 3826 * @since 4.9.8 3789 3827 * 3828 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead. 3829 * 3790 3830 * @param string $subject The email subject. 3791 3831 * @param string $sitename The name of the site. 3792 3832 * @param array $email_data { … … 3801 3841 * @type string $siteurl The site URL sending the mail. 3802 3842 * } 3803 3843 */ 3804 $subject = apply_filters ( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);3844 $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.7.0', 'user_erasure_fulfillment_email_subject' ); 3805 3845 3806 if ( empty( $email_data['privacy_policy_url'] ) ) { 3807 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3808 $email_text = __( 3809 'Howdy, 3846 /** 3847 * Filters the subject of the email sent when an erasure request is completed. 3848 * 3849 * @since 5.7.0 3850 * 3851 * @param string $subject The email subject. 3852 * @param string $sitename The name of the site. 3853 * @param array $email_data { 3854 * Data relating to the account action email. 3855 * 3856 * @type WP_User_Request $request User request object. 3857 * @type string $message_recipient The address that the email will be sent to. Defaults 3858 * to the value of `$request->email`, but can be changed 3859 * by the `user_erasure_fulfillment_email_to` filter. 3860 * @type string $privacy_policy_url Privacy policy URL. 3861 * @type string $sitename The site name sending the mail. 3862 * @type string $siteurl The site URL sending the mail. 3863 * } 3864 */ 3865 $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data ); 3810 3866 3867 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3868 $content = __( 3869 'Howdy, 3870 3811 3871 Your request to erase your personal data on ###SITENAME### has been completed. 3812 3872 3813 3873 If you have any follow-up questions or concerns, please contact the site administrator. … … 3815 3875 Regards, 3816 3876 All at ###SITENAME### 3817 3877 ###SITEURL###' 3818 ); 3819 } else { 3878 ); 3879 3880 if ( ! empty( $email_data['privacy_policy_url'] ) ) { 3820 3881 /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */ 3821 $ email_text = __(3822 3882 $content = __( 3883 'Howdy, 3823 3884 3824 3885 Your request to erase your personal data on ###SITENAME### has been completed. 3825 3886 … … 3836 3897 /** 3837 3898 * Filters the body of the data erasure fulfillment notification. 3838 3899 * 3900 * Use {@see 'user_erasure_fulfillment_email_content'} instead. 3901 * 3839 3902 * The email is sent to a user when a their data erasure request is fulfilled 3840 3903 * by an administrator. 3841 3904 * … … 3845 3908 * ###PRIVACY_POLICY_URL### Privacy policy page URL. 3846 3909 * ###SITEURL### The URL to the site. 3847 3910 * 3911 * For user request confirmation email content use {@see 'user_request_confirmed_email_content'} instead. 3912 * 3848 3913 * @since 4.9.6 3849 3914 * 3850 * @param string $email_text Text in the email. 3915 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_content'} instead. For user request confirmation email content use {@see 'user_request_confirmed_email_content'} instead. 3916 * 3917 * @param string $content The email content. 3851 3918 * @param array $email_data { 3852 3919 * Data relating to the account action email. 3853 3920 * … … 3860 3927 * @type string $siteurl The site URL sending the mail. 3861 3928 * } 3862 3929 */ 3863 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3930 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.7.0', 'user_erasure_fulfillment_email_content or user_request_confirmed_email_content' ); 3864 3931 3932 /** 3933 * Filters the body of the data erasure fulfillment notification. 3934 * 3935 * The email is sent to a user when a their data erasure request is fulfilled 3936 * by an administrator. 3937 * 3938 * The following strings have a special meaning and will get replaced dynamically: 3939 * 3940 * ###SITENAME### The name of the site. 3941 * ###PRIVACY_POLICY_URL### Privacy policy page URL. 3942 * ###SITEURL### The URL to the site. 3943 * 3944 * @since 5.7.0 3945 * 3946 * @param string $content The email content. 3947 * @param array $email_data { 3948 * Data relating to the account action email. 3949 * 3950 * @type WP_User_Request $request User request object. 3951 * @type string $message_recipient The address that the email will be sent to. Defaults 3952 * to the value of `$request->email`, but can be changed 3953 * by the `user_erasure_fulfillment_email_to` filter. 3954 * @type string $privacy_policy_url Privacy policy URL. 3955 * @type string $sitename The site name sending the mail. 3956 * @type string $siteurl The site URL sending the mail. 3957 * } 3958 */ 3959 $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data ); 3960 3865 3961 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3866 3962 $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content ); 3867 3963 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); … … 3871 3967 /** 3872 3968 * Filters the headers of the data erasure fulfillment notification. 3873 3969 * 3970 * Use {@see 'user_erasure_fulfillment_email_headers'} instead. 3971 * 3874 3972 * @since 5.4.0 3875 3973 * 3974 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead. 3975 * 3876 3976 * @param string|array $headers The email headers. 3877 3977 * @param string $subject The email subject. 3878 3978 * @param string $content The email content. … … 3889 3989 * @type string $siteurl The site URL sending the mail. 3890 3990 * } 3891 3991 */ 3892 $headers = apply_filters ( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data);3992 $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' ); 3893 3993 3994 /** 3995 * Filters the headers of the data erasure fulfillment notification. 3996 * 3997 * @since 5.7.0 3998 * 3999 * @param string|array $headers The email headers. 4000 * @param string $subject The email subject. 4001 * @param string $content The email content. 4002 * @param int $request_id The request ID. 4003 * @param array $email_data { 4004 * Data relating to the account action email. 4005 * 4006 * @type WP_User_Request $request User request object. 4007 * @type string $message_recipient The address that the email will be sent to. Defaults 4008 * to the value of `$request->email`, but can be changed 4009 * by the `user_erasure_fulfillment_email_to` filter. 4010 * @type string $privacy_policy_url Privacy policy URL. 4011 * @type string $sitename The site name sending the mail. 4012 * @type string $siteurl The site URL sending the mail. 4013 * } 4014 */ 4015 $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data ); 4016 3894 4017 $email_sent = wp_mail( $user_email, $subject, $content, $headers ); 3895 4018 3896 4019 if ( $switched_locale ) { … … 4087 4210 'siteurl' => home_url(), 4088 4211 ); 4089 4212 4213 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */ 4214 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); 4215 4216 /** 4217 * Filters the subject of the email sent when an account action is attempted. 4218 * 4219 * @since 4.9.6 4220 * 4221 * @param string $subject The email subject. 4222 * @param string $sitename The name of the site. 4223 * @param array $email_data { 4224 * Data relating to the account action email. 4225 * 4226 * @type WP_User_Request $request User request object. 4227 * @type string $email The email address this is being sent to. 4228 * @type string $description Description of the action being performed so the user knows what the email is for. 4229 * @type string $confirm_url The link to click on to confirm the account action. 4230 * @type string $sitename The site name sending the mail. 4231 * @type string $siteurl The site URL sending the mail. 4232 * } 4233 */ 4234 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); 4235 4090 4236 /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */ 4091 $ email_text = __(4092 4237 $content = __( 4238 'Howdy, 4093 4239 4094 4240 A request has been made to perform the following action on your account: 4095 4241 … … 4118 4264 * 4119 4265 * @since 4.9.6 4120 4266 * 4121 * @param string $ email_text Text in the email.4267 * @param string $content Text in the email. 4122 4268 * @param array $email_data { 4123 4269 * Data relating to the account action email. 4124 4270 * … … 4130 4276 * @type string $siteurl The site URL sending the mail. 4131 4277 * } 4132 4278 */ 4133 $content = apply_filters( 'user_request_action_email_content', $ email_text, $email_data );4279 $content = apply_filters( 'user_request_action_email_content', $content, $email_data ); 4134 4280 4135 4281 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 4136 4282 $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); … … 4138 4284 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 4139 4285 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 4140 4286 4141 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */4142 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );4143 4144 /**4145 * Filters the subject of the email sent when an account action is attempted.4146 *4147 * @since 4.9.64148 *4149 * @param string $subject The email subject.4150 * @param string $sitename The name of the site.4151 * @param array $email_data {4152 * Data relating to the account action email.4153 *4154 * @type WP_User_Request $request User request object.4155 * @type string $email The email address this is being sent to.4156 * @type string $description Description of the action being performed so the user knows what the email is for.4157 * @type string $confirm_url The link to click on to confirm the account action.4158 * @type string $sitename The site name sending the mail.4159 * @type string $siteurl The site URL sending the mail.4160 * }4161 */4162 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );4163 4164 4287 $headers = ''; 4165 4288 4166 4289 /** -
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 );