~canonical-sysadmins/wordpress/5.0.3

« back to all changes in this revision

Viewing changes to wp-includes/user.php

  • Committer: Barry Price
  • Date: 2018-08-09 08:33:05 UTC
  • mfrom: (1.2.7 upstream)
  • Revision ID: barry.price@canonical.com-20180809083305-0xedqwn9ltsh4whr
Merge WP4.9.8 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
2657
2657
                );
2658
2658
                update_user_meta( $current_user->ID, '_new_email', $new_user_email );
2659
2659
 
2660
 
                if ( is_multisite() ) {
2661
 
                        $sitename = get_site_option( 'site_name' );
2662
 
                } else {
2663
 
                        $sitename = get_option( 'blogname' );
2664
 
                }
 
2660
                $sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
2665
2661
 
2666
2662
                /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
2667
2663
                $email_text = __( 'Howdy ###USERNAME###,
2706
2702
                $content = str_replace( '###USERNAME###', $current_user->user_login, $content );
2707
2703
                $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail=' . $hash ) ), $content );
2708
2704
                $content = str_replace( '###EMAIL###', $_POST['email'], $content );
2709
 
                $content = str_replace( '###SITENAME###', wp_specialchars_decode( $sitename, ENT_QUOTES ), $content );
2710
 
                $content = str_replace( '###SITEURL###', network_home_url(), $content );
 
2705
                $content = str_replace( '###SITENAME###', $sitename, $content );
 
2706
                $content = str_replace( '###SITEURL###', home_url(), $content );
2711
2707
 
2712
 
                wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ), $content );
 
2708
                wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), $sitename ), $content );
2713
2709
 
2714
2710
                $_POST['email'] = $current_user->user_email;
2715
2711
        }
2895
2891
                return;
2896
2892
        }
2897
2893
 
2898
 
        $subject = sprintf(
2899
 
                /* translators: %s Site name. */
2900
 
                __( '[%s] Action Confirmed' ),
2901
 
                wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )
2902
 
        );
2903
 
 
2904
 
        $manage_url = add_query_arg( 'page', $request_data->action_name, admin_url( 'tools.php' ) );
 
2894
        $manage_url         = add_query_arg( 'page', $request_data->action_name, admin_url( 'tools.php' ) );
 
2895
        $action_description = wp_user_request_action_description( $request_data->action_name );
2905
2896
 
2906
2897
        /**
2907
2898
         * Filters the recipient of the data request confirmation notification.
2922
2913
        $email_data = array(
2923
2914
                'request'     => $request_data,
2924
2915
                'user_email'  => $request_data->email,
2925
 
                'description' => wp_user_request_action_description( $request_data->action_name ),
 
2916
                'description' => $action_description,
2926
2917
                'manage_url'  => $manage_url,
2927
 
                'sitename'    => get_option( 'blogname' ),
 
2918
                'sitename'    => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
2928
2919
                'siteurl'     => home_url(),
2929
2920
                'admin_email' => $admin_email,
2930
2921
        );
2971
2962
         *     @type string          $manage_url  The link to click manage privacy requests of this type.
2972
2963
         *     @type string          $sitename    The site name sending the mail.
2973
2964
         *     @type string          $siteurl     The site URL sending the mail.
 
2965
         *     @type string          $admin_email The administrator email receiving the mail.
2974
2966
         * }
2975
2967
         */
2976
2968
        $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
2977
2969
 
2978
 
        $content = str_replace( '###SITENAME###', wp_specialchars_decode( $email_data['sitename'], ENT_QUOTES ), $content );
 
2970
        $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
2979
2971
        $content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
2980
2972
        $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
2981
2973
        $content = str_replace( '###MANAGE_URL###', esc_url_raw( $email_data['manage_url'] ), $content );
2982
2974
        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
2983
2975
 
 
2976
        $subject = sprintf(
 
2977
                /* translators: 1: Site name. 2: Name of the confirmed action. */
 
2978
                __( '[%1$s] Action Confirmed: %2$s' ),
 
2979
                $email_data['sitename'],
 
2980
                $action_description
 
2981
        );
 
2982
 
 
2983
        /**
 
2984
         * Filters the subject of the user request confirmation email.
 
2985
         *
 
2986
         * @since 4.9.8
 
2987
         *
 
2988
         * @param string $subject    The email subject.
 
2989
         * @param string $sitename   The name of the site.
 
2990
         * @param array  $email_data {
 
2991
         *     Data relating to the account action email.
 
2992
         *
 
2993
         *     @type WP_User_Request $request     User request object.
 
2994
         *     @type string          $user_email  The email address confirming a request
 
2995
         *     @type string          $description Description of the action being performed so the user knows what the email is for.
 
2996
         *     @type string          $manage_url  The link to click manage privacy requests of this type.
 
2997
         *     @type string          $sitename    The site name sending the mail.
 
2998
         *     @type string          $siteurl     The site URL sending the mail.
 
2999
         *     @type string          $admin_email The administrator email receiving the mail.
 
3000
         * }
 
3001
         */
 
3002
        $subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );
 
3003
 
2984
3004
        $email_sent = wp_mail( $email_data['admin_email'], $subject, $content );
2985
3005
 
