Make WordPress Core

Changeset 3102


Ignore:
Timestamp:
11/16/2005 02:54:23 AM (19 years ago)
Author:
ryan
Message:

Pull the values in WP_User::data directly into WP_User so that we don't have to do ->data->blah.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/profile.php

    r3063 r3102  
    77include_once('admin-header.php');
    88$profileuser = new WP_User($user_ID);
    9 $profiledata = &$profileuser->data;
    109
    1110$bookmarklet_height= 440;
     
    2928<legend><?php _e('Name'); ?></legend>
    3029<p><label><?php _e('Username: (no editing)'); ?><br />
    31 <input type="text" name="user_login" value="<?php echo $profiledata->user_login; ?>" disabled="disabled" />
     30<input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" />
    3231</label></p>
    3332
    3433<p><label><?php _e('First name:') ?><br />
    35 <input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p>
     34<input type="text" name="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>
    3635
    3736<p><label><?php _e('Last name:') ?><br />
    38 <input type="text" name="last_name"  value="<?php echo $profiledata->last_name ?>" /></label></p>
     37<input type="text" name="last_name"  value="<?php echo $profileuser->last_name ?>" /></label></p>
    3938
    4039<p><label><?php _e('Nickname:') ?><br />
    41 <input type="text" name="nickname" value="<?php echo $profiledata->nickname ?>" /></label></p>
     40<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
    4241
    4342</p><label><?php _e('Display name publicly as:') ?> <br />
    4443<select name="display_name">
    45 <option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option>
    46 <option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option>
    47 <option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option>
    48 <?php if ( !empty( $profiledata->first_name ) ) : ?>
    49 <option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option>
     44<option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option>
     45<option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option>
     46<option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option>
     47<?php if ( !empty( $profileuser->first_name ) ) : ?>
     48<option value="<?php echo $profileuser->first_name ?>"><?php echo $profileuser->first_name ?></option>
    5049<?php endif; ?>
    51 <?php if ( !empty( $profiledata->last_name ) ) : ?>
    52 <option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option>
     50<?php if ( !empty( $profileuser->last_name ) ) : ?>
     51<option value="<?php echo $profileuser->last_name ?>"><?php echo $profileuser->last_name ?></option>
    5352<?php endif; ?>
    54 <?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
    55 <option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
    56 <option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
     53<?php if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) : ?>
     54<option value="<?php echo $profileuser->first_name." ".$profileuser->last_name ?>"><?php echo $profileuser->first_name." ".$profileuser->last_name ?></option>
     55<option value="<?php echo $profileuser->last_name." ".$profileuser->first_name ?>"><?php echo $profileuser->last_name." ".$profileuser->first_name ?></option>
    5756<?php endif; ?>
    5857</select></label></p>
     
    6362
    6463<p><label><?php _e('E-mail: (required)') ?><br />
    65 <input type="text" name="email" value="<?php echo $profiledata->user_email ?>" /></label></p>
     64<input type="text" name="email" value="<?php echo $profileuser->user_email ?>" /></label></p>
    6665
    6766<p><label><?php _e('Website:') ?><br />
    68 <input type="text" name="url" value="<?php echo $profiledata->user_url ?>" />
     67<input type="text" name="url" value="<?php echo $profileuser->user_url ?>" />
    6968</label></p>
    7069
    7170<p><label><?php _e('AIM:') ?><br />
    72 <input type="text" name="aim" value="<?php echo $profiledata->aim ?>" />
     71<input type="text" name="aim" value="<?php echo $profileuser->aim ?>" />
    7372</label></p>
    7473
    7574<p><label><?php _e('Yahoo IM:') ?><br />
    76 <input type="text" name="yim" value="<?php echo $profiledata->yim ?>" />
     75<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" />
    7776</label></p>
    7877
    7978<p><label><?php _e('Jabber / Google Talk:') ?>
    80 <input type="text" name="jabber" value="<?php echo $profiledata->jabber ?>" /></label>
     79<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
    8180</p>
    8281</fieldset>
     
    8584<legend><?php _e('About yourself'); ?></legend>
    8685<p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p>
    87 <p><textarea name="description" rows="5" cols="30"><?php echo $profiledata->description ?></textarea></p>
     86<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
    8887</fieldset>
    8988
  • trunk/wp-admin/user-edit.php

    r2995 r3102  
    4949
    5050$profileuser = new WP_User($user_id);
    51 $profiledata = $profileuser->data;
    5251
    5352if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.');
     
    8180<legend><?php _e('Name'); ?></legend>
    8281<p><label><?php _e('Username: (no editing)'); ?><br />
    83 <input type="text" name="user_login" value="<?php echo $profiledata->user_login; ?>" disabled="disabled" />
     82<input type="text" name="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" />
    8483</label></p>
    8584
     
    9695
    9796<p><label><?php _e('First name:') ?><br />
    98 <input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p>
     97<input type="text" name="first_name" value="<?php echo $profileuser->first_name ?>" /></label></p>
    9998
    10099<p><label><?php _e('Last name:') ?><br />
    101 <input type="text" name="last_name"  value="<?php echo $profiledata->last_name ?>" /></label></p>
     100<input type="text" name="last_name"  value="<?php echo $profileuser->last_name ?>" /></label></p>
    102101
    103102<p><label><?php _e('Nickname:') ?><br />
    104 <input type="text" name="nickname" value="<?php echo $profiledata->nickname ?>" /></label></p>
     103<input type="text" name="nickname" value="<?php echo $profileuser->nickname ?>" /></label></p>
    105104
    106105</p><label><?php _e('Display name publicly as:') ?> <br />
    107106<select name="display_name">
    108 <option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option>
    109 <option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option>
    110 <option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option>
    111 <?php if ( !empty( $profiledata->first_name ) ) : ?>
    112 <option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option>
    113 <?php endif; ?>
    114 <?php if ( !empty( $profiledata->last_name ) ) : ?>
    115 <option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option>
    116 <?php endif; ?>
    117 <?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
    118 <option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
    119 <option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
     107<option value="<?php echo $profileuser->display_name; ?>"><?php echo $profileuser->display_name; ?></option>
     108<option value="<?php echo $profileuser->nickname ?>"><?php echo $profileuser->nickname ?></option>
     109<option value="<?php echo $profileuser->user_login ?>"><?php echo $profileuser->user_login ?></option>
     110<?php if ( !empty( $profileuser->first_name ) ) : ?>
     111<option value="<?php echo $profileuser->first_name ?>"><?php echo $profileuser->first_name ?></option>
     112<?php endif; ?>
     113<?php if ( !empty( $profileuser->last_name ) ) : ?>
     114<option value="<?php echo $profileuser->last_name ?>"><?php echo $profileuser->last_name ?></option>
     115<?php endif; ?>
     116<?php if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) : ?>
     117<option value="<?php echo $profileuser->first_name." ".$profileuser->last_name ?>"><?php echo $profileuser->first_name." ".$profileuser->last_name ?></option>
     118<option value="<?php echo $profileuser->last_name." ".$profileuser->first_name ?>"><?php echo $profileuser->last_name." ".$profileuser->first_name ?></option>
    120119<?php endif; ?>
    121120</select></label></p>
     
    126125
    127126<p><label><?php _e('E-mail: (required)') ?><br />
    128 <input type="text" name="email" value="<?php echo $profiledata->user_email ?>" /></label></p>
     127<input type="text" name="email" value="<?php echo $profileuser->user_email ?>" /></label></p>
    129128
    130129<p><label><?php _e('Website:') ?><br />
    131 <input type="text" name="url" value="<?php echo $profiledata->user_url ?>" />
     130<input type="text" name="url" value="<?php echo $profileuser->user_url ?>" />
    132131</label></p>
    133132
    134133<p><label><?php _e('AIM:') ?><br />
    135 <input type="text" name="aim" value="<?php echo $profiledata->aim ?>" />
     134<input type="text" name="aim" value="<?php echo $profileuser->aim ?>" />
    136135</label></p>
    137136
    138137<p><label><?php _e('Yahoo IM:') ?><br />
    139 <input type="text" name="yim" value="<?php echo $profiledata->yim ?>" />
     138<input type="text" name="yim" value="<?php echo $profileuser->yim ?>" />
    140139</label></p>
    141140
    142141<p><label><?php _e('Jabber / Google Talk:') ?>
    143 <input type="text" name="jabber" value="<?php echo $profiledata->jabber ?>" /></label>
     142<input type="text" name="jabber" value="<?php echo $profileuser->jabber ?>" /></label>
    144143</p>
    145144</fieldset>
     
    148147<legend><?php _e('About the user'); ?></legend>
    149148<p class="desc"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p>
    150 <p><textarea name="description" rows="5" cols="30"><?php echo $profiledata->description ?></textarea></p>
     149<p><textarea name="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea></p>
    151150</fieldset>
    152151
  • trunk/wp-admin/users.php

    r3061 r3102  
    9696        $user = new WP_User($id);
    9797        if ($id == $current_user->id) {
    98             echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->data->user_login) . "</li>\n";
     98            echo "<li>" . sprintf('ID #%1s: %2s <strong>The current user will not be deleted.</strong>', $id, $user->user_login) . "</li>\n";
    9999        } else {
    100             echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->data->user_login) . "</li>\n";
     100            echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf('ID #%1s: %2s', $id, $user->user_login) . "</li>\n";
    101101            $go_delete = true;
    102102        }
     
    151151        $roles = $tmp_user->roles;
    152152        $role = $roles[0];
    153         $roleclasses[$role][$tmp_user->data->user_login] = $tmp_user;
     153        $roleclasses[$role][$tmp_user->user_login] = $tmp_user;
    154154    }   
    155155   
     
    226226    $style = '';
    227227    foreach ($roleclass as $user_object) {
    228         $user_data = &$user_object->data;
    229         $email = $user_data->user_email;
    230         $url = $user_data->user_url;
     228        $email = $user_object->user_email;
     229        $url = $user_object->user_url;
    231230        $short_url = str_replace('http://', '', $url);
    232231        $short_url = str_replace('www.', '', $short_url);
     
    236235        $short_url =  substr($short_url, 0, 32).'...';
    237236        $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
    238         $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_data->ID' and post_status = 'publish'");
    239         if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>";
     237        $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_object->ID' and post_status = 'publish'");
     238        if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_object->ID' title='" . __('View posts') . "'>$numposts</a>";
    240239        echo "
    241240<tr $style>
    242     <td><input type='checkbox' name='users[]' id='user_{$user_data->ID}' value='{$user_data->ID}' /> <label for='user_{$user_data->ID}'>{$user_data->ID}</label></td>
    243     <td><label for='user_{$user_data->ID}'><strong>$user_data->user_login</strong></label></td>
    244     <td><label for='user_{$user_data->ID}'>$user_data->first_name $user_data->last_name</label></td>
     241    <td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>
     242    <td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
     243    <td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
    245244    <td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
    246245    <td><a href='$url' title='website: $url'>$short_url</a></td>";
     
    248247    echo '<td>';
    249248    if (current_user_can('edit_users'))
    250         echo "<a href='user-edit.php?user_id=$user_data->ID' class='edit'>".__('Edit')."</a>";
     249        echo "<a href='user-edit.php?user_id=$user_object->ID' class='edit'>".__('Edit')."</a>";
    251250    echo '</td>';
    252251    echo '</tr>';
  • trunk/wp-includes/capabilities.php

    r2904 r3102  
    124124            return;
    125125
    126         $this->id = $this->data->ID;
     126        foreach (get_object_vars($this->data) as $key => $value) {
     127            $this->{$key} = $value;
     128        }
     129
     130        $this->id = $this->ID;
    127131        $this->cap_key = $table_prefix . 'capabilities';
    128         $this->caps = &$this->data->{$this->cap_key};
     132        $this->caps = &$this->{$this->cap_key};
    129133        if ( ! is_array($this->caps) )
    130134            $this->caps = array();
     
    183187    function update_user_level_from_caps() {
    184188        global $table_prefix;
    185         $this->data->user_level = array_reduce(array_keys($this->allcaps),  array(&$this, 'level_reduction'), 0);
    186         update_usermeta($this->id, $table_prefix.'user_level', $this->data->user_level);
     189        $this->user_level = array_reduce(array_keys($this->allcaps),    array(&$this, 'level_reduction'), 0);
     190        update_usermeta($this->id, $table_prefix.'user_level', $this->user_level);
    187191    }
    188192   
  • trunk/wp-includes/functions.php

    r3092 r3102  
    300300function get_user_option( $option ) {
    301301    global $wpdb, $current_user;
    302     if ( isset( $current_user->data->{$wpdb->prefix . $option} ) ) // Blog specific
    303         return $current_user->data->{$wpdb->prefix . $option};
    304     elseif ( isset( $current_user->data->{$option} ) ) // User specific and cross-blog
    305         return $current_user->data->{$option};
     302    if ( isset( $current_user->{$wpdb->prefix . $option} ) ) // Blog specific
     303        return $current_user->{$wpdb->prefix . $option};
     304    elseif ( isset( $current_user->{$option} ) ) // User specific and cross-blog
     305        return $current_user->{$option};
    306306    else // Blog global
    307307        return get_option( $option );
  • trunk/wp-includes/pluggable-functions.php

    r3060 r3102  
    366366        $stars .= '*';
    367367   
    368     $user_login = stripslashes($user->data->user_login);
    369     $user_email = stripslashes($user->data->user_email);
     368    $user_login = stripslashes($user->user_login);
     369    $user_email = stripslashes($user->user_email);
    370370   
    371371    $message  = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n";
Note: See TracChangeset for help on using the changeset viewer.