function tft_print_username in Taxonomy File Tree 7
Print the username using profile values or the default username
Parameters
int $uid: The user uid
Return value
string The user profile values or the username
1 call to tft_print_username()
- tft_get_content in ./
tft.module - Get the folder content and return it in an array form for the theme_table call
File
- ./
tft.module, line 995 - Module hooks.
Code
function tft_print_username($uid) {
/*$profile = db_query("SELECT {profile_values}.value AS first, profile2.value AS last FROM {profile_values}
LEFT JOIN {profile_values} profile2 ON profile2.uid = {profile_values}.uid
WHERE {profile_values}.uid = :uid AND {profile_values}.fid = 1 AND profile2.fid = 2", array(':uid' => $uid))->fetchObject();
*/
$profile = new stdClass();
$profile->name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(
':uid' => $uid,
))
->fetchField();
return !empty($profile->last) && !empty($profile->first) ? $profile->first . ' ' . $profile->last : $profile->name;
}