Changeset 52604
- Timestamp:
- 01/19/2022 12:15:13 PM (23 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r52398 r52604 2939 2939 } 2940 2940 2941 /** 2942 * Filter whether to send the retrieve password email. 2943 * 2944 * @since 6.0.0 2945 * 2946 * @param bool $send False to prevent sending. Default: true 2947 */ 2948 if ( ! apply_filters( 'send_retrieve_password_email', true ) ) { 2949 return true; 2950 } 2951 2941 2952 // Redefining user_login ensures we return the right case in the email. 2942 2953 $user_login = $user_data->user_login; … … 3013 3024 $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); 3014 3025 3026 // Short-circuit on falsey $message value for backwards compatibility. 3027 if ( ! $message ) { 3028 return true; 3029 } 3030 3031 // Wrap the single notification email arguments in an array to pass them to the retrieve_password_notification_email filter. 3032 $defaults = array( 3033 'to' => $user_email, 3034 'subject' => $title, 3035 'message' => $message, 3036 'headers' => '', 3037 ); 3038 3039 $data = compact( 'key', 'user_login', 'user_data' ); 3040 3041 /** 3042 * Filter the contents of the reset password notification email sent to the user. 3043 * 3044 * @since 6.0.0 3045 * 3046 * @param array $defaults { 3047 * The default notification email arguments. Used to build wp_mail(). 3048 * 3049 * @type string $to The intended recipient - user email address. 3050 * @type string $subject The subject of the email. 3051 * @type string $message The body of the email. 3052 * @type string $headers The headers of the email. 3053 * } 3054 * @param array $data { 3055 * Additional information for extenders. 3056 * 3057 * @type string $key The activation key. 3058 * @type string $user_login The username for the user. 3059 * @type WP_User $user_data WP_User object. 3060 * } 3061 */ 3062 $notification_email = apply_filters( 'retrieve_password_notification_email', $defaults, $data ); 3063 3015 3064 if ( $switched_locale ) { 3016 3065 restore_previous_locale(); 3017 3066 } 3018 3067 3019 if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) { 3068 if ( is_array( $notification_email ) ) { 3069 // Force key order and merge defaults in case any value is missing in the filtered array. 3070 $notification_email = array_merge( $defaults, $notification_email ); 3071 } else { 3072 $notification_email = $defaults; 3073 } 3074 3075 list( $to, $subject, $message, $headers ) = array_values( $notification_email ); 3076 3077 $subject = wp_specialchars_decode( $subject ); 3078 3079 if ( ! wp_mail( $to, $subject, $message, $headers ) ) { 3020 3080 $errors->add( 3021 3081 'retrieve_password_email_failure',
Note: See TracChangeset
for help on using the changeset viewer.