2986
3006
        if ( $email_sent ) {
3010
3030
                return;
3011
3031
        }
3012
3032
 
3013
 
        $subject = sprintf(
3014
 
                /* translators: %s Site name. */
3015
 
                __( '[%s] Erasure Request Fulfilled' ),
3016
 
                wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )
3017
 
        );
3018
 
 
3019
3033
        /**
3020
3034
         * Filters the recipient of the data erasure fulfillment notification.
3021
3035
         *
3030
3044
                'request'            => $request_data,
3031
3045
                'message_recipient'  => $user_email,
3032
3046
                'privacy_policy_url' => get_privacy_policy_url(),
3033
 
                'sitename'           => get_option( 'blogname' ),
 
3047
                'sitename'           => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
3034
3048
                'siteurl'            => home_url(),
3035
3049
        );
3036
3050
 
 
3051
        $subject  = sprintf(
 
3052
                /* translators: %s: Site name. */
 
3053
                __( '[%s] Erasure Request Fulfilled' ),
 
3054
                $email_data['sitename']
 
3055
        );
 
3056
 
 
3057
        /**
 
3058
         * Filters the subject of the email sent when an erasure request is completed.
 
3059
         *
 
3060
         * @since 4.9.8
 
3061
         *
 
3062
         * @param string $subject    The email subject.
 
3063
         * @param string $sitename   The name of the site.
 
3064
         * @param array  $email_data {
 
3065
         *     Data relating to the account action email.
 
3066
         *
 
3067
         *     @type WP_User_Request $request            User request object.
 
3068
         *     @type string          $message_recipient  The address that the email will be sent to. Defaults
 
3069
         *                                               to the value of `$request->email`, but can be changed
 
3070
         *                                               by the `user_erasure_fulfillment_email_to` filter.
 
3071
         *     @type string          $privacy_policy_url Privacy policy URL.
 
3072
         *     @type string          $sitename           The site name sending the mail.
 
3073
         *     @type string          $siteurl            The site URL sending the mail.
 
3074
         * }
 
3075
         */
 
3076
        $subject = apply_filters( 'user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data );
 
3077
 
3037
3078
        if ( empty( $email_data['privacy_policy_url'] ) ) {
3038
3079
                /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
3039
3080
                $email_text = __(
3093
3134
         */
3094
3135
        $content = apply_filters( 'user_confirmed_action_email_content', $email_text, $email_data );
3095
3136
 
3096
 
        $content = str_replace( '###SITENAME###', wp_specialchars_decode( $email_data['sitename'], ENT_QUOTES ), $content );
 
3137
        $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
3097
3138
        $content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content );
3098
3139
        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
3099
3140
 
3249
3290
        }
3250
3291
 
3251
3292
        $email_data = array(
 
3293
                'request'     => $request,
3252
3294
                'email'       => $request->email,
3253
3295
                'description' => wp_user_request_action_description( $request->action_name ),
3254
3296
                'confirm_url' => add_query_arg( array(
3255
3297
                        'action'      => 'confirmaction',
3256
3298
                        'request_id'  => $request_id,
3257
3299
                        'confirm_key' => wp_generate_user_request_key( $request_id ),
3258
 
                ), site_url( 'wp-login.php' ) ),
3259
 
                'sitename'    => is_multisite() ? get_site_option( 'site_name' ) : get_option( 'blogname' ),
3260
 
                'siteurl'     => network_home_url(),
 
3300
                ), wp_login_url() ),
 
3301
                'sitename'    => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
 
3302
                'siteurl'     => home_url(),
3261
3303
        );
3262
3304
 
3263
3305
        /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
3308
3350
        $content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
3309
3351
        $content = str_replace( '###CONFIRM_URL###', esc_url_raw( $email_data['confirm_url'] ), $content );
3310
3352
        $content = str_replace( '###EMAIL###', $email_data['email'], $content );
3311
 
        $content = str_replace( '###SITENAME###', wp_specialchars_decode( $email_data['sitename'], ENT_QUOTES ), $content );
 
3353
        $content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
3312
3354
        $content = str_replace( '###SITEURL###', esc_url_raw( $email_data['siteurl'] ), $content );
3313
3355
 
3314
 
        $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
3315
 
 
3316
3356
        /* translators: Privacy data request subject. 1: Site name, 2: Name of the action */
3317
 
        $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $blogname, $email_data['description'] );
 
3357
        $subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );
3318
3358
 
3319
3359
        /**
3320
3360
         * Filters the subject of the email sent when an account action is attempted.
3322
3362
         * @since 4.9.6
3323
3363
         *
3324
3364
         * @param string $subject    The email subject.
3325
 
         * @param string $blogname   The name of the site.
 
3365
         * @param string $sitename   The name of the site.
3326
3366
         * @param array  $email_data {
3327
3367
         *     Data relating to the account action email.
3328
3368
         *
3334
3374
         *     @type string          $siteurl     The site URL sending the mail.
3335
3375
         * }
3336
3376
         */
3337
 
        $subject = apply_filters( 'user_request_action_email_subject', $subject, $blogname, $email_data );
 
3377
        $subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
3338
3378
 
3339
3379
        return wp_mail( $email_data['email'], $subject, $content );
3340
3380
}