global $user

  1. 7.x documentation-7.x/developer/globals.php user
  2. 6.x documentation-6.x/developer/globals.php user

An object representing the user currently visiting the site.

Contains preferences and other account information for logged-in users. When a user is not logged-in, $user->uid property is set to 0.

Contains preferences and other user information.

File

documentation-6.x/developer/globals.php, line 85
These are the global variables that Drupal uses.

Code

global $user;