Make WordPress Core


Ignore:
Timestamp:
11/18/2010 05:37:00 AM (16 years ago)
Author:
nacin
Message:

Every time you nest a ternary operator, a kitten dies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-new.php

    r16297 r16455  
    216216                echo '<h3 id="add-existing-user">' . __('Add Existing User') . '</h3>';
    217217        if ( !is_super_admin() ) {
    218                 _e( 'Enter the email address of an existing user on this network to invite them to this site.  That person will be sent an email asking them to confirm the invite.' );
     218                _e( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' );
    219219                $label = __('E-mail');
    220220        } else {
    221                 _e( 'Enter the email address or username of an existing user on this network to invite them to this site.  That person will be sent an email asking them to confirm the invite.' );
     221                _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' );
    222222                $label = __('E-mail or Username');
    223223        }
    224224?>
    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');?>>
    226226<input name="action" type="hidden" id="action" value="adduser" />
    227227<?php wp_nonce_field('add-user') ?>
     
    229229        <tr class="form-field form-required">
    230230                <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>
     231                <td><input name="email" type="text" id="email" value="" /></td>
    232232        </tr>
    233233        <tr class="form-field">
    234234                <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
    235235                <td><select name="role" id="role">
    236                         <?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);
    240                         ?>
     236                        <?php wp_dropdown_roles( get_option('default_role') ); ?>
    241237                        </select>
    242238                </td>
     
    256252if ( current_user_can( 'create_users') ) {
    257253        if ( $do_both )
    258                 echo '<h3 id="create-new-user">' . __('Create New User') . '</h3>';
     254                echo '<h3 id="create-new-user">' . __( 'Create New User' ) . '</h3>';
    259255?>
    260256<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');?>>
     257<form action="" method="post" name="createuser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
    262258<input name="action" type="hidden" id="action" value="createuser" />
    263259<?php wp_nonce_field('create-user') ?>
    264260<?php
    265261// Load up the passed data, else set to a default.
    266 foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
    267                                 'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
     262foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
     263                                'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) {
    268264        $var = "new_user_$var";
    269         if ( ! isset($$var) )
    270                 $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
     265        if( isset( $_POST['createuser'] ) ) {
     266                if ( ! isset($$var) )
     267                        $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : '';
     268        } else {
     269                $$var = false;
     270        }
    271271}
    272 $new_user_send_password = !$_POST || isset($_POST['send_password']);
     272
    273273?>
    274274<table class="form-table">
     
    307307        <tr>
    308308                <th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th>
    309                 <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked($new_user_send_password, true); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
     309                <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
    310310        </tr>
    311311<?php endif; ?>
     
    325325        <tr>
    326326                <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>
     327                <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1"  <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td>
    328328        </tr>
    329329        <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.