drupal_anonymous_user

Versions
5 – 7
drupal_anonymous_user($session = '')

Generates a default anonymous $user object.

Return value

Object - the user object.

▾ 2 functions call 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.

Code

includes/bootstrap.inc, line 866

<?php
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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.