Make WordPress Core

Changeset 21854


Ignore:
Timestamp:
09/15/2012 07:38:23 PM (12 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/site-users.php

    r21414 r21854  
    239239<?php $wp_list_table->views(); ?>
    240240
    241 <form method="post" action="site-users.php?action=update-site">
     241<form method="post" action="site-users.php?action=update-site" class="site-users">
    242242    <?php wp_nonce_field( 'edit-site' ); ?>
    243243    <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
     
    250250
    251251<?php if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) : ?>
    252 <h4 id="add-user"><?php _e('Add User to This Site') ?></h4>
    253     <?php if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?>
    254 <p><?php _e( 'You may add from existing network users, or set up a new user to add to this site.' ); ?></p>
    255     <?php else : ?>
    256 <p><?php _e( 'You may add from existing network users to this site.' ); ?></p>
    257     <?php endif; ?>
    258 <h5 id="add-existing-user"><?php _e('Add Existing User') ?></h5>
     252<h3 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h3>
    259253<form action="site-users.php?action=adduser" id="adduser" method="post">
    260254    <?php wp_nonce_field( 'edit-site' ); ?>
     
    266260        </tr>
    267261        <tr>
    268             <th scope="row"><?php _e( 'Role'); ?></th>
     262            <th scope="row"><?php _e( 'Role' ); ?></th>
    269263            <td><select name="new_role" id="new_role_0">
    270264            <?php
    271265            reset( $editblog_roles );
    272             foreach ( $editblog_roles as $role => $role_assoc ){
     266            foreach ( $editblog_roles as $role => $role_assoc ) {
    273267                $name = translate_user_role( $role_assoc['name'] );
    274                 $selected = ( $role == $default_role ) ? 'selected="selected"' : '';
    275                 echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
     268                echo '<option ' . selected( $default_role, $role, false ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
    276269            }
    277270            ?>
     
    280273    </table>
    281274    <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
    282     <?php submit_button( __('Add User'), 'primary', 'add-user', false, array( 'id' => 'submit-add-existing-user' ) ); ?>
     275    <?php submit_button( __( 'Add User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-existing-user' ) ); ?>
    283276</form>
    284277<?php endif; ?>
    285278
    286279<?php if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?>
    287 <h5 id="add-new-user"><?php _e('Add New User') ?></h5>
     280<h3 id="add-new-user"><?php _e( 'Add New User' ); ?></h3>
    288281<form action="<?php echo network_admin_url('site-users.php?action=newuser'); ?>" id="newuser" method="post">
    289282    <?php wp_nonce_field( 'edit-site' ); ?>
     
    299292        </tr>
    300293        <tr>
    301             <th scope="row"><?php _e( 'Role'); ?></th>
     294            <th scope="row"><?php _e( 'Role' ); ?></th>
    302295            <td><select name="new_role" id="new_role_0">
    303296            <?php
    304297            reset( $editblog_roles );
    305             foreach ( $editblog_roles as $role => $role_assoc ){
     298            foreach ( $editblog_roles as $role => $role_assoc ) {
    306299                $name = translate_user_role( $role_assoc['name'] );
    307                 $selected = ( $role == $default_role ) ? 'selected="selected"' : '';
    308                 echo '<option ' . $selected . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
     300                echo '<option ' . selected( $default_role, $role, false ) . ' value="' . esc_attr( $role ) . '">' . esc_html( $name ) . '</option>';
    309301            }
    310302            ?>
     
    316308    </table>
    317309    <?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ) ?>
    318     <?php submit_button( __('Add New User'), 'primary', 'add-user', false, array( 'id' => 'submit-add-user' ) ); ?>
     310    <?php submit_button( __( 'Add New User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-user' ) ); ?>
    319311</form>
    320312<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.