function fb_user_get_local_user in Drupal for Facebook 5
Same name and namespace in other branches
- 5.2 fb_user.module \fb_user_get_local_user()
- 6.3 fb_user.module \fb_user_get_local_user()
- 6.2 fb_user.module \fb_user_get_local_user()
- 7.3 fb_user.module \fb_user_get_local_user()
Given an app and facebook user id, return the corresponding local user.
2 calls to fb_user_get_local_user()
File
- ./
fb_user.module, line 923 - This module allows Drupal user records to be associated with Facebook user ids. It can create local user accounts when Facebook users visit an application's canvas pages.
Code
function fb_user_get_local_user($fbu, $fb_app) {
// TODO: this query probably needs to search for one authname or the other, not both.
$result = db_query("SELECT am.* FROM authmap am WHERE am.authname='%s' OR am.authname='%s' ORDER BY am.authname", "{$fbu}-{$fb_app->apikey}@facebook.com", "{$fbu}@facebook.com");
if ($data = db_fetch_object($result)) {
$account = user_load(array(
'uid' => $data->uid,
));
return $account;
}
}