You are here

function fbconnect_login_user_logout in Facebook Connect 7.2

Same name and namespace in other branches
  1. 8.2 fbconnect_login/fbconnect_login.module \fbconnect_login_user_logout()

Implements hook_user_logout().

File

fbconnect_login/fbconnect_login.module, line 117
Login functionality for Facebook Connect module

Code

function fbconnect_login_user_logout() {

  // Redirect user to Facebook logout url.
  $fb_session = facebook_client_session();
  if ($fb_session) {
    try {
      $fbuid = fbconnect_get_fbuid();
      if ($fbuid && variable_get('fbconnect_loginout_mode') == 'auto') {
        global $base_url;
        $helper = new FacebookRedirectLoginHelper($base_url);
        try {
          $url = $helper
            ->getLogoutUrl($fb_session, $base_url);
          session_destroy();
          drupal_goto($url);
        } catch (\Exception $ex) {
        }
      }
    } catch (\Exception $e) {
    }
  }
}