1.20.x bootstrap.inc backdrop_anonymous_user()

Generates a default anonymous $user object.

Return value

User: An anonymous user entity object.

File

includes/bootstrap.inc, line 2981
Functions that need to be loaded on every Backdrop request.

Code

function backdrop_anonymous_user() {
  // Because this is called early in the bootstrap (starting the session) it
  // must not use the autoloader, so it's pulled in manually.
  require_once BACKDROP_ROOT . '/core/includes/userinterface.inc';
  require_once BACKDROP_ROOT . '/core/includes/anonymous.inc';
  $user = new AnonymousUser(array(
    'hostname' => ip_address(),
  ));
  return $user;
}