How do you query custom fields on the user table? If edit a user in the Admin panel, and hit the DEVEL tab, I see the field I added, 'field_display_name'.
In a node template php file, I want to replace the 'name' field with 'field_display_name'.
When I query, either using:
$result = db_select('users', 'u')
->fields('u')
->condition('name', 'bubba', '=')
->execute()
->fetchAssoc();
or
$rst = db_query("select * from {users} where name = :name", array(':name' => 'bubba',));
neither one of these return my custom field on the user table. (DPM does not show field_display_name)
So obviously, i'm missing something fundamental in my understanding of the data structure.
How do i return this added field by querying with uid or name to return and print the 'field_display_name' ?