You are here

function fb_username_alter in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 6.3 fb.module \fb_username_alter()
  2. 7.4 fb.module \fb_username_alter()
  3. 7.3 fb.module \fb_username_alter()

hook_username_alter().

Return a user's facebook name, instead of local username.

File

./fb.module, line 963

Code

function fb_username_alter(&$name, $account) {

  //dpm(func_get_args(), "fb_username_alter($name)");
  if (isset($account->fbu) && $name == $account->fbu . '@facebook') {
    $info = fb_users_getInfo(array(
      $account->fbu,
    ));
    if (is_array($info) && is_array($info[0])) {
      if ($info[0]['name']) {
        $name = $info[0]['name'];
      }
    }
  }
}