Make WordPress Core

Ticket #44314: 44314.5.diff

File 44314.5.diff, 21.3 KB (added by garrett-eclipse, 4 years ago)

Refresh to deprecated user_confirmed_action_email_content, user_erasure_complete_email_subject, user_confirmed_action_email_content and user_erasure_complete_email_headers

  • src/wp-admin/includes/privacy-tools.php

     
    628628
    629629        /* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */
    630630        $email_text = __(
    631                 'Howdy,
     631'Howdy,
    632632
    633633Your request for an export of personal data has been completed. You may
    634634download your personal data by clicking on the link below. For privacy
  • src/wp-includes/user.php

     
    32393239                'admin_email' => $admin_email,
    32403240        );
    32413241
     3242        $subject = sprintf(
     3243                /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */
     3244                __( '[%1$s] Action Confirmed: %2$s' ),
     3245                $email_data['sitename'],
     3246                $action_description
     3247        );
     3248
     3249        /**
     3250         * Filters the subject of the user request confirmation email.
     3251         *
     3252         * @since 4.9.8
     3253         *
     3254         * @param string $subject    The email subject.
     3255         * @param string $sitename   The name of the site.
     3256         * @param array  $email_data {
     3257         *     Data relating to the account action email.
     3258         *
     3259         *     @type WP_User_Request $request     User request object.
     3260         *     @type string          $user_email  The email address confirming a request
     3261         *     @type string          $description Description of the action being performed so the user knows what the email is for.
     3262         *     @type string          $manage_url  The link to click manage privacy requests of this type.
     3263         *     @type string          $sitename    The site name sending the mail.
     3264         *     @type string          $siteurl     The site URL sending the mail.
     3265         *     @type string          $admin_email The administrator email receiving the mail.
     3266         * }
     3267         */
     3268        $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );
     3269
    32423270        /* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */
    3243         $email_text = __(
    3244                 'Howdy,
     3271        $content = __(
     3272'Howdy,
    32453273
    32463274A user data privacy request has been confirmed on ###SITENAME###:
    32473275
     
    32603288        /**
    32613289         * Filters the body of the user request confirmation email.
    32623290         *
     3291     * Use the {@see 'user_request_confirmed_email_content'} filter instead.
     3292     *
    32633293         * The email is sent to an administrator when an user request is confirmed.
     3294         *
    32643295         * The following strings have a special meaning and will get replaced dynamically:
    32653296         *
    32663297         * ###SITENAME###    The name of the site.
     
    32693300         * ###MANAGE_URL###  The URL to manage requests.
    32703301         * ###SITEURL###     The URL to the site.
    32713302         *
     3303         * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead.
     3304         *
    32723305         * @since 4.9.6
    32733306         *
    3274          * @param string $email_text Text in the email.
     3307         * @deprecated 5.6.0 Use {@see 'user_request_confirmed_email_content'} filter instead.
     3308         * @ignore This duplicate is deprecated and ignored to avoid documentation issues.
     3309         *
     3310         * @param string $content    The email content.
    32753311         * @param array  $email_data {
    32763312         *     Data relating to the account action email.
    32773313         *
     
    32843320         *     @type string          $admin_email The administrator email receiving the mail.
    32853321         * }
    32863322         */
    3287         $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
     3323        $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.6.0', 'user_request_confirmed_email_content' );
    32883324
    3289         $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
    3290         $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
    3291         $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
    3292         $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );
    3293         $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
    3294 
    3295         $subject = sprintf(
    3296                 /* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */
    3297                 __( '[%1$s] Action Confirmed: %2$s' ),
    3298                 $email_data['sitename'],
    3299                 $action_description
    3300         );
    3301 
    33023325        /**
    3303          * Filters the subject of the user request confirmation email.
     3326         * Filters the body of the user request confirmation email.
    33043327         *
    3305          * @since 4.9.8
     3328         * The email is sent to an administrator when an user request is confirmed.
     3329         * The following strings have a special meaning and will get replaced dynamically:
    33063330         *
    3307          * @param string $subject    The email subject.
    3308          * @param string $sitename   The name of the site.
     3331         * ###SITENAME###    The name of the site.
     3332         * ###USER_EMAIL###  The user email for the request.
     3333         * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     3334         * ###MANAGE_URL###  The URL to manage requests.
     3335         * ###SITEURL###     The URL to the site.
     3336         *
     3337         * For fulfillment email content use the {@see 'user_erasure_fulfillment_email_content'} filter instead.
     3338         *
     3339         * @since 5.6.0
     3340         *
     3341         * @param string $content    The email content.
    33093342         * @param array  $email_data {
    33103343         *     Data relating to the account action email.
    33113344         *
     
    33183351         *     @type string          $admin_email The administrator email receiving the mail.
    33193352         * }
    33203353         */
    3321         $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );
     3354        $content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data );
    33223355
     3356        $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
     3357        $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
     3358        $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
     3359        $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );
     3360        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
     3361
    33233362        $headers = '';
    33243363
    33253364        /**
     
    34103449        /**
    34113450         * Filters the subject of the email sent when an erasure request is completed.
    34123451         *
     3452         * Use the {@see 'user_erasure_fulfillment_email_subject'} filter instead.
     3453         *
    34133454         * @since 4.9.8
    34143455         *
     3456     * @deprecated 5.6.0 Use {@see 'user_erasure_fulfillment_email_subject'} filter instead.
     3457     * @ignore This duplicate is deprecated and ignored to avoid documentation issues.
     3458         *
    34153459         * @param string $subject    The email subject.
    34163460         * @param string $sitename   The name of the site.
    34173461         * @param array  $email_data {
     
    34263470         *     @type string          $siteurl            The site URL sending the mail.
    34273471         * }
    34283472         */
    3429         $subject = apply_filters( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data );
     3473        $subject = apply_filters_deprecated( 'user_erasure_complete_email_subject', array( $subject, $email_data['sitename'], $email_data ), '5.6.0', 'user_erasure_fulfillment_email_subject' );
    34303474
    3431         if ( empty( $email_data['privacy_policy_url'] ) ) {
    3432                 /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
    3433                 $email_text = __(
    3434                         'Howdy,
     3475        /**
     3476         * Filters the subject of the email sent when an erasure request is completed.
     3477         *
     3478         * @since 5.6.0
     3479         *
     3480         * @param string $subject    The email subject.
     3481         * @param string $sitename   The name of the site.
     3482         * @param array  $email_data {
     3483         *     Data relating to the account action email.
     3484         *
     3485         *     @type WP_User_Request $request            User request object.
     3486         *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     3487         *                                               to the value of `$request->email`, but can be changed
     3488         *                                               by the `user_erasure_fulfillment_email_to` filter.
     3489         *     @type string          $privacy_policy_url Privacy policy URL.
     3490         *     @type string          $sitename           The site name sending the mail.
     3491         *     @type string          $siteurl            The site URL sending the mail.
     3492         * }
     3493         */
     3494        $subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data );
    34353495
     3496        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
     3497        $content = __(
     3498'Howdy,
     3499
    34363500Your request to erase your personal data on ###SITENAME### has been completed.
    34373501
    34383502If you have any follow-up questions or concerns, please contact the site administrator.
     
    34403504Regards,
    34413505All at ###SITENAME###
    34423506###SITEURL###'
    3443                 );
    3444         } else {
     3507        );
     3508
     3509        if ( ! empty( $email_data['privacy_policy_url'] ) ) {
    34453510                /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
    3446                 $email_text = __(
    3447                         'Howdy,
     3511                $content = __(
     3512'Howdy,
    34483513
    34493514Your request to erase your personal data on ###SITENAME### has been completed.
    34503515
     
    34613526        /**
    34623527         * Filters the body of the data erasure fulfillment notification.
    34633528         *
     3529         * Use the {@see 'user_erasure_fulfillment_email_content'} filter instead.
     3530         *
    34643531         * The email is sent to a user when a their data erasure request is fulfilled
    34653532         * by an administrator.
    34663533         *
     
    34723539         *
    34733540         * @since 4.9.6
    34743541         *
    3475          * @param string $email_text Text in the email.
     3542         * @deprecated 5.6.0 Use {@see 'user_erasure_fulfillment_email_content'} filter instead.
     3543         * @ignore This duplicate is deprecated and ignored to avoid documentation issues.
     3544         *
     3545         * @param string $content The email content.
    34763546         * @param array  $email_data {
    34773547         *     Data relating to the account action email.
    34783548         *
     
    34853555         *     @type string          $siteurl            The site URL sending the mail.
    34863556         * }
    34873557         */
    3488         $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
     3558        $content = apply_filters_deprecated( 'user_confirmed_action_email_content', array( $content, $email_data ), '5.6.0', 'user_erasure_fulfillment_email_content' );
    34893559
     3560        /**
     3561         * Filters the body of the data erasure fulfillment notification.
     3562         *
     3563         * The email is sent to a user when a their data erasure request is fulfilled
     3564         * by an administrator.
     3565         *
     3566         * The following strings have a special meaning and will get replaced dynamically:
     3567         *
     3568         * ###SITENAME###           The name of the site.
     3569         * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     3570         * ###SITEURL###            The URL to the site.
     3571         *
     3572         * @since 5.6.0
     3573         *
     3574         * @param string $content The email content.
     3575         * @param array  $email_data {
     3576         *     Data relating to the account action email.
     3577         *
     3578         *     @type WP_User_Request $request            User request object.
     3579         *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     3580         *                                               to the value of `$request->email`, but can be changed
     3581         *                                               by the `user_erasure_fulfillment_email_to` filter.
     3582         *     @type string          $privacy_policy_url Privacy policy URL.
     3583         *     @type string          $sitename           The site name sending the mail.
     3584         *     @type string          $siteurl            The site URL sending the mail.
     3585         * }
     3586         */
     3587        $content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data );
     3588
    34903589        $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
    34913590        $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content );
    34923591        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
     
    34963595        /**
    34973596         * Filters the headers of the data erasure fulfillment notification.
    34983597         *
     3598         * Use the {@see 'user_erasure_fulfillment_email_headers'} filter instead.
     3599         *
    34993600         * @since 5.4.0
    35003601         *
     3602         * @deprecated 5.6.0 Use {@see 'user_erasure_fulfillment_email_headers'} filter instead.
     3603         * @ignore This duplicate is deprecated and ignored to avoid documentation issues.
     3604         *
    35013605         * @param string|array $headers    The email headers.
    35023606         * @param string       $subject    The email subject.
    35033607         * @param string       $content    The email content.
     
    35143618         *     @type string          $siteurl            The site URL sending the mail.
    35153619         * }
    35163620         */
    3517         $headers = apply_filters( 'user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data );
     3621        $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' );
    35183622
     3623        /**
     3624         * Filters the headers of the data erasure fulfillment notification.
     3625         *
     3626         * @since 5.6.0
     3627         *
     3628         * @param string|array $headers    The email headers.
     3629         * @param string       $subject    The email subject.
     3630         * @param string       $content    The email content.
     3631         * @param int          $request_id The request ID.
     3632         * @param array        $email_data {
     3633         *     Data relating to the account action email.
     3634         *
     3635         *     @type WP_User_Request $request            User request object.
     3636         *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     3637         *                                               to the value of `$request->email`, but can be changed
     3638         *                                               by the `user_erasure_fulfillment_email_to` filter.
     3639         *     @type string          $privacy_policy_url Privacy policy URL.
     3640         *     @type string          $sitename           The site name sending the mail.
     3641         *     @type string          $siteurl            The site URL sending the mail.
     3642         * }
     3643         */
     3644        $headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data );
     3645
    35193646        $email_sent = wp_mail( $user_email, $subject, $content, $headers );
    35203647
    35213648        if ( $switched_locale ) {
     
    37043831                'siteurl'     => home_url(),
    37053832        );
    37063833
     3834        /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
     3835        $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );
     3836
     3837        /**
     3838         * Filters the subject of the email sent when an account action is attempted.
     3839         *
     3840         * @since 4.9.6
     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          $email       The email address this is being sent to.
     3849         *     @type string          $description Description of the action being performed so the user knows what the email is for.
     3850         *     @type string          $confirm_url The link to click on to confirm the account action.
     3851         *     @type string          $sitename    The site name sending the mail.
     3852         *     @type string          $siteurl     The site URL sending the mail.
     3853         * }
     3854         */
     3855        $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
     3856
    37073857        /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    3708         $email_text = __(
    3709                 'Howdy,
     3858        $content = __(
     3859'Howdy,
    37103860
    37113861A request has been made to perform the following action on your account:
    37123862
     
    37353885         *
    37363886         * @since 4.9.6
    37373887         *
    3738          * @param string $email_text Text in the email.
     3888         * @param string $content Text in the email.
    37393889         * @param array  $email_data {
    37403890         *     Data relating to the account action email.
    37413891         *
     
    37473897         *     @type string          $siteurl     The site URL sending the mail.
    37483898         * }
    37493899         */
    3750         $content = apply_filters( 'user_request_action_email_content', $email_text, $email_data );
     3900        $content = apply_filters( 'user_request_action_email_content', $content, $email_data );
    37513901
    37523902        $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
    37533903        $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content );
     
    37553905        $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
    37563906        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
    37573907
    3758         /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    3759         $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );
    3760 
    3761         /**
    3762          * Filters the subject of the email sent when an account action is attempted.
    3763          *
    3764          * @since 4.9.6
    3765          *
    3766          * @param string $subject    The email subject.
    3767          * @param string $sitename   The name of the site.
    3768          * @param array  $email_data {
    3769          *     Data relating to the account action email.
    3770          *
    3771          *     @type WP_User_Request $request     User request object.
    3772          *     @type string          $email       The email address this is being sent to.
    3773          *     @type string          $description Description of the action being performed so the user knows what the email is for.
    3774          *     @type string          $confirm_url The link to click on to confirm the account action.
    3775          *     @type string          $sitename    The site name sending the mail.
    3776          *     @type string          $siteurl     The site URL sending the mail.
    3777          * }
    3778          */
    3779         $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
    3780 
    37813908        $headers = '';
    37823909
    37833910        /**
  • tests/phpunit/tests/privacy/wpPrivacySendErasureFulfillmentNotification.php

     
    210210         * @ticket 44234
    211211         */
    212212        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' ) );
    214214                _wp_privacy_send_erasure_fulfillment_notification( self::$request_id );
    215215
    216216                $mailer = tests_retrieve_phpmailer_instance();
     
    236236         * @ticket 44234
    237237         */
    238238        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' ) );
    240240                _wp_privacy_send_erasure_fulfillment_notification( self::$request_id );
    241241
    242242                $mailer = tests_retrieve_phpmailer_instance();
     
    264264         * @ticket 44501
    265265         */
    266266        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' ) );
    268268                _wp_privacy_send_erasure_fulfillment_notification( self::$request_id );
    269269
    270270                $mailer = tests_retrieve_phpmailer_instance();
  • tests/phpunit/tests/privacy/wpPrivacySendRequestConfirmationNotification.php

     
    176176
    177177                _wp_privacy_account_request_confirmed( $request_id );
    178178
    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 );
    180180                _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 );
    182182
    183183                $mailer = tests_retrieve_phpmailer_instance();
    184184                $this->assertContains( 'Custom content containing email address:' . $email, $mailer->get_sent()->body );
  • tests/qunit/fixtures/wp-api-generated.js

     
    44694469                        "attributes": {
    44704470                            "required": false,
    44714471                            "default": [],
    4472                             "description": "Attributes for the block",
     4472                            "description": "Attributes for the block.",
    44734473                            "type": "object"
    44744474                        },
    44754475                        "post_id": {
     
    45634563                    "args": {
    45644564                        "name": {
    45654565                            "required": false,
    4566                             "description": "Block name",
     4566                            "description": "Block name.",
    45674567                            "type": "string"
    45684568                        },
    45694569                        "namespace": {
    45704570                            "required": false,
    4571                             "description": "Block namespace",
     4571                            "description": "Block namespace.",
    45724572                            "type": "string"
    45734573                        },
    45744574                        "context": {