function fbconnect_login_user_logout in Facebook Connect 8.2
Same name and namespace in other branches
- 7.2 fbconnect_login/fbconnect_login.module \fbconnect_login_user_logout()
Implements hook_user_logout().
File
- fbconnect_login/
fbconnect_login.module, line 111 - Login functionality for Facebook Connect module
Code
function fbconnect_login_user_logout() {
// Redirect user to Facebook logout url.
$client = facebook_client();
if ($client) {
try {
$request = $client
->request('GET', '/me', array(), facebook_get_access_token());
$response = $client
->getClient()
->sendRequest($request);
if ($fbuid = $response
->getGraphUser()
->getId() && variable_get('fbconnect_loginout_mode') == 'auto') {
global $base_url;
$url = $client
->getRedirectLoginHelper()
->getLogoutUrl(facebook_get_access_token(), $base_url);
session_destroy();
drupal_goto($url);
}
} catch (Exception $e) {
}
}
}