Unable to use user fields from the global variable $user
The global $user variable doesn't contain all the values you would find from a user object loaded from the database; in particular, it doesn't contain any field associated with the user entity. If you need a full-loaded user object for the currently logged-in user, you should use the following code.

$account = user_uid_optional_load();
// Use $account to access the user fields.


If need to load a full-loaded user object knowing its user ID, then you should use the following code.

$account = user_load($1);
// Use $account to access the user fields.


Also in this case, you could use user_uid_optional_load(); since it only passes the given user ID to user_load(), you can directly use user_load() and use user_uid_optional_load() when you don't have always a user ID, and need the user object for the currently logged-in user in that case.