Make WordPress Core


Ignore:
Timestamp:
01/20/2010 09:58:13 PM (16 years ago)
Author:
ryan
Message:

Add email and login dupe checking down into wp_insert_user(). Tidy up user-new.php. see #11644

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-new.php

    r12764 r12778  
    6363            $username = $user_details->user_login;
    6464            $user_id = $user_details->ID;
    65             if ( ($username != null && is_site_admin( $username ) == false ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
     65            if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
    6666                $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' );
    6767            } else {
    68                 if ( isset( $_POST[ 'noconfirmation' ] ) && is_site_admin() ) {
     68                if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
    6969                    add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
    7070                    $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
     
    185185?>
    186186<table class="form-table">
    187 <?php if ( !is_multisite() ) { ?>
    188187    <tr class="form-field form-required">
    189188        <th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label>
     
    191190        <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td>
    192191    </tr>
    193     <tr class="form-field">
    194         <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
    195         <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
    196     </tr>
    197     <tr class="form-field">
    198         <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
    199         <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td>
    200     </tr>
    201192    <tr class="form-field form-required">
    202193        <th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
    203194        <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td>
    204195    </tr>
     196<?php if ( !is_multisite() ) { ?>
     197    <tr class="form-field">
     198        <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
     199        <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
     200    </tr>
     201    <tr class="form-field">
     202        <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
     203        <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td>
     204    </tr>
    205205    <tr class="form-field">
    206206        <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
    207207        <td><input name="url" type="text" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td>
    208208    </tr>
    209 
    210209<?php if ( apply_filters('show_password_fields', true) ) : ?>
    211210    <tr class="form-field form-required">
     
    224223    </tr>
    225224<?php endif; ?>
    226 <?php } else { // multisite ?>
    227     <tr class="form-field form-required">
    228         <th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th>
    229         <td ><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" aria-required="true" /></td>
    230     </tr>
    231     <tr class="form-field form-required">
    232         <th scope="row"><label for="email"><?php _e('E-mail (required)') ?></label></th>
    233         <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
    234     </tr>
    235 <?php } ?>
     225<?php } // !is_multisite ?>
    236226    <tr class="form-field">
    237227        <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
     
    245235        </td>
    246236    </tr>
    247 
    248237    <?php if ( is_multisite() && is_super_admin() ) { ?>
    249     <tr class="form-field">
     238    <tr>
    250239        <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
    251         <td><input name="noconfirmation" type="checkbox" id="noconfirmation" value="1" /> <label for="noconfirmation"><?php _e( 'Site administrators can add a user without sending the confirmation email.' ); ?></label></td>
     240        <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" /> <?php _e( 'Site administrators can add a user without sending the confirmation email.' ); ?></label></td>
    252241    </tr>
    253242    <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.