Ticket #44314: 44314.7.diff
File 44314.7.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
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 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3673 * 3674 * @param string $content The email content. 3639 3675 * @param array $email_data { 3640 3676 * Data relating to the account action email. 3641 3677 * … … 3648 3684 * @type string $admin_email The administrator email receiving the mail. 3649 3685 * } 3650 3686 */ 3651 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3687 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.6.0', 'user_request_confirmed_email_content' ); 3652 3688 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 3689 /** 3667 * Filters the subjectof the user request confirmation email.3690 * Filters the body of the user request confirmation email. 3668 3691 * 3669 * @since 4.9.8 3692 * The email is sent to an administrator when an user request is confirmed. 3693 * The following strings have a special meaning and will get replaced dynamically: 3670 3694 * 3671 * @param string $subject The email subject. 3672 * @param string $sitename The name of the site. 3695 * ###SITENAME### The name of the site. 3696 * ###USER_EMAIL### The user email for the request. 3697 * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for. 3698 * ###MANAGE_URL### The URL to manage requests. 3699 * ###SITEURL### The URL to the site. 3700 * 3701 * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3702 * 3703 * @since 5.7.0 3704 * 3705 * @param string $content The email content. 3673 3706 * @param array $email_data { 3674 3707 * Data relating to the account action email. 3675 3708 * … … 3682 3715 * @type string $admin_email The administrator email receiving the mail. 3683 3716 * } 3684 3717 */ 3685 $ subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );3718 $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data ); 3686 3719 3720 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3721 $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content ); 3722 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 3723 $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content ); 3724 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 3725 3687 3726 $headers = ''; 3688 3727 3689 3728 /** … … 3774 3813 /** 3775 3814 * Filters the subject of the email sent when an erasure request is completed. 3776 3815 * 3816 * Use the {@see 'user_erasure_fulfillment_email_subject'} filter instead. 3817 * 3777 3818 * @since 4.9.8 3778 3819 * 3820 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_subject'} filter instead. 3821 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3822 * 3779 3823 * @param string $subject The email subject. 3780 3824 * @param string $sitename The name of the site. 3781 3825 * @param array $email_data { … … 3790 3834 * @type string $siteurl The site URL sending the mail. 3791 3835 * } 3792 3836 */ 3793 $subject = apply_filters ( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);3837 $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.6.0', 'user_erasure_fulfillment_email_subject' ); 3794 3838 3795 if ( empty( $email_data['privacy_policy_url'] ) ) { 3796 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3797 $email_text = __( 3798 'Howdy, 3839 /** 3840 * Filters the subject of the email sent when an erasure request is completed. 3841 * 3842 * @since 5.7.0 3843 * 3844 * @param string $subject The email subject. 3845 * @param string $sitename The name of the site. 3846 * @param array $email_data { 3847 * Data relating to the account action email. 3848 * 3849 * @type WP_User_Request $request User request object. 3850 * @type string $message_recipient The address that the email will be sent to. Defaults 3851 * to the value of `$request->email`, but can be changed 3852 * by the `user_erasure_fulfillment_email_to` filter. 3853 * @type string $privacy_policy_url Privacy policy URL. 3854 * @type string $sitename The site name sending the mail. 3855 * @type string $siteurl The site URL sending the mail. 3856 * } 3857 */ 3858 $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data ); 3799 3859 3860 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */ 3861 $content = __( 3862 'Howdy, 3863 3800 3864 Your request to erase your personal data on ###SITENAME### has been completed. 3801 3865 3802 3866 If you have any follow-up questions or concerns, please contact the site administrator. … … 3804 3868 Regards, 3805 3869 All at ###SITENAME### 3806 3870 ###SITEURL###' 3807 ); 3808 } else { 3871 ); 3872 3873 if ( ! empty( $email_data['privacy_policy_url'] ) ) { 3809 3874 /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */ 3810 $ email_text = __(3811 3875 $content = __( 3876 'Howdy, 3812 3877 3813 3878 Your request to erase your personal data on ###SITENAME### has been completed. 3814 3879 … … 3825 3890 /** 3826 3891 * Filters the body of the data erasure fulfillment notification. 3827 3892 * 3893 * Use the {@see 'user_erasure_fulfillment_email_content'} filter instead. 3894 * 3828 3895 * The email is sent to a user when a their data erasure request is fulfilled 3829 3896 * by an administrator. 3830 3897 * … … 3836 3903 * 3837 3904 * @since 4.9.6 3838 3905 * 3839 * @param string $email_text Text in the email. 3906 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_content'} filter instead. 3907 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3908 * 3909 * @param string $content The email content. 3840 3910 * @param array $email_data { 3841 3911 * Data relating to the account action email. 3842 3912 * … … 3849 3919 * @type string $siteurl The site URL sending the mail. 3850 3920 * } 3851 3921 */ 3852 $content = apply_filters ( 'user_confirmed_action_email_content', $email_text, $email_data);3922 $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.6.0', 'user_erasure_fulfillment_email_content' ); 3853 3923 3924 /** 3925 * Filters the body of the data erasure fulfillment notification. 3926 * 3927 * The email is sent to a user when a their data erasure request is fulfilled 3928 * by an administrator. 3929 * 3930 * The following strings have a special meaning and will get replaced dynamically: 3931 * 3932 * ###SITENAME### The name of the site. 3933 * ###PRIVACY_POLICY_URL### Privacy policy page URL. 3934 * ###SITEURL### The URL to the site. 3935 * 3936 * @since 5.7.0 3937 * 3938 * @param string $content The email content. 3939 * @param array $email_data { 3940 * Data relating to the account action email. 3941 * 3942 * @type WP_User_Request $request User request object. 3943 * @type string $message_recipient The address that the email will be sent to. Defaults 3944 * to the value of `$request->email`, but can be changed 3945 * by the `user_erasure_fulfillment_email_to` filter. 3946 * @type string $privacy_policy_url Privacy policy URL. 3947 * @type string $sitename The site name sending the mail. 3948 * @type string $siteurl The site URL sending the mail. 3949 * } 3950 */ 3951 $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data ); 3952 3854 3953 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 3855 3954 $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content ); 3856 3955 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); … … 3860 3959 /** 3861 3960 * Filters the headers of the data erasure fulfillment notification. 3862 3961 * 3962 * Use the {@see 'user_erasure_fulfillment_email_headers'} filter instead. 3963 * 3863 3964 * @since 5.4.0 3864 3965 * 3966 * @deprecated 5.7.0 Use {@see 'user_erasure_fulfillment_email_headers'} filter instead. 3967 * @ignore This duplicate is deprecated and ignored to avoid documentation issues. 3968 * 3865 3969 * @param string|array $headers The email headers. 3866 3970 * @param string $subject The email subject. 3867 3971 * @param string $content The email content. … … 3878 3982 * @type string $siteurl The site URL sending the mail. 3879 3983 * } 3880 3984 */ 3881 $headers = apply_filters ( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data);3985 $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' ); 3882 3986 3987 /** 3988 * Filters the headers of the data erasure fulfillment notification. 3989 * 3990 * @since 5.7.0 3991 * 3992 * @param string|array $headers The email headers. 3993 * @param string $subject The email subject. 3994 * @param string $content The email content. 3995 * @param int $request_id The request ID. 3996 * @param array $email_data { 3997 * Data relating to the account action email. 3998 * 3999 * @type WP_User_Request $request User request object. 4000 * @type string $message_recipient The address that the email will be sent to. Defaults 4001 * to the value of `$request->email`, but can be changed 4002 * by the `user_erasure_fulfillment_email_to` filter. 4003 * @type string $privacy_policy_url Privacy policy URL. 4004 * @type string $sitename The site name sending the mail. 4005 * @type string $siteurl The site URL sending the mail. 4006 * } 4007 */ 4008 $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data ); 4009 3883 4010 $email_sent = wp_mail( $user_email, $subject, $content, $headers ); 3884 4011 3885 4012 if ( $switched_locale ) { … … 4068 4195 'siteurl' => home_url(), 4069 4196 ); 4070 4197 4198 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */ 4199 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] ); 4200 4201 /** 4202 * Filters the subject of the email sent when an account action is attempted. 4203 * 4204 * @since 4.9.6 4205 * 4206 * @param string $subject The email subject. 4207 * @param string $sitename The name of the site. 4208 * @param array $email_data { 4209 * Data relating to the account action email. 4210 * 4211 * @type WP_User_Request $request User request object. 4212 * @type string $email The email address this is being sent to. 4213 * @type string $description Description of the action being performed so the user knows what the email is for. 4214 * @type string $confirm_url The link to click on to confirm the account action. 4215 * @type string $sitename The site name sending the mail. 4216 * @type string $siteurl The site URL sending the mail. 4217 * } 4218 */ 4219 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data ); 4220 4071 4221 /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */ 4072 $ email_text = __(4073 4222 $content = __( 4223 'Howdy, 4074 4224 4075 4225 A request has been made to perform the following action on your account: 4076 4226 … … 4099 4249 * 4100 4250 * @since 4.9.6 4101 4251 * 4102 * @param string $ email_text Text in the email.4252 * @param string $content Text in the email. 4103 4253 * @param array $email_data { 4104 4254 * Data relating to the account action email. 4105 4255 * … … 4111 4261 * @type string $siteurl The site URL sending the mail. 4112 4262 * } 4113 4263 */ 4114 $content = apply_filters( 'user_request_action_email_content', $ email_text, $email_data );4264 $content = apply_filters( 'user_request_action_email_content', $content, $email_data ); 4115 4265 4116 4266 $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content ); 4117 4267 $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content ); … … 4119 4269 $content = str_replace( '###SITENAME###', $email_data['sitename'], $content ); 4120 4270 $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content ); 4121 4271 4122 /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */4123 $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );4124 4125 /**4126 * Filters the subject of the email sent when an account action is attempted.4127 *4128 * @since 4.9.64129 *4130 * @param string $subject The email subject.4131 * @param string $sitename The name of the site.4132 * @param array $email_data {4133 * Data relating to the account action email.4134 *4135 * @type WP_User_Request $request User request object.4136 * @type string $email The email address this is being sent to.4137 * @type string $description Description of the action being performed so the user knows what the email is for.4138 * @type string $confirm_url The link to click on to confirm the account action.4139 * @type string $sitename The site name sending the mail.4140 * @type string $siteurl The site URL sending the mail.4141 * }4142 */4143 $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );4144 4145 4272 $headers = ''; 4146 4273 4147 4274 /** -
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 );