WordPress.org

Make WordPress Core

Changeset 33620


Ignore:
Timestamp:
08/17/2015 02:24:43 PM (4 years ago)
Author:
obenland
Message:

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.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/user.php

    r33601 r33620  
    177177    } else {
    178178        $user_id = wp_insert_user( $user );
    179         wp_new_user_notification( $user_id );
     179        wp_new_user_notification( $user_id, 'both' );
    180180    }
    181181    return $user_id;
  • trunk/src/wp-admin/network/site-new.php

    r33082 r33620  
    8080            wp_die( __( 'There was an error creating the user.' ) );
    8181        else
    82             wp_new_user_notification( $user_id, $password );
     82            wp_new_user_notification( $user_id, 'both' );
    8383    }
    8484
  • trunk/src/wp-admin/network/site-users.php

    r33603 r33620  
    7878                    $update = 'err_new_dup';
    7979                } else {
    80                     wp_new_user_notification( $user_id, $password );
     80                    wp_new_user_notification( $user_id, 'both' );
    8181                    add_user_to_blog( $id, $user_id, $_POST['new_role'] );
    8282                    $update = 'newuser';
  • trunk/src/wp-admin/network/user-new.php

    r33494 r33620  
    5252            $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) );
    5353        } else {
    54             wp_new_user_notification( $user_id, $password );
     54            wp_new_user_notification( $user_id, 'both' );
    5555            wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
    5656            exit;
  • trunk/src/wp-includes/pluggable.php

    r33246 r33620  
    16891689 *
    16901690 * @since 2.0.0
    1691  *
    1692  * @param int    $user_id        User ID.
    1693  */
    1694 function wp_new_user_notification($user_id) {
     1691 * @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
     1692 *
     1693 * @param int    $user_id User ID.
     1694 * @param string $notify  Whether admin and user should be notified ('both') or
     1695 *                        only the admin ('admin' or empty).
     1696 */
     1697function wp_new_user_notification( $user_id, $notify = '' ) {
    16951698    global $wpdb;
    16961699    $user = get_userdata( $user_id );
     
    17061709    @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
    17071710
     1711    if ( 'admin' === $notify || empty( $notify ) ) {
     1712        return;
     1713    }
     1714
    17081715    // Generate something random for a password reset key.
    17091716    $key = wp_generate_password( 20, false );
    17101717
     1718    /** This action is documented in wp-login.php */
    17111719    do_action( 'retrieve_password_key', $user->user_login, $key );
    17121720
     
    17261734
    17271735    wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
    1728 
    17291736}
    17301737endif;
  • trunk/src/wp-includes/user.php

    r33486 r33620  
    26202620    update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
    26212621
    2622     wp_new_user_notification( $user_id );
     2622    wp_new_user_notification( $user_id, 'both' );
    26232623
    26242624    return $user_id;
Note: See TracChangeset for help on using the changeset viewer.