WordPress.org

Make WordPress Core

Ticket #36009: 36009.2.diff

File 36009.2.diff, 2.3 KB (added by akibjorklund, 5 years ago)
  • src/wp-includes/pluggable.php

     
    16911691 * @since 2.0.0
    16921692 * @since 4.3.0 The `$plaintext_pass` parameter was changed to `$notify`.
    16931693 * @since 4.3.1 The `$plaintext_pass` parameter was deprecated. `$notify` added as a third parameter.
     1694 * @since 4.6.0 The `$notify` parameter accepts 'user' for sending notification only to the user created.
    16941695 *
    16951696 * @global wpdb         $wpdb      WordPress database object for queries.
    16961697 * @global PasswordHash $wp_hasher Portable PHP password hashing framework instance.
     
    16981699 * @param int    $user_id    User ID.
    16991700 * @param null   $deprecated Not used (argument deprecated).
    17001701 * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
    1701  *                           string (admin only), or 'both' (admin and user). Default empty.
     1702 *                           string (admin only), 'user', or 'both' (admin and user). Default empty.
    17021703 */
    17031704function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
    17041705        if ( $deprecated !== null ) {
     
    17121713        // we want to reverse this for the plain text arena of emails.
    17131714        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    17141715
    1715         $message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
    1716         $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
    1717         $message .= sprintf(__('Email: %s'), $user->user_email) . "\r\n";
     1716        if ( 'user' !== $notify ) {
     1717                $message  = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
     1718                $message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
     1719                $message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";
    17181720
    1719         @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     1721                @wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message );
     1722        }
    17201723
    17211724        // `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
    17221725        if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {