Get custom fields from users table in global user object I've altered users table and added two new fields directly using MySQL workbench


first_name
last_name


If we add new fields by config > people > site information > manage fields, it does not allow adding drop-down list. So, directly added using MySQL workbench.

Now I was able to alter user_register_form and added above two fields with validation.
At the time of creating new user, the values of first_name and last_name gets stored in users table.

Now, how to get those two fields when user logs in?

i've used below code to print user object

global $user;
$user_full = user_load($user-&gt;uid);
print_r($user_full);


Any help would be appreciated, thanks !!
You can implement the hook_user_load() for this purpose 

I have altered the user table with field "fname" , Now you can load this in user object with the help of hook_user_load() func.

function testing_custom_user_load($users) {
  foreach ($users as $record) {
     foreach ($users as $record) {

        $result = db_query("SELECT fname FROM {users} WHERE uid IN ($record-&gt;uid)")-&gt;fetchAssoc(); 

        $users[$record-&gt;uid]-&gt;extra =$result['fname'];
     }
  }

}


Just put this code snippet in any of your custom module file.