You are here

function drupal_anonymous_user in Drupal 6

Same name and namespace in other branches
  1. 5 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.

3 calls to drupal_anonymous_user()
comment_form_alter in modules/comment/comment.module
Implementation of hook_form_alter().
sess_read in includes/session.inc
Reads an entire session from the database (internal use only).
user_logout in modules/user/user.pages.inc
Menu callback; logs the current user out, and redirects to the home page.

File

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

Code

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