Drupal function field_get_items vs user_load In Drupal, I want to read a custom field value for a group of users while logged into an admin account. I only need 1 field value from each user, the same field and I do not need this information cached. 

When I use user_load it requests the user object as I only need one field this is very inefficient.

So I investigated field_get_items, but I cannot see how to use this function without first using user_load.  I have attached my code and MARKED the line that is giving me an issue.


how can I use field_get_items without using user_load, if not possible is there a efficient way of doing this?  Please don't mention user_load_multiple
with user_load does setting , $reset = TRUE prevent Drupal caching the data or does it force a cache reset, get the data from the DB and then re-cache the new data?


Code I use:

$user_a = array();  //  This is the array of URIs we need to query
foreach ($user_a AS $uid){  
  $account = user_load($uid, $reset = TRUE);  // access the user objects, one at a time
  $fullname[$uid] = $account-&gt;field_fullname[LANGUAGE_NONE][0]['value']; // extract value
}

$user_a = array();  //  This is the array of URIs we need to query
foreach ($user_a AS $uid){
  **$account = user_load($uid, $reset = TRUE);**
  $fullname[$uid] = field_get_items('user', $account, 'field_fullname');  // extract array
  foreach ($fullname[$uid] as $item) {
    $fullname[$uid] = $item['value'];  // extract value
  }
}
No, You can't use field_get_items without the loaded user object. As the entity has to be passed as the second argument as illustrated in documentation.

Any reason why you hate user_load_multiple? As user_load itself uses user_load_multiple.

If you don't want to retrieve that huge amount of arrays. You can consider building your own query to retrieve just the field you want.