From b6f44dc5325d9a1d4c996e4c5af32ae35ec364b0 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 16 Nov 2005 02:54:23 +0000 Subject: [PATCH] Pull the values in WP_User::data directly into WP_User so that we don't have to do ->data->blah. git-svn-id: http://svn.automattic.com/wordpress/trunk@3102 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/profile.php | 41 ++++++++++++++--------------- wp-admin/user-edit.php | 41 ++++++++++++++--------------- wp-admin/users.php | 23 ++++++++-------- wp-includes/capabilities.php | 12 ++++++--- wp-includes/functions.php | 8 +++--- wp-includes/pluggable-functions.php | 4 +-- 6 files changed, 65 insertions(+), 64 deletions(-) diff --git a/wp-admin/profile.php b/wp-admin/profile.php index 5c43ab55e..ad586598b 100644 --- a/wp-admin/profile.php +++ b/wp-admin/profile.php @@ -6,7 +6,6 @@ $title = 'Profile'; $parent_file = 'profile.php'; include_once('admin-header.php'); $profileuser = new WP_User($user_ID); -$profiledata = &$profileuser->data; $bookmarklet_height= 440; ?> @@ -28,32 +27,32 @@ $bookmarklet_height= 440;

+

+

+

@@ -62,29 +61,29 @@ $bookmarklet_height= 440;

+

+


-

+

data; if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permission to edit this user.'); ?> @@ -80,7 +79,7 @@ if (!current_user_can('edit_users')) $errors['head'] = __('You do not have permi

+

+

+

@@ -125,29 +124,29 @@ echo '';

+

+


-

+

id) { - echo "
  • " . sprintf('ID #%1s: %2s The current user will not be deleted.', $id, $user->data->user_login) . "
  • \n"; + echo "
  • " . sprintf('ID #%1s: %2s The current user will not be deleted.', $id, $user->user_login) . "
  • \n"; } else { - echo "
  • " . sprintf('ID #%1s: %2s', $id, $user->data->user_login) . "
  • \n"; + echo "
  • " . sprintf('ID #%1s: %2s', $id, $user->user_login) . "
  • \n"; $go_delete = true; } } @@ -150,7 +150,7 @@ default: $tmp_user = new WP_User($userid); $roles = $tmp_user->roles; $role = $roles[0]; - $roleclasses[$role][$tmp_user->data->user_login] = $tmp_user; + $roleclasses[$role][$tmp_user->user_login] = $tmp_user; } ?> @@ -225,9 +225,8 @@ default: data; - $email = $user_data->user_email; - $url = $user_data->user_url; + $email = $user_object->user_email; + $url = $user_object->user_url; $short_url = str_replace('http://', '', $url); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) @@ -235,19 +234,19 @@ default: if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; - $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_data->ID' and post_status = 'publish'"); - if (0 < $numposts) $numposts = "$numposts"; + $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_object->ID' and post_status = 'publish'"); + if (0 < $numposts) $numposts = "$numposts"; echo " - - - + + + $email $short_url"; echo "$numposts"; echo ''; if (current_user_can('edit_users')) - echo "".__('Edit').""; + echo "".__('Edit').""; echo ''; echo ''; } diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 236c88461..4dac1bfc1 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -123,9 +123,13 @@ class WP_User { if ( empty($this->data->ID) ) return; - $this->id = $this->data->ID; + foreach (get_object_vars($this->data) as $key => $value) { + $this->{$key} = $value; + } + + $this->id = $this->ID; $this->cap_key = $table_prefix . 'capabilities'; - $this->caps = &$this->data->{$this->cap_key}; + $this->caps = &$this->{$this->cap_key}; if ( ! is_array($this->caps) ) $this->caps = array(); $this->get_role_caps(); @@ -182,8 +186,8 @@ class WP_User { function update_user_level_from_caps() { global $table_prefix; - $this->data->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); - update_usermeta($this->id, $table_prefix.'user_level', $this->data->user_level); + $this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0); + update_usermeta($this->id, $table_prefix.'user_level', $this->user_level); } function add_cap($cap, $grant = true) { diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 052d6e0bc..8c0becb8f 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -299,10 +299,10 @@ function get_option($option) { function get_user_option( $option ) { global $wpdb, $current_user; - if ( isset( $current_user->data->{$wpdb->prefix . $option} ) ) // Blog specific - return $current_user->data->{$wpdb->prefix . $option}; - elseif ( isset( $current_user->data->{$option} ) ) // User specific and cross-blog - return $current_user->data->{$option}; + if ( isset( $current_user->{$wpdb->prefix . $option} ) ) // Blog specific + return $current_user->{$wpdb->prefix . $option}; + elseif ( isset( $current_user->{$option} ) ) // User specific and cross-blog + return $current_user->{$option}; else // Blog global return get_option( $option ); } diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index 3b67d3116..5e1cb5a2d 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -365,8 +365,8 @@ function wp_new_user_notification($user_id, $plaintext_pass = '') { for ($i = 0; $i < strlen($pass1); $i = $i + 1) $stars .= '*'; - $user_login = stripslashes($user->data->user_login); - $user_email = stripslashes($user->data->user_email); + $user_login = stripslashes($user->user_login); + $user_email = stripslashes($user->user_email); $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";