function fb_get_object_fbu in Drupal for Facebook 6.2
Same name and namespace in other branches
- 6.3 fb.module \fb_get_object_fbu()
- 7.3 fb.module \fb_get_object_fbu()
Convenience function to learn the fbu associated with a user, node or comment. Used in theming (X)FBML tags.
4 calls to fb_get_object_fbu()
- fb_canvas_theme_username_override in ./
fb_canvas.module - Our replacement for theme('username', ...)
- fb_canvas_theme_user_picture_override in ./
fb_canvas.module - Our replacement for theme('user_picture', ...)
- fb_connect_theme_username_override in ./
fb_connect.module - Our replacement for theme('username', ...)
- fb_connect_theme_user_picture_override in ./
fb_connect.module - Our replacement for theme('user_picture', ...)
File
- ./
fb.module, line 423
Code
function fb_get_object_fbu($object) {
static $cache;
if (!isset($cache)) {
$cache = array();
}
if (isset($object->uid) && isset($cache[$object->uid])) {
$fbu = $cache[$object->uid];
return $fbu;
}
elseif (isset($object->fbu)) {
// Explicitly set.
$fbu = $object->fbu;
}
elseif ($pos = strpos($object->name, '@facebook')) {
// Naming convention.
$fbu = substr($object->name, 0, $pos);
}
elseif ($object->uid > 0) {
// Experimental. This can be expensive on pages with many comments or nodes!
//$fbu = fb_get_fbu($object->uid);
}
if (isset($fbu) && is_numeric($fbu)) {
if (isset($object->uid) && $object->uid > 0) {
$cache[$object->uid] = $fbu;
}
return $fbu;
}
}