function drupal_anonymous_user

Generates a default anonymous $user object.

Return value

Object - the user object.

12 calls to drupal_anonymous_user()
comment_form_node_type_form_alter in drupal/modules/comment/comment.module
Implements hook_form_FORM_ID_alter().
DrupalWebTestCase::drupalCreateUser in drupal/modules/simpletest/drupal_web_test_case.php
Create a user with a given set of permissions.
drupal_cron_run in drupal/includes/common.inc
Executes a cron run when called.
drupal_session_initialize in drupal/includes/session.inc
Initializes the session handler, starting a session if needed.
UserPasswordResetTestCase::testResetImpersonation in drupal/modules/user/user.test
Make sure that users cannot forge password reset URLs of other users.

... See full list

File

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

Code

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