The function fbconnect_get_fbuid doesn't check if the user has logged out.
(Once user logged in the function doesn't check if ther User has logged out on the facebook site.)

/**
 * Check facebook session.
 *
 * @param boolean $check_connected
 *   ensure that active user is connected with active facebook account
 *
 * @return integer
 *   facebook user id
 */
function fbconnect_get_fbuid($check_connected = FALSE) {
 //...
}

Porposed patch (the added code is from original documantation of facebook API https://github.com/facebook/facebook-php-sdk):

diff --git a/sites/all/modules/fbconnect/fbconnect.module b/sites/all/modules/fbconnect/fbconnect.module
index 37d6f54..ffa5b17 100755
--- a/sites/all/modules/fbconnect/fbconnect.module
+++ b/sites/all/modules/fbconnect/fbconnect.module
@@ -377,6 +377,14 @@ function fbconnect_get_fbuid($check_connected = FALSE) {

   if ($client && $fbuid = $client->getUser()) {

+    if ($fbuid) {
+      try {
+        // Proceed knowing you have a logged in user who's authenticated.
+        $user_profile = $client->api('/me');
+      } catch (FacebookApiException $e) {
+        $fbuid = NULL;
+      }
+    }
     if ($check_connected && $fbuid) {
       if (_fbconnect_get_user_fbuid($user->uid) != $fbuid) {
         $fbuid = NULL;

Comments

devsanjeev’s picture

Title: Check facebook session. » fbconnect Login/logout mode not working

I have used fbconnect module for drupal 6 . Most of the functionality working properly but Login/logout mode not working, I don't know why? I need to use "Ask user to logout from FB" of Login/logout mode. I have selected this mode and save the settings but nothing happened. Can anyone pls. help me?

Sanjeev Karn.

jcisio’s picture

Status: Patch (to be ported) » Needs review