diff --git src/wp-admin/network/user-new.php src/wp-admin/network/user-new.php
index 29fd63d..0078943 100644
|
|
if ( ! empty( $messages ) ) { |
76 | 76 | echo '<div id="message" class="updated"><p>' . $msg . '</p></div>'; |
77 | 77 | } |
78 | 78 | |
| 79 | // Pre-fill values in case of a previous failed submission |
| 80 | foreach ( array( 'username', 'email' ) as $post_key ) { |
| 81 | $$post_key = isset( $_POST['user'][ $post_key ] ) ? stripslashes( $_POST['user'][ $post_key ] ) : ''; |
| 82 | } |
| 83 | |
79 | 84 | if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
80 | 85 | <div class="error"> |
81 | 86 | <?php |
… |
… |
if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
88 | 93 | <table class="form-table"> |
89 | 94 | <tr class="form-field form-required"> |
90 | 95 | <th scope="row"><?php _e( 'Username' ) ?></th> |
91 | | <td><input type="text" class="regular-text" name="user[username]" /></td> |
| 96 | <td><input type="text" class="regular-text" name="user[username]" value="<?php echo esc_attr( $username ) ?>" /></td> |
92 | 97 | </tr> |
93 | 98 | <tr class="form-field form-required"> |
94 | 99 | <th scope="row"><?php _e( 'Email' ) ?></th> |
95 | | <td><input type="text" class="regular-text" name="user[email]" /></td> |
| 100 | <td><input type="text" class="regular-text" name="user[email]" value="<?php echo esc_attr( $email ) ?>" /></td> |
96 | 101 | </tr> |
97 | 102 | <tr class="form-field"> |
98 | 103 | <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td> |
diff --git src/wp-admin/user-new.php src/wp-admin/user-new.php
index b5c9c0b..6219188 100644
|
|
if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { |
41 | 41 | check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
42 | 42 | |
43 | 43 | $user_details = null; |
| 44 | $redirect_args = array(); |
| 45 | foreach ( array( 'email', 'role', 'noconfirmation' ) as $redirect_arg ) { |
| 46 | if ( isset( $_REQUEST[ $redirect_arg ] ) ) { |
| 47 | $redirect_args[ $redirect_arg ] = $_REQUEST[ $redirect_arg ]; |
| 48 | } |
| 49 | } |
| 50 | |
44 | 51 | if ( false !== strpos($_REQUEST[ 'email' ], '@') ) { |
45 | 52 | $user_details = get_user_by('email', $_REQUEST[ 'email' ]); |
46 | 53 | } else { |
47 | 54 | if ( is_super_admin() ) { |
48 | 55 | $user_details = get_user_by('login', $_REQUEST[ 'email' ]); |
49 | 56 | } else { |
50 | | wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) ); |
| 57 | $redirect_args['update'] = 'enter_email'; |
| 58 | wp_redirect( add_query_arg( $redirect_args, 'user-new.php' ) ); |
51 | 59 | die(); |
52 | 60 | } |
53 | 61 | } |
54 | 62 | |
55 | 63 | if ( !$user_details ) { |
56 | | wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) ); |
| 64 | $redirect_args['update'] = 'does_not_exist'; |
| 65 | wp_redirect( add_query_arg( $redirect_args, 'user-new.php' ) ); |
57 | 66 | die(); |
58 | 67 | } |
59 | 68 | |
… |
… |
if ( is_multisite() ) { |
290 | 299 | <input name="action" type="hidden" value="adduser" /> |
291 | 300 | <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> |
292 | 301 | |
| 302 | <?php |
| 303 | // Pre-fill values in case of a previous failed submission |
| 304 | foreach ( array( 'email' => 'adduser_email', 'role' => 'adduser_role', 'noconfirmation' => 'adduser_noconfirmation' ) as $adduser_key => $adduser_var ) { |
| 305 | $$adduser_var = isset( $_GET[ $adduser_key ] ) ? urldecode( $_GET[ $adduser_key ] ) : ''; |
| 306 | } |
| 307 | ?> |
| 308 | |
293 | 309 | <table class="form-table"> |
294 | 310 | <tr class="form-field form-required"> |
295 | 311 | <th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th> |
296 | | <td><input name="email" type="text" id="adduser-email" class="wp-suggest-user" value="" /></td> |
| 312 | <td><input name="email" type="text" id="adduser-email" class="wp-suggest-user" value="<?php echo esc_attr( $adduser_email ) ?>" /></td> |
297 | 313 | </tr> |
298 | 314 | <tr class="form-field"> |
299 | 315 | <th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th> |
| 316 | <?php $adduser_role_default = ! empty( $adduser_role ) ? $adduser_role : get_option( 'default_role' ); ?> |
300 | 317 | <td><select name="role" id="adduser-role"> |
301 | | <?php wp_dropdown_roles( get_option('default_role') ); ?> |
| 318 | <?php wp_dropdown_roles( $adduser_role_default ); ?> |
302 | 319 | </select> |
303 | 320 | </td> |
304 | 321 | </tr> |
305 | 322 | <?php if ( is_super_admin() ) { ?> |
306 | 323 | <tr> |
307 | 324 | <th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> |
308 | | <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> |
| 325 | <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" <?php checked( $adduser_noconfirmation, '1' ) ?>/> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td> |
309 | 326 | </tr> |
310 | 327 | <?php } ?> |
311 | 328 | </table> |