Passwords: Restore second parameter for wp_new_user_notification()
.
After [33023] users would always be notified, this restores previous behavior. Props markjaquith, ocean90. Fixes #33358. git-svn-id: https://develop.svn.wordpress.org/trunk@33620 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9c70cea98f
commit
e7a203cdf2
@ -176,7 +176,7 @@ function edit_user( $user_id = 0 ) {
|
|||||||
$user_id = wp_update_user( $user );
|
$user_id = wp_update_user( $user );
|
||||||
} else {
|
} else {
|
||||||
$user_id = wp_insert_user( $user );
|
$user_id = wp_insert_user( $user );
|
||||||
wp_new_user_notification( $user_id );
|
wp_new_user_notification( $user_id, 'both' );
|
||||||
}
|
}
|
||||||
return $user_id;
|
return $user_id;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
|
|||||||
if ( false === $user_id )
|
if ( false === $user_id )
|
||||||
wp_die( __( 'There was an error creating the user.' ) );
|
wp_die( __( 'There was an error creating the user.' ) );
|
||||||
else
|
else
|
||||||
wp_new_user_notification( $user_id, $password );
|
wp_new_user_notification( $user_id, 'both' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpdb->hide_errors();
|
$wpdb->hide_errors();
|
||||||
|
@ -77,7 +77,7 @@ if ( $action ) {
|
|||||||
if ( false === $user_id ) {
|
if ( false === $user_id ) {
|
||||||
$update = 'err_new_dup';
|
$update = 'err_new_dup';
|
||||||
} else {
|
} else {
|
||||||
wp_new_user_notification( $user_id, $password );
|
wp_new_user_notification( $user_id, 'both' );
|
||||||
add_user_to_blog( $id, $user_id, $_POST['new_role'] );
|
add_user_to_blog( $id, $user_id, $_POST['new_role'] );
|
||||||
$update = 'newuser';
|
$update = 'newuser';
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) {
|
|||||||
if ( ! $user_id ) {
|
if ( ! $user_id ) {
|
||||||
$add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
|
$add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
|
||||||
} else {
|
} else {
|
||||||
wp_new_user_notification( $user_id, $password );
|
wp_new_user_notification( $user_id, 'both' );
|
||||||
wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
|
wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -1688,10 +1688,13 @@ if ( !function_exists('wp_new_user_notification') ) :
|
|||||||
* A new user registration notification is also sent to admin email.
|
* A new user registration notification is also sent to admin email.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
|
* @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
|
||||||
*
|
*
|
||||||
* @param int $user_id User ID.
|
* @param int $user_id User ID.
|
||||||
|
* @param string $notify Whether admin and user should be notified ('both') or
|
||||||
|
* only the admin ('admin' or empty).
|
||||||
*/
|
*/
|
||||||
function wp_new_user_notification($user_id) {
|
function wp_new_user_notification( $user_id, $notify = '' ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$user = get_userdata( $user_id );
|
$user = get_userdata( $user_id );
|
||||||
|
|
||||||
@ -1705,9 +1708,14 @@ function wp_new_user_notification($user_id) {
|
|||||||
|
|
||||||
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
|
@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
|
||||||
|
|
||||||
|
if ( 'admin' === $notify || empty( $notify ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate something random for a password reset key.
|
// Generate something random for a password reset key.
|
||||||
$key = wp_generate_password( 20, false );
|
$key = wp_generate_password( 20, false );
|
||||||
|
|
||||||
|
/** This action is documented in wp-login.php */
|
||||||
do_action( 'retrieve_password_key', $user->user_login, $key );
|
do_action( 'retrieve_password_key', $user->user_login, $key );
|
||||||
|
|
||||||
// Now insert the key, hashed, into the DB.
|
// Now insert the key, hashed, into the DB.
|
||||||
@ -1725,7 +1733,6 @@ function wp_new_user_notification($user_id) {
|
|||||||
$message .= wp_login_url() . "\r\n";
|
$message .= wp_login_url() . "\r\n";
|
||||||
|
|
||||||
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
|
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
|
||||||
|
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
@ -2619,7 +2619,7 @@ function register_new_user( $user_login, $user_email ) {
|
|||||||
|
|
||||||
update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
|
update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
|
||||||
|
|
||||||
wp_new_user_notification( $user_id );
|
wp_new_user_notification( $user_id, 'both' );
|
||||||
|
|
||||||
return $user_id;
|
return $user_id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user