WordPress.org

Make WordPress Core

Ticket #33504: 33504.3.diff

File 33504.3.diff, 2.0 KB (added by tharsheblows, 5 years ago)

refreshed patch with checkbox checked as default to send email

  • 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                wp_new_user_notification( $user_id, null, isset( $_POST['send_reset_link'] ) ? 'both' : 'admin' );
    180180        }
    181181        return $user_id;
    182182}
     
    503503
    504504Please click the following link to activate your user account:
    505505%%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) );
    506 }
    507  No newline at end of file
     506}
  • 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$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?>
     
    445445                        </label>
    446446                </td>
    447447        </tr>
     448        <tr>
     449                <th scope="row"><label for="send_reset_link"><?php _e('') ?></label></th>
     450                <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>
     451        </tr>
    448452<?php endif; ?>
    449453<?php } // !is_multisite ?>
    450454        <tr class="form-field">