function simple_fb_connect_get_fb_profile in Simple FB Connect 7.2
Makes an API call to get user's Facebook profile.
Parameters
Facebook\FacebookSession $fb_session: FacebookSession object.
Return value
Facebook\GraphObject|false GraphObject representing the user. False if exception was thrown.
1 call to simple_fb_connect_get_fb_profile()
- simple_fb_connect_return_from_fb in ./
simple_fb_connect.module - Page callback for /user/simple-fb-connect/return.
File
- ./
simple_fb_connect.module, line 493 - Simple Facebook Login Module for Drupal Sites.
Code
function simple_fb_connect_get_fb_profile(FacebookSession $fb_session) {
try {
$api_version = simple_fb_connect_get_api_version();
$request = new FacebookRequest($fb_session, 'GET', '/me', array(
'fields' => 'id,name,email',
), $api_version);
$object = $request
->execute()
->getGraphObject();
return $object;
} catch (FacebookRequestException $ex) {
watchdog('simple_fb_connect', 'Could not load FB user profile: FacebookRequestException. Error details: @message', array(
'@message' => json_encode($ex
->getResponse()),
), WATCHDOG_ERROR);
} catch (\Exception $ex) {
watchdog('simple_fb_connect', 'Could not load FB user profile: Unhandled exception. Error details: @message', array(
'@message' => $ex
->getMessage(),
), WATCHDOG_ERROR);
}
// Something went wrong.
return FALSE;
}