Ticket #15456: user-new-form-updates.diff
File user-new-form-updates.diff, 4.4 KB (added by , 14 years ago) |
---|
-
wp-admin/user-new.php
222 222 $label = __('E-mail or Username'); 223 223 } 224 224 ?> 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');?>> 226 226 <input name="action" type="hidden" id="action" value="adduser" /> 227 227 <?php wp_nonce_field('add-user') ?> 228 <?php 229 // Load up the passed data, else set to a default. 230 foreach ( array('email' => 'email', 'role' => 'role') as $post_field => $var ) { 231 $var = "existing_user_$var"; 232 $$var = false; 233 } 234 $existing_user_ignore_pass = ''; 235 ?> 236 228 237 <table class="form-table"> 229 238 <tr class="form-field form-required"> 230 239 <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>240 <td><input name="email" type="text" id="email" value="<?php echo esc_attr($existing_user_email); ?>" /></td> 232 241 </tr> 233 242 <tr class="form-field"> 234 243 <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> 235 244 <td><select name="role" id="role"> 236 245 <?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);246 if ( !$existing_user_role ) 247 $existing_user_role = !empty($current_role) ? $current_role : get_option('default_role'); 248 wp_dropdown_roles($existing_user_role); 240 249 ?> 241 250 </select> 242 251 </td> … … 244 253 <?php if ( is_super_admin() ) { ?> 245 254 <tr> 246 255 <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> 247 <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>256 <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked($existing_user_ignore_pass, true); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> 248 257 </tr> 249 258 <?php } ?> 250 259 </table> … … 258 267 echo '<h3 id="create-new-user">' . __('Create New User') . '</h3>'; 259 268 ?> 260 269 <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');?>>270 <form action="" method="post" name="createuser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> 262 271 <input name="action" type="hidden" id="action" value="createuser" /> 263 272 <?php wp_nonce_field('create-user') ?> 264 273 <?php … … 266 275 foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', 267 276 'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) { 268 277 $var = "new_user_$var"; 269 if ( ! isset($$var) ) 270 $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : ''; 278 if(isset($_POST['createuser'])) { 279 if ( ! isset($$var) ) 280 $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : ''; 281 } else { 282 $$var = ''; 283 } 271 284 } 272 $new_user_send_password = !$_POST || isset($_POST['send_password']); 285 if(isset($_POST['createuser'])) { 286 $new_user_send_password = !$_POST || isset($_POST['send_password']); 287 $new_user_ignore_pass = !$_POST || isset($_POST['noconfirmation']); 288 } else { 289 $new_user_send_password = ''; 290 $new_user_ignore_pass = ''; 291 } 273 292 ?> 274 293 <table class="form-table"> 275 294 <tr class="form-field form-required"> … … 324 343 <?php if ( is_multisite() && is_super_admin() ) { ?> 325 344 <tr> 326 345 <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>346 <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked($new_user_ignore_pass, true); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> 328 347 </tr> 329 348 <?php } ?> 330 349 </table>