Generates a default anonymous $user object.

Public

bootstrap.inc

</> CopyGet raw version
php
  1. /**
  2.  * Generates a default anonymous $user object.
  3.  *
  4.  * @return Object - the user object.
  5.  */
  6. function drupal_anonymous_user() {
  7. $user = variable_get('drupal_anonymous_user_object', new stdClass);
  8. $user->uid = 0;
  9. $user->hostname = ip_address();
  10. $user->roles = array();
  11. $user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
  12. $user->cache = 0;
  13. return $user;
  14. }