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.
$user->uid
above by resetting the global$user
variable. So, whatever you do, use$account
or another variable in any solution you come up with.$user
unless you are damn sure you know what you are doing. Substituting it on the fly is dangerous at best, outright broken at worst.