Make WordPress Core

Ticket #33504: 33504.7.trunk.diff

File 33504.7.trunk.diff, 3.7 KB (added by SergeyBiryukov, 10 years ago)
  • src/wp-admin/includes/user.php

     
    176176                $user_id = wp_update_user( $user );
    177177        } else {
    178178                $user_id = wp_insert_user( $user );
     179                $notify  = ( isset( $_POST['send_reset_link'] ) ) ? 'both' : 'admin';
     180
    179181                /**
    180182                  * Fires after a new user has been created.
    181183                  *
    182184                  * @since 4.4.0
    183185                  *
    184                   * @param int $user_id ID of the newly created user.
     186                  * @param int    $user_id ID of the newly created user.
     187                  * @param string $notify  Type of notification that should happen. See {@see wp_new_user_notification()}
     188                  *                        for more information on accepted arguments.
    185189                  */
    186                 do_action( 'edit_user_created_user', $user_id );
     190                do_action( 'edit_user_created_user', $user_id, $notify );
    187191        }
    188192        return $user_id;
    189193}
  • src/wp-admin/user-new.php

     
    368368$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
    369369$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    370370$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
    371 $new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true;
     371$new_user_send_reset_link = $creating && ! isset( $_POST['send_reset_link'] ) ? false : true;
    372372$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
    373373
    374374?>
     
    436436                        </label>
    437437                </td>
    438438        </tr>
     439        <tr>
     440                <th scope="row"><?php _e( 'Send Reset Link?' ) ?></th>
     441                <td><label for="send_reset_link"><input type="checkbox" name="send_reset_link" id="send_reset_link" value="1" <?php checked( $new_user_send_reset_link ); ?> /> <?php _e( 'Send the new user a password reset link.' ); ?></label></td>
     442        </tr>
    439443<?php } // !is_multisite ?>
    440444        <tr class="form-field">
    441445                <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
  • src/wp-includes/default-filters.php

     
    357357add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
    358358add_action( 'after_password_reset', 'wp_password_change_notification' );
    359359add_action( 'register_new_user',      'wp_send_new_user_notifications' );
    360 add_action( 'edit_user_created_user', 'wp_send_new_user_notifications' );
     360add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
    361361
    362362// REST API actions.
    363363add_action( 'init',          'rest_api_init' );
  • src/wp-includes/user-functions.php

     
    21992199 *
    22002200 * @since 4.4.0
    22012201 *
    2202  * @param int $user_id ID of the newly created user.
     2202 * @param int    $user_id ID of the newly created user.
     2203 * @param string $notify  Type of notification that should happen. See {@see wp_new_user_notification()}
     2204 *                        for more information on accepted arguments. Default 'both'.
    22032205 */
    2204 function wp_send_new_user_notifications( $user_id ) {
    2205         wp_new_user_notification( $user_id, null, 'both' );
     2206function wp_send_new_user_notifications( $user_id, $notify = 'both' ) {
     2207        wp_new_user_notification( $user_id, null, $notify );
    22062208}
    22072209
    22082210/**