function fb_username_alter in Drupal for Facebook 6.3
Same name and namespace in other branches
- 6.2 fb.module \fb_username_alter()
- 7.4 fb.module \fb_username_alter()
- 7.3 fb.module \fb_username_alter()
hook_username_alter().
Return a user's facebook name, instead of local username.
File
- ./
fb.module, line 1570 - This is the core required module of Drupal for Facebook.
Code
function fb_username_alter(&$name, $account) {
if ($fbu = fb_get_fbu($account)) {
// @TODO - is fb_get_fbu() a performance hit here?
$info = fb_users_getInfo(array(
$fbu,
));
if (is_array($info) && isset($info[0])) {
if ($info[0]['name']) {
$name = $info[0]['name'];
}
}
}
}