WordPress.org

Make WordPress Core

Ticket #15456: user-new-changes-updated.diff

File user-new-changes-updated.diff, 4.2 KB (added by wpdavis, 3 years ago)

Removed the existing_user_ variables, as they actually aren't needed

  • wp-admin/user-new.php

     
    222222                $label = __('E-mail or Username'); 
    223223        } 
    224224?> 
    225 <form action="#add-existing-user" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> 
     225<form action="" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> 
    226226<input name="action" type="hidden" id="action" value="adduser" /> 
    227227<?php wp_nonce_field('add-user') ?> 
     228 
    228229<table class="form-table"> 
    229230        <tr class="form-field form-required"> 
    230231                <th scope="row"><label for="email"><?php echo $label; ?></label></th> 
    231                 <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td> 
     232                <td><input name="email" type="text" id="email" value="" /></td> 
    232233        </tr> 
    233234        <tr class="form-field"> 
    234235                <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> 
    235236                <td><select name="role" id="role"> 
    236                         <?php 
    237                         if ( !$new_user_role ) 
    238                                 $new_user_role = !empty($current_role) ? $current_role : get_option('default_role'); 
    239                         wp_dropdown_roles($new_user_role); 
    240                         ?> 
     237                        <?php wp_dropdown_roles( get_option('default_role') ); ?> 
    241238                        </select> 
    242239                </td> 
    243240        </tr> 
     
    255252 
    256253if ( current_user_can( 'create_users') ) { 
    257254        if ( $do_both ) 
    258                 echo '<h3 id="create-new-user">' . __('Create New User') . '</h3>'; 
     255                echo '<h3 id="create-new-user">' . __( 'Create New User' ) . '</h3>'; 
    259256?> 
    260257<p><?php _e('Create a brand new user and add it to this site.'); ?></p> 
    261 <form action="#create-new-user" method="post" name="createuser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> 
     258<form action="" method="post" name="createuser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> 
    262259<input name="action" type="hidden" id="action" value="createuser" /> 
    263260<?php wp_nonce_field('create-user') ?> 
    264261<?php 
    265262// Load up the passed data, else set to a default. 
    266 foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', 
    267                                 'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) { 
     263foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', 
     264                                'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) { 
    268265        $var = "new_user_$var"; 
    269         if ( ! isset($$var) ) 
    270                 $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : ''; 
     266        if( isset( $_POST['createuser'] ) ) { 
     267                if ( ! isset($$var) ) 
     268                        $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : ''; 
     269        } else { 
     270                $$var = false; 
     271        } 
    271272} 
    272 $new_user_send_password = !$_POST || isset($_POST['send_password']); 
     273 
    273274?> 
    274275<table class="form-table"> 
    275276        <tr class="form-field form-required"> 
     
    306307        </tr> 
    307308        <tr> 
    308309                <th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th> 
    309                 <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked($new_user_send_password, true); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td> 
     310                <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td> 
    310311        </tr> 
    311312<?php endif; ?> 
    312313<?php } // !is_multisite ?> 
     
    324325        <?php if ( is_multisite() && is_super_admin() ) { ?> 
    325326        <tr> 
    326327                <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> 
    327                 <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> 
     328                <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1"  <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> 
    328329        </tr> 
    329330        <?php } ?> 
    330331</table>