WordPress.org

Make WordPress Core

Ticket #33504: 33504.6.branch.diff

File 33504.6.branch.diff, 1.8 KB (added by SergeyBiryukov, 5 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                 wp_new_user_notification( $user_id, null, 'both' );
     179                $notify  = ( isset( $_POST['send_reset_link'] ) ) ? 'both' : 'admin';
     180
     181                wp_new_user_notification( $user_id, null, $notify );
    180182        }
    181183        return $user_id;
    182184}
  • src/wp-admin/user-new.php

     
    355355$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
    356356$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    357357$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
    358 $new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true;
     358$new_user_send_reset_link = $creating && isset( $_POST['send_reset_link'] ) ? wp_unslash( $_POST['send_reset_link'] ) : '';
    359359$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
    360360
    361361?>
     
    432432                        </label>
    433433                </td>
    434434        </tr>
     435        <tr>
     436                <th scope="row"><?php _e( 'Send Reset Link?' ) ?></th>
     437                <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>
     438        </tr>
    435439<?php endif; ?>
    436440<?php } // !is_multisite ?>
    437441        <tr class="form-field">