Simplify the markup and hierarchy of the Add Existing and Add New user forms on site-users.php. props obenland, fixes #21223.

git-svn-id: http://core.svn.wordpress.org/trunk@21854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-15 19:38:23 +00:00
parent 923b3e8e0e
commit d91ae96dc9
1 changed files with 11 additions and 19 deletions

View File

@ -238,7 +238,7 @@ endif; ?>
<?php $wp_list_table->views(); ?> <?php $wp_list_table->views(); ?>
<form method="post" action="site-users.php?action=update-site"> <form method="post" action="site-users.php?action=update-site" class="site-users">
<?php wp_nonce_field( 'edit-site' ); ?> <?php wp_nonce_field( 'edit-site' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
@ -249,13 +249,7 @@ endif; ?>
<?php do_action( 'network_site_users_after_list_table', '' );?> <?php do_action( 'network_site_users_after_list_table', '' );?>
<?php if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) : ?> <?php if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) : ?>
<h4 id="add-user"><?php _e('Add User to This Site') ?></h4> <h3 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h3>
<?php if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?>
<p><?php _e( 'You may add from existing network users, or set up a new user to add to this site.' ); ?></p>
<?php else : ?>
<p><?php _e( 'You may add from existing network users to this site.' ); ?></p>
<?php endif; ?>
<h5 id="add-existing-user"><?php _e('Add Existing User') ?></h5>
<form action="site-users.php?action=adduser" id="adduser" method="post"> <form action="site-users.php?action=adduser" id="adduser" method="post">
<?php wp_nonce_field( 'edit-site' ); ?> <?php wp_nonce_field( 'edit-site' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
@ -265,26 +259,25 @@ endif; ?>
<td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td> <td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e( 'Role'); ?></th> <th scope="row"><?php _e( 'Role' ); ?></th>
<td><select name="new_role" id="new_role_0"> <td><select name="new_role" id="new_role_0">
<?php <?php
reset( $editblog_roles ); reset( $editblog_roles );
foreach ( $editblog_roles as $role => $role_assoc ){ foreach ( $editblog_roles as $role => $role_assoc ) {
$name = translate_user_role( $role_assoc['name'] ); $name = translate_user_role( $role_assoc['name'] );
$selected = ( $role == $default_role ) ? 'selected="selected"' : ''; echo '<option ' . selected( $default_role, $role, false ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
} }
?> ?>
</select></td> </select></td>
</tr> </tr>
</table> </table>
<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
<?php submit_button( __('Add User'), 'primary', 'add-user', false, array( 'id' => 'submit-add-existing-user' ) ); ?> <?php submit_button( __( 'Add User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-existing-user' ) ); ?>
</form> </form>
<?php endif; ?> <?php endif; ?>
<?php if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?> <?php if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?>
<h5 id="add-new-user"><?php _e('Add New User') ?></h5> <h3 id="add-new-user"><?php _e( 'Add New User' ); ?></h3>
<form action="<?php echo network_admin_url('site-users.php?action=newuser'); ?>" id="newuser" method="post"> <form action="<?php echo network_admin_url('site-users.php?action=newuser'); ?>" id="newuser" method="post">
<?php wp_nonce_field( 'edit-site' ); ?> <?php wp_nonce_field( 'edit-site' ); ?>
<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
@ -298,14 +291,13 @@ endif; ?>
<td><input type="text" class="regular-text" name="user[email]" /></td> <td><input type="text" class="regular-text" name="user[email]" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e( 'Role'); ?></th> <th scope="row"><?php _e( 'Role' ); ?></th>
<td><select name="new_role" id="new_role_0"> <td><select name="new_role" id="new_role_0">
<?php <?php
reset( $editblog_roles ); reset( $editblog_roles );
foreach ( $editblog_roles as $role => $role_assoc ){ foreach ( $editblog_roles as $role => $role_assoc ) {
$name = translate_user_role( $role_assoc['name'] ); $name = translate_user_role( $role_assoc['name'] );
$selected = ( $role == $default_role ) ? 'selected="selected"' : ''; echo '<option ' . selected( $default_role, $role, false ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
} }
?> ?>
</select></td> </select></td>
@ -315,7 +307,7 @@ endif; ?>
</tr> </tr>
</table> </table>
<?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ) ?> <?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ) ?>
<?php submit_button( __('Add New User'), 'primary', 'add-user', false, array( 'id' => 'submit-add-user' ) ); ?> <?php submit_button( __( 'Add New User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-user' ) ); ?>
</form> </form>
<?php endif; ?> <?php endif; ?>
</div> </div>