drupal_anonymous_user

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

Generates a default anonymous $user object.

Return value

Object - the user object.

▾ 8 functions call drupal_anonymous_user()

comment_form_node_type_form_alter in modules/comment/comment.module
Implement hook_form_FORM_ID_alter().
drupal_session_initialize in includes/session.inc
Initialize the session handler, starting a session if needed.
openid_authentication in modules/openid/openid.module
Authenticate a user or attempt registration.
user_external_login_register in modules/user/user.module
Helper function for authentication modules. Either logs in or registers the current user, based on username. Either way, the global $user object is populated and login tasks are performed.
user_register_form in modules/user/user.module
Form builder; the user registration form.
_drupal_bootstrap_page_cache in includes/bootstrap.inc
Bootstrap page cache: Try to serve a page from cache.
_drupal_session_destroy in includes/session.inc
Session handler assigned by session_set_save_handler().
_drupal_session_read in includes/session.inc
Session handler assigned by session_set_save_handler().

Code

includes/bootstrap.inc, line 1441

<?php
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;
}
?>
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.