You are here

function theme_fb_username in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 fb.theme.inc \theme_fb_username()
1 theme call to theme_fb_username()
fb_connect_theme_username_override in ./fb_connect.module
Our replacement for theme('username', ...)

File

./fb.theme.inc, line 124

Code

function theme_fb_username($params) {
  $fbu = $params['fbu'];
  $object = $params['account'];
  $orig = $params['orig'];
  if (!$fbu || arg(0) == 'admin') {
    return $orig;
  }
  $wrap_pre = "<span class=\"fb_hide\">{$orig}</span><span class=\"fb_show\">";
  $wrap_post = "</span>\n";
  $ifcantsee = '';
  if ($object->uid && user_access('access user profiles')) {

    // Provide link if local account.
    $wrap_pre = $wrap_pre . '<a href="' . url('user/' . $object->uid) . '">';
    $wrap_post = '</a>' . $wrap_post;
    $ifcantsee = 'ifcantsee="' . addslashes(check_plain($object->name)) . '"';
  }
  $fbml = "<fb:name linked=\"false\" useyou=\"false\" uid=\"{$fbu}\" {$ifcantsee}></fb:name>";
  $output = $wrap_pre . $fbml . $wrap_post;
  return $output;
}