drupal_anonymous_user

5 bootstrap.inc drupal_anonymous_user($session = '')
6 bootstrap.inc drupal_anonymous_user($session = '')
7 bootstrap.inc drupal_anonymous_user()
8 bootstrap.inc drupal_anonymous_user()

Generates a default anonymous $user object.

Return value

Object - the user object.

10 calls to drupal_anonymous_user()

File

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

Code

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

Comments

Note this is not a complete

Note this is not a complete user object that gets run through hook_entity_load() and hook_user_load(). It doesn't have typical keys like 'name', 'mail', etc that normal user account objects do.

Login or register to post comments