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
This commit is contained in:
parent
f2d7c06c6d
commit
2343663e0b
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue