Make WordPress Core

Ticket #5607: remove_admin_notices5.diff

File remove_admin_notices5.diff, 4.2 KB (added by filosofo, 17 years ago)
  • wp-admin/users.php

     
    88$title = __('Users');
    99$parent_file = 'users.php';
    1010
    11 $action = $_REQUEST['action'];
     11$action = ( isset($_REQUEST['action']) ) ? $_REQUEST['action'] : '';
    1212$update = '';
    1313
    1414if ( empty($_POST) ) {
     
    6161                                $searches[] = $col . " LIKE '%$this->search_term%'";
    6262                        $search_sql .= implode(' OR ', $searches);
    6363                        $search_sql .= ')';
     64                } else {
     65                        $search_sql = '';
    6466                }
    6567                $this->query_from_where = "FROM $wpdb->users WHERE 1=1 $search_sql";
    6668
     
    276278        include('admin-header.php');
    277279
    278280        // Query the users
    279         $wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage']);
    280281
     282        $usersearch = ( isset($_GET['usersearch']) ) ? $_GET['usersearch'] : null;
     283        $userspage = ( isset($_GET['userspage']) ) ? $_GET['userspage'] : null;
     284        $wp_user_search = new WP_User_Search($usersearch, $userspage);
     285
    281286        // Make the user objects
    282287        foreach ( $wp_user_search->get_results() as $userid ) {
    283288                $tmp_user = new WP_User($userid);
     
    320325                }
    321326        endif; ?>
    322327
    323 <?php if ( is_wp_error( $errors ) ) : ?>
     328<?php if ( ! empty($errors) && is_wp_error( $errors ) ) : ?>
    324329        <div class="error">
    325330                <ul>
    326331                <?php
     
    429434</div>
    430435
    431436<?php
    432         if ( is_wp_error($add_user_errors) ) {
     437        if ( ! empty($add_user_errors) && is_wp_error($add_user_errors) ) {
    433438                foreach ( array('user_login' => 'user_login', 'first_name' => 'user_firstname', 'last_name' => 'user_lastname', 'email' => 'user_email', 'url' => 'user_uri', 'role' => 'user_role') as $formpost => $var ) {
    434439                        $var = 'new_' . $var;
    435440                        $$var = attribute_escape(stripslashes($_POST[$formpost]));
     
    441446<div class="wrap">
    442447<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
    443448
    444 <?php if ( is_wp_error( $add_user_errors ) ) : ?>
     449<?php if ( ! empty($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
    445450        <div class="error">
    446451                <?php
    447452                        foreach ( $add_user_errors->get_error_messages() as $message )
     
    464469<table class="editform" width="100%" cellspacing="2" cellpadding="5">
    465470        <tr class="form-field form-required">
    466471                <th scope="row" width="33%"><?php _e('Username (required)') ?><input name="action" type="hidden" id="action" value="adduser" /></th>
    467                 <td width="66%"><input name="user_login" type="text" id="user_login" value="<?php echo $new_user_login; ?>" /></td>
     472                <td width="66%"><input name="user_login" type="text" id="user_login" value="<?php echo ( ! empty($new_user_login) ) ? $new_user_login : ''; ?>" /></td>
    468473        </tr>
    469474        <tr class="form-field">
    470475                <th scope="row"><?php _e('First Name') ?> </th>
    471                 <td><input name="first_name" type="text" id="first_name" value="<?php echo $new_user_firstname; ?>" /></td>
     476                <td><input name="first_name" type="text" id="first_name" value="<?php echo ( ! empty($new_user_firstname) ) ? $new_user_firstname : ''; ?>" /></td>
    472477        </tr>
    473478        <tr class="form-field">
    474479                <th scope="row"><?php _e('Last Name') ?> </th>
    475                 <td><input name="last_name" type="text" id="last_name" value="<?php echo $new_user_lastname; ?>" /></td>
     480                <td><input name="last_name" type="text" id="last_name" value="<?php echo ( ! empty($new_user_lastname) ) ? $new_user_lastname : ''; ?>" /></td>
    476481        </tr>
    477482        <tr class="form-field form-required">
    478483                <th scope="row"><?php _e('E-mail (required)') ?></th>
    479                 <td><input name="email" type="text" id="email" value="<?php echo $new_user_email; ?>" /></td>
     484                <td><input name="email" type="text" id="email" value="<?php echo ( ! empty($new_user_email) ) ? $new_user_email : ''; ?>" /></td>
    480485        </tr>
    481486        <tr class="form-field">
    482487                <th scope="row"><?php _e('Website') ?></th>
    483                 <td><input name="url" type="text" id="url" value="<?php echo $new_user_uri; ?>" /></td>
     488                <td><input name="url" type="text" id="url" value="<?php echo ( ! empty($new_user_uri) ) ? $new_user_uri : ''; ?>" /></td>
    484489        </tr>
    485490
    486491<?php if ( apply_filters('show_password_fields', true) ) : ?>
     
    496501                <th scope="row"><?php _e('Role'); ?></th>
    497502                <td><select name="role" id="role">
    498503                        <?php
    499                         if ( !$new_user_role )
     504                        if ( empty($new_user_role) )
    500505                                $new_user_role = get_option('default_role');
    501506                        wp_dropdown_roles($new_user_role);
    502507                        ?>