You are here

function drupal_anonymous_user in Drupal 5

Same name and namespace in other branches
  1. 6 includes/bootstrap.inc \drupal_anonymous_user()
  2. 7 includes/bootstrap.inc \drupal_anonymous_user()

Generates a default anonymous $user object.

Return value

Object - the user object.

2 calls to drupal_anonymous_user()
sess_read in includes/session.inc
user_logout in modules/user/user.module
Menu callback; logs the current user out, and redirects to the home page.

File

includes/bootstrap.inc, line 866
Functions that need to be loaded on every Drupal request.

Code

function drupal_anonymous_user($session = '') {
  $user = new stdClass();
  $user->uid = 0;
  $user->hostname = $_SERVER['REMOTE_ADDR'];
  $user->roles = array();
  $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
  $user->session = $session;
  $user->cache = 0;
  return $user;
}