function fb_user_load in Drupal for Facebook 6.2
Same name and namespace in other branches
- 5.2 fb.module \fb_user_load()
- 5 fb.module \fb_user_load()
File
- ./
fb.module, line 584
Code
function fb_user_load($fbu = NULL) {
global $user;
if (!$fbu) {
// default to current logged in user
$fbu = fb_facebook_user();
}
if ($fbu && $user->fbu == $fbu) {
return $user;
}
if ($fbu) {
$account = user_external_load("{$fbu}-{$fb_app->apikey}@facebook.com");
if (!$account) {
$account = user_external_load("{$fbu}@facebook.com");
}
if (!$account) {
$account = user_load(array(
'uid' => variable_get('fb_facebook_user', 2),
));
}
if (!$account) {
watchdog('fb', 'Failed to load user from facebook fbu=%fbu', array(
'%fbu' => $fbu,
), WATCHDOG_ERROR);
}
$account->fbu = $fbu;
return $account;
}
}