diff --git src/wp-login.php src/wp-login.php
index 5266dd7..bf38c36 100644
|
|
function retrieve_password() { |
320 | 320 | return $errors; |
321 | 321 | } |
322 | 322 | |
323 | | // Redefining user_login ensures we return the right case in the email. |
324 | | $user_login = $user_data->user_login; |
325 | | $user_email = $user_data->user_email; |
326 | 323 | $key = get_password_reset_key( $user_data ); |
327 | 324 | |
328 | 325 | if ( is_wp_error( $key ) ) { |
329 | 326 | return $key; |
330 | 327 | } |
331 | 328 | |
332 | | $message = __('Someone has requested a password reset for the following account:') . "\r\n\r\n"; |
333 | | $message .= network_home_url( '/' ) . "\r\n\r\n"; |
334 | | $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; |
335 | | $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n"; |
336 | | $message .= __('To reset your password, visit the following address:') . "\r\n\r\n"; |
337 | | $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n"; |
| 329 | do_action( 'wp_mail_retrieve_password', $user_data, $key ); |
| 330 | return true; |
338 | 331 | |
339 | | if ( is_multisite() ) { |
340 | | $blogname = get_current_site()->site_name; |
341 | | } else { |
| 332 | } |
| 333 | |
| 334 | add_action( 'wp_mail_retrieve_password', 'send_retrieve_password_email', 10, 2 ); |
| 335 | |
| 336 | function send_retrieve_password_email( $user_data, $key ) { |
| 337 | |
| 338 | $user_login = $user_data->user_login; |
| 339 | $user_email = $user_data->user_email; |
| 340 | |
| 341 | $message = __('Someone has requested a password reset for the following account:') . "\r\n\r\n"; |
| 342 | $message .= network_home_url( '/' ) . "\r\n\r\n"; |
| 343 | $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n"; |
| 344 | $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.' ) . "\r\n\r\n"; |
| 345 | $message .= __( 'To reset your password, visit the following address:') . "\r\n\r\n"; |
| 346 | $message .= '<' . network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . ">\r\n"; |
| 347 | |
| 348 | if ( is_multisite() ) |
| 349 | $blogname = $GLOBALS['current_site']->site_name; |
| 350 | else |
342 | 351 | /* |
343 | 352 | * The blogname option is escaped with esc_html on the way into the database |
344 | 353 | * in sanitize_option we want to reverse this for the plain text arena of emails. |
345 | 354 | */ |
346 | | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
347 | | } |
| 355 | $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
348 | 356 | |
349 | | $title = sprintf( __('[%s] Password Reset'), $blogname ); |
| 357 | $title = sprintf( __( '[%s] Password Reset' ), $blogname ); |
350 | 358 | |
351 | 359 | /** |
352 | 360 | * Filters the subject of the password reset email. |
… |
… |
function retrieve_password() { |
376 | 384 | if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) |
377 | 385 | wp_die( __('The email could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') ); |
378 | 386 | |
379 | | return true; |
380 | 387 | } |
381 | 388 | |
382 | 389 | // |