WordPress.org

Make WordPress Core

Ticket #43967: 43967.diff

File 43967.diff, 3.5 KB (added by desrosj, 6 weeks ago)

First pass at an email to the site admin when a request is confirmed.

  • src/wp-includes/user.php

     
    29252925}
    29262926
    29272927/**
    2928  * Update log when privacy request is confirmed.
     2928 * Update log when privacy request is confirmed and notify the site admin.
    29292929 *
    29302930 * @since 4.9.6
    29312931 * @access private
     
    29482948                'ID'          => $request_id,
    29492949                'post_status' => 'request-confirmed',
    29502950        ) );
     2951
     2952        $manage_url = add_query_arg( 'page', $request_data->action_name, admin_url( 'tools.php' ) );
     2953
     2954        $email_data = array(
     2955                'request'     => $request_data,
     2956                'user_email'  => $request_data->email,
     2957                'description' => wp_user_request_action_description( $request_data->action_name ),
     2958                'manage_url'  => $manage_url,
     2959                'sitename'    => is_multisite() ? get_site_option( 'site_name' ) : get_option( 'blogname' ),
     2960                'siteurl'     => network_home_url(),
     2961                'admin_email' => get_option( 'admin_email' ),
     2962        );
     2963
     2964        /* translators: Do not translate USERNAME, DESCRIPTION, MANAGE_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
     2965        $email_text = __(
     2966                'Howdy,
     2967
     2968A user data privacy request has been confirmed on ###SITENAME###:
     2969
     2970User: ###USER_EMAIL###
     2971Request: ###DESCRIPTION###
     2972
     2973You can view and manage these data privacy requests here:
     2974
     2975###MANAGE_URL###
     2976
     2977This email has been sent to ###EMAIL###.
     2978
     2979Regards,
     2980All at ###SITENAME###
     2981###SITEURL###'
     2982                );
     2983
     2984        /**
     2985         * Filters the text of the email sent to an administrator when an account action is confirmed.
     2986         *
     2987         * The following strings have a special meaning and will get replaced dynamically:
     2988         *
     2989         * ###USER_EMAIL###   The user email for the request.
     2990         * ###DESCRIPTION###  Description of the action being performed so the user knows what the email is for.
     2991         * ###MANAGE_URL###   The URL to manage requests.
     2992         * ###EMAIL###        Administrator email that the email is being sent to.
     2993         * ###SITENAME###     The name of the site.
     2994         * ###SITEURL###      The URL to the site.
     2995         *
     2996         * @since 4.9.6
     2997         *
     2998         * @param string $email_text Text in the email.
     2999         * @param array  $email_data {
     3000         *     Data relating to the account action email.
     3001         *
     3002         *     @type WP_User_Request $request     User request object.
     3003         *     @type string          $user_email  The email address confirming a request
     3004         *     @type string          $description Description of the action being performed so the user knows what the email is for.
     3005         *     @type string          $manage_url  The link to click manage privacy requests of this type.
     3006         *     @type string          $sitename    The site name sending the mail.
     3007         *     @type string          $siteurl     The site URL sending the mail.
     3008         * }
     3009         */
     3010        $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
     3011
     3012        $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
     3013        $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
     3014        $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );
     3015        $content = str_replace( '###EMAIL###', $email_data['admin_email'], $content );
     3016        $content = str_replace( '###SITENAME###', wp_specialchars_decode( $email_data['sitename'], ENT_QUOTES ), $content );
     3017        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
     3018
     3019        /* translators: %s Site name. */
     3020        wp_mail( $email_data['admin_email'], sprintf( __( '[%s] Action Confirmed' ), wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ), $content );
    29513021}
    29523022
    29533023/**