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.


Built from https://develop.svn.wordpress.org/trunk@33620


git-svn-id: http://core.svn.wordpress.org/trunk@33587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Konstantin Obenland 2015-08-17 14:25:27 +00:00
parent 52a7082d11
commit e6bc6242ad
7 changed files with 16 additions and 9 deletions

View File

@ -176,7 +176,7 @@ function edit_user( $user_id = 0 ) {
$user_id = wp_update_user( $user );
} else {
$user_id = wp_insert_user( $user );
wp_new_user_notification( $user_id );
wp_new_user_notification( $user_id, 'both' );
}
return $user_id;
}

View File

@ -79,7 +79,7 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
if ( false === $user_id )
wp_die( __( 'There was an error creating the user.' ) );
else
wp_new_user_notification( $user_id, $password );
wp_new_user_notification( $user_id, 'both' );
}
$wpdb->hide_errors();

View File

@ -77,7 +77,7 @@ if ( $action ) {
if ( false === $user_id ) {
$update = 'err_new_dup';
} 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'] );
$update = 'newuser';
}

View File

@ -51,7 +51,7 @@ if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) {
if ( ! $user_id ) {
$add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
} 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' ) );
exit;
}

View File

@ -1688,10 +1688,13 @@ if ( !function_exists('wp_new_user_notification') ) :
* A new user registration notification is also sent to admin email.
*
* @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;
$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);
if ( 'admin' === $notify || empty( $notify ) ) {
return;
}
// Generate something random for a password reset key.
$key = wp_generate_password( 20, false );
/** This action is documented in wp-login.php */
do_action( 'retrieve_password_key', $user->user_login, $key );
// 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";
wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
}
endif;

View File

@ -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.
wp_new_user_notification( $user_id );
wp_new_user_notification( $user_id, 'both' );
return $user_id;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-RC2-33619';
$wp_version = '4.3-RC2-33620';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.