diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index a6f4a21e45..8174eeaf63 100644
a
|
b
|
function wp_ajax_send_password_reset() { |
5425 | 5425 | |
5426 | 5426 | // Send the password reset link. |
5427 | 5427 | $user = get_userdata( $user_id ); |
5428 | | $results = retrieve_password( $user->user_login ); |
| 5428 | $results = retrieve_password( $user->user_login, 'send_password_reset_from_admin' ); |
5429 | 5429 | |
5430 | 5430 | if ( true === $results ) { |
5431 | 5431 | wp_send_json_success( |
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 5c6db55afb..6e8a024233 100644
a
|
b
|
function check_password_reset_key( $key, $login ) { |
2666 | 2666 | * |
2667 | 2667 | * @param string $user_login Optional. Username to send a password retrieval email for. |
2668 | 2668 | * Defaults to `$_POST['user_login']` if not set. |
| 2669 | * @param string $context Optional. Context to send a password retrieval email for. |
| 2670 | * Used to avoid sending the Admin IP address when the password |
| 2671 | * reset was not asked by the user. |
2669 | 2672 | * @return true|WP_Error True when finished, WP_Error object on error. |
2670 | 2673 | */ |
2671 | | function retrieve_password( $user_login = null ) { |
| 2674 | function retrieve_password( $user_login = null, $context = '' ) { |
2672 | 2675 | $errors = new WP_Error(); |
2673 | 2676 | $user_data = false; |
2674 | 2677 | |
… |
… |
function retrieve_password( $user_login = null ) { |
2768 | 2771 | $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n"; |
2769 | 2772 | $message .= network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . "\r\n\r\n"; |
2770 | 2773 | |
2771 | | $requester_ip = $_SERVER['REMOTE_ADDR']; |
2772 | | if ( $requester_ip ) { |
2773 | | $message .= sprintf( |
2774 | | /* translators: %s: IP address of password reset requester. */ |
2775 | | __( 'This password reset request originated from the IP address %s.' ), |
2776 | | $requester_ip |
2777 | | ) . "\r\n"; |
| 2774 | if ( 'send_password_reset_from_admin' !== $context ) { |
| 2775 | $requester_ip = $_SERVER['REMOTE_ADDR']; |
| 2776 | if ( $requester_ip ) { |
| 2777 | $message .= sprintf( |
| 2778 | /* translators: %s: IP address of password reset requester. */ |
| 2779 | __( 'This password reset request originated from the IP address %s.' ), |
| 2780 | $requester_ip |
| 2781 | ) . "\r\n"; |
| 2782 | } |
2778 | 2783 | } |
2779 | 2784 | |
2780 | 2785 | /* translators: Password reset notification email subject. %s: Site title. */ |