Skip navigation
Help

drupal_anonymous_user

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

Generates a default anonymous $user object.

Return value

Object - the user object.

10 calls to drupal_anonymous_user()

File

drupal/includes/bootstrap.inc, line 1818
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;
}