Make WordPress Core


Ignore:
Timestamp:
04/21/2016 10:19:42 AM (8 years ago)
Author:
SergeyBiryukov
Message:

Users: In wp_new_user_notification(), sdd 'user' option for the $notify parameter, which allows for sending notification only to the user created.

Props akibjorklund.
Fixes #36009.

File:
1 edited

Legend:

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

    r37030 r37276  
    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.
     
    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 = '' ) {
     
    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";
    1718 
    1719     @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     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";
     1720
     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.
Note: See TracChangeset for help on using the changeset viewer.