Fetching user account additional field in views global php I want to fetch the additional account field by using global php in Views.
The additional account is shown below:



The code I use in Global PHP output:

&lt;?php 
global $user;
$namepsm = strtoupper(str_replace("_"," ",$row-&gt;value));
print ($namepsm .  ' ' . $user-&gt;field_id_number) ;
?&gt;


I have an error


  Notice: Undefined property: stdClass::$field_id_number in __lambda_func() (line 4 


I can use other standard account fields, for example $user-&gt;name or $user-&gt;$mail.

How can I print the additional account field (field_id_number)?
Use user_load function to load your account, like so:

$logged_in_user = user_load($user-&gt;uid);


Then dpm($logged_in_user) or print_r($logged_in_user) you will see you have access to the field you added.