Global $user;
$items = field_get_items('user', $user, 'field_patientid', $user->language);
I have a field on user entity and I always get a value of FALSE in my debug.
In my database I have the correct entity type which is user. Why am I not getting any values?
I am able to pull up value using:
$user_fields->field_patientid['und']['0']['value'];
Why will the above mentioned statement not work?
If you look at the code for
field_get_items(), you’ll notice that the field information you’re looking for needs to already be in the$userobject in order for it to be returned by the function.But
global $userdoes not provide the field data.From http://api.drupal.org/api/drupal/developer%21globals.php/global/user/7#comment-13744