function drupal_anonymous_user

Same name and namespace in other branches
  1. 7.x drupal-7.x/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 drupal-6.x/modules/comment/comment.module
Implementation of hook_form_alter().
sess_read in drupal-6.x/includes/session.inc
Reads an entire session from the database (internal use only).
user_logout in drupal-6.x/modules/user/user.pages.inc
Menu callback; logs the current user out, and redirects to the home page.

Archivo

drupal-6.x/includes/bootstrap.inc, line 1076
Functions that need to be loaded on every Drupal request.

Código

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;
}