WordPress.org

Make WordPress Core

Ticket #33504: 33504.2.diff

File 33504.2.diff, 1.7 KB (added by tharsheblows, 5 years ago)

checkbox to send reset link (default checked)

  • 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, 'both' );
     179                wp_new_user_notification( $user_id, isset( $_POST['send_reset_link'] ) ? 'both' : 'admin' );
    180180        }
    181181        return $user_id;
    182182}
  • src/wp-admin/user-new.php

     
    367367$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
    368368$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    369369$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
    370 $new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true;
     370$send_reset_link = $creating && ! isset( $_POST['send_reset_link'] ) ? false : true;
    371371$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
    372372
    373373?>
     
    444444                        </label>
    445445                </td>
    446446        </tr>
     447        <tr>
     448                <th scope="row"><label for="send_reset_link"><?php _e('') ?></label></th>
     449                <td><label for="send_reset_link"><input type="checkbox" name="send_reset_link" id="send_reset_link" value="admin" <?php checked( $send_reset_link ); ?> /> <?php _e('Send a link to the new user by email so they can choose their own password.'); ?></label></td>
     450        </tr>
    447451<?php endif; ?>
    448452<?php } // !is_multisite ?>
    449453        <tr class="form-field">