-//Load up the passed data, else set to a default.
-foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
- 'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
- $var = "new_user_$var";
- if ( ! isset($$var) )
- $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
-}
-$new_user_send_password = !$_POST || isset($_POST['send_password']);
+/**
+ * Fires inside the adduser form tag.
+ *
+ * @since 3.0.0
+ */
+?>
+<form action="" method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"<?php do_action( 'user_new_form_tag' );?>>
+<input name="action" type="hidden" value="adduser" />
+<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
+
+<table class="form-table">
+ <tr class="form-field form-required">
+ <th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th>
+ <td><input name="email" type="<?php echo $type; ?>" id="adduser-email" class="wp-suggest-user" value="" /></td>
+ </tr>
+ <tr class="form-field">
+ <th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th>
+ <td><select name="role" id="adduser-role">
+ <?php wp_dropdown_roles( get_option('default_role') ); ?>
+ </select>
+ </td>
+ </tr>
+<?php if ( is_super_admin() ) { ?>
+ <tr>
+ <th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
+ <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
+ </tr>
+<?php } ?>
+</table>
+<?php
+/**
+ * Fires at the end of the new user form.
+ *
+ * Passes a contextual string to make both types of new user forms
+ * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
+ * and 'add-new-user' (single site and network admin).
+ *
+ * @since 3.7.0
+ *
+ * @param string $type A contextual string specifying which type of new user form the hook follows.
+ */
+do_action( 'user_new_form', 'add-existing-user' );
+?>
+<?php submit_button( __( 'Add Existing User '), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
+</form>
+<?php
+} // is_multisite()
+
+if ( current_user_can( 'create_users') ) {
+ if ( $do_both )
+ echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>';
+?>
+<p><?php _e('Create a brand new user and add them to this site.'); ?></p>
+<?php /** This action is documented in wp-admin/user-new.php */ ?>
+<form action="" method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php do_action( 'user_new_form_tag' );?>>
+<input name="action" type="hidden" value="createuser" />
+<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
+<?php
+// Load up the passed data, else set to a default.
+$creating = isset( $_POST['createuser'] );
+
+$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
+$new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
+$new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
+$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
+$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
+$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
+$new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : '';
+$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
+