Hi
I am using drupal 7 and I have printed the user object with the follwing php code.
global $user;
print_r($user);
I am getting the result only with default field values. I have two custom fields and this is not in the result.I have added these custom fields in Home » Administration » Configuration » People » Account settings.Can anybody help me on this.
Thank you in advance
Comments
Comment #1
kunalkursija commentedHi pavimal,
Instead of using
global $user; print $user;You will have to do something like thisNote:
By default the global user object will contain the basic information of user's login. For ex: login time, session info e.t.c.
However if you want to access complete user object information, Then you will have to load the complete user object. This will also fetch all the fields and respective data.
Comment #2
cilefen commented#1 sounds correct to me.
Comment #3
kunalkursija commented