Access custom user field from a different account The following works so far:


I can set a custom user field e.g. 'full_name' in Drupal Account Settings
The logged in user has access to this field using the following code.

global $user;
$user = user_load($user->uid); // Fully load the user object
$custom_vars['full_name'] = $user->field_full_name[LANGUAGE_NONE][0]['value'];
echo "My full name is :  $custom_vars['full_name']";


This is what I want to do:


I want to log in as an admin account and for a specific group of
users who's unique IDs know I want to display this field.
So perhaps for userID = (1234, 1175, 14532) I want to see this value 
for 'full_name', how do I do it?


I am hoping for a PHP solution that uses code similar to the above rather than a SQL DB call, but if I need to directly access the DB so be it.
This seems a bit dirty, but using your exact code as a base, something like the following may work:

$uids = array(
  // Here is the list of user ID's that you know.
);

$full_names = array();

foreach ($uids AS $uid){
  $account = user_load($uid);
  $full_names[$uid] = $account-&gt;field_full_name[LANGUAGE_NONE][0]['value'];
}

unset($account);

return $full_names;


This will give you an array of full usernames keyed by the UID.

Also to bear in mind, this performs no access checking or permission checking.

For further reading, you might want to try taking a look at something like field_get_items() as well.