From 2343663e0b126470bcc0e61e79c40c308566c1bc Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 13 Dec 2005 03:46:40 +0000 Subject: [PATCH] If no user is logged in, setup an empty user. git-svn-id: http://svn.automattic.com/wordpress/trunk@3299 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/capabilities.php | 3 +++ wp-includes/pluggable-functions.php | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index fed7364d72..1c33503597 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -117,6 +117,9 @@ class WP_User { function WP_User($id) { global $wp_roles, $table_prefix; + if ( empty($id) ) + return; + if ( is_numeric($id) ) { $this->data = get_userdata($id); } else { diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index 7c267b031c..4deb44a19b 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -8,9 +8,10 @@ if ( !function_exists('get_currentuserinfo') ) : function get_currentuserinfo() { global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; - if ( !isset($_COOKIE[USER_COOKIE])) + if ( !isset($_COOKIE[USER_COOKIE])) { + $current_user = new WP_User(0); return false; - + } $user_login = $_COOKIE[USER_COOKIE]; $userdata = get_userdatabylogin($user_login); $user_level = $userdata->user_level;