Load either a specified or the current user account.
@todo rethink the naming of this in Drupal 8.
$uid: An optional user ID of the user to load. If not provided, the current user's ID will be used.
A fully-loaded $user object upon successful user load, FALSE if user cannot be loaded.
function user_uid_optional_load($uid = NULL) {
if (!isset($uid)) {
$uid = $GLOBALS['user']->uid;
}
return user_load($uid);
}