Changeset 51398 for trunk/src/wp-includes/user.php
- Timestamp:
- 07/10/2021 12:00:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r51353 r51398 2239 2239 $user_id = wp_insert_user( $userdata ); 2240 2240 2241 if ( ! is_wp_error( $user_id ) ) { 2242 2243 $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 2244 2245 $switched_locale = false; 2246 if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) { 2247 $switched_locale = switch_to_locale( get_user_locale( $user_id ) ); 2248 } 2249 2250 if ( ! empty( $send_password_change_email ) ) { 2251 /* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2252 $pass_change_text = __( 2253 'Hi ###USERNAME###, 2241 if ( is_wp_error( $user_id ) ) { 2242 return $user_id; 2243 } 2244 2245 $blog_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); 2246 2247 $switched_locale = false; 2248 if ( ! empty( $send_password_change_email ) || ! empty( $send_email_change_email ) ) { 2249 $switched_locale = switch_to_locale( get_user_locale( $user_id ) ); 2250 } 2251 2252 if ( ! empty( $send_password_change_email ) ) { 2253 /* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2254 $pass_change_text = __( 2255 'Hi ###USERNAME###, 2254 2256 2255 2257 This notice confirms that your password was changed on ###SITENAME###. … … 2263 2265 All at ###SITENAME### 2264 2266 ###SITEURL###' 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2267 ); 2268 2269 $pass_change_email = array( 2270 'to' => $user['user_email'], 2271 /* translators: Password change notification email subject. %s: Site title. */ 2272 'subject' => __( '[%s] Password Changed' ), 2273 'message' => $pass_change_text, 2274 'headers' => '', 2275 ); 2276 2277 /** 2278 * Filters the contents of the email sent when the user's password is changed. 2279 * 2280 * @since 4.3.0 2281 * 2282 * @param array $pass_change_email { 2283 * Used to build wp_mail(). 2284 * 2285 * @type string $to The intended recipients. Add emails in a comma separated string. 2286 * @type string $subject The subject of the email. 2287 * @type string $message The content of the email. 2288 * The following strings have a special meaning and will get replaced dynamically: 2289 * - ###USERNAME### The current user's username. 2290 * - ###ADMIN_EMAIL### The admin email in case this was unexpected. 2291 * - ###EMAIL### The user's email address. 2292 * - ###SITENAME### The name of the site. 2293 * - ###SITEURL### The URL to the site. 2294 * @type string $headers Headers. Add headers in a newline (\r\n) separated string. 2295 * } 2296 * @param array $user The original user array. 2297 * @param array $userdata The updated user array. 2298 */ 2299 $pass_change_email = apply_filters( 'password_change_email', $pass_change_email, $user, $userdata ); 2300 2301 $pass_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $pass_change_email['message'] ); 2302 $pass_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $pass_change_email['message'] ); 2303 $pass_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $pass_change_email['message'] ); 2304 $pass_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $pass_change_email['message'] ); 2305 $pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] ); 2306 2307 wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] ); 2308 } 2309 2310 if ( ! empty( $send_email_change_email ) ) { 2311 /* translators: Do not translate USERNAME, ADMIN_EMAIL, NEW_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 2312 $email_change_text = __( 2313 'Hi ###USERNAME###, 2312 2314 2313 2315 This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###. … … 2321 2323 All at ###SITENAME### 2322 2324 ###SITEURL###' 2323 ); 2324 2325 $email_change_email = array( 2326 'to' => $user['user_email'], 2327 /* translators: Email change notification email subject. %s: Site title. */ 2328 'subject' => __( '[%s] Email Changed' ), 2329 'message' => $email_change_text, 2330 'headers' => '', 2331 ); 2332 2333 /** 2334 * Filters the contents of the email sent when the user's email is changed. 2335 * 2336 * @since 4.3.0 2337 * 2338 * @param array $email_change_email { 2339 * Used to build wp_mail(). 2340 * 2341 * @type string $to The intended recipients. 2342 * @type string $subject The subject of the email. 2343 * @type string $message The content of the email. 2344 * The following strings have a special meaning and will get replaced dynamically: 2345 * - ###USERNAME### The current user's username. 2346 * - ###ADMIN_EMAIL### The admin email in case this was unexpected. 2347 * - ###NEW_EMAIL### The new email address. 2348 * - ###EMAIL### The old email address. 2349 * - ###SITENAME### The name of the site. 2350 * - ###SITEURL### The URL to the site. 2351 * @type string $headers Headers. 2352 * } 2353 * @param array $user The original user array. 2354 * @param array $userdata The updated user array. 2355 */ 2356 $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata ); 2357 2358 $email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] ); 2359 $email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] ); 2360 $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] ); 2361 $email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] ); 2362 $email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] ); 2363 $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); 2364 2365 wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] ); 2366 } 2367 2368 if ( $switched_locale ) { 2369 restore_previous_locale(); 2370 } 2325 ); 2326 2327 $email_change_email = array( 2328 'to' => $user['user_email'], 2329 /* translators: Email change notification email subject. %s: Site title. */ 2330 'subject' => __( '[%s] Email Changed' ), 2331 'message' => $email_change_text, 2332 'headers' => '', 2333 ); 2334 2335 /** 2336 * Filters the contents of the email sent when the user's email is changed. 2337 * 2338 * @since 4.3.0 2339 * 2340 * @param array $email_change_email { 2341 * Used to build wp_mail(). 2342 * 2343 * @type string $to The intended recipients. 2344 * @type string $subject The subject of the email. 2345 * @type string $message The content of the email. 2346 * The following strings have a special meaning and will get replaced dynamically: 2347 * - ###USERNAME### The current user's username. 2348 * - ###ADMIN_EMAIL### The admin email in case this was unexpected. 2349 * - ###NEW_EMAIL### The new email address. 2350 * - ###EMAIL### The old email address. 2351 * - ###SITENAME### The name of the site. 2352 * - ###SITEURL### The URL to the site. 2353 * @type string $headers Headers. 2354 * } 2355 * @param array $user The original user array. 2356 * @param array $userdata The updated user array. 2357 */ 2358 $email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata ); 2359 2360 $email_change_email['message'] = str_replace( '###USERNAME###', $user['user_login'], $email_change_email['message'] ); 2361 $email_change_email['message'] = str_replace( '###ADMIN_EMAIL###', get_option( 'admin_email' ), $email_change_email['message'] ); 2362 $email_change_email['message'] = str_replace( '###NEW_EMAIL###', $userdata['user_email'], $email_change_email['message'] ); 2363 $email_change_email['message'] = str_replace( '###EMAIL###', $user['user_email'], $email_change_email['message'] ); 2364 $email_change_email['message'] = str_replace( '###SITENAME###', $blog_name, $email_change_email['message'] ); 2365 $email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] ); 2366 2367 wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] ); 2368 } 2369 2370 if ( $switched_locale ) { 2371 restore_previous_locale(); 2371 2372 } 2372 2373
Note: See TracChangeset
for help on using the changeset viewer.