views:

152

answers:

1

This is a repeated question and I have followed both the suggestions provided in these StackOverflow links:

The issue is - the code works 90% of the time. Thats the weird part. Out of the 100 times I've logged in and out - I've experienced this problem 5-6 times and 2 of my beta test users have reported the same issue.

So when it works- if u click the logout link - u get the facebook popup saying - you being logged out - when it does'nt work - absolutely nothing happens - the page does not refresh - it just sits on that page doing nothing.

This is the javascript code that gets called on clicking logout


function logout()
{
   FB.Connect.get_status().waitUntilReady(function(status) {
   switch(status) {
      case FB.ConnectState.connected:
        FB.Connect.logoutAndRedirect("http://www.example.com/login/logout");
        break;
      case FB.ConnectState.userNotLoggedIn:
        window.location = "http://www.example.com/login/logout";
        break;
}
});
return false;          
}


This is the php code:

$this->_auth->clearIdentity();
$face = Zend_Registry::get('facebook');
$fb = new Facebook($face['appapikey'], $face['appsecret']);
//$fb->clear_cookie_state();
$fb->expire_session();

Anyone experienced such sporadic issues. Thanks

A: 

It looks and sounds as though the waitUntilReady function never becomes "ready" and thereby prevents the rest of the code from executing. Perhaps try the following and let us know if it solves the problem:

function logout()
{
   var status = FB.Connect.get_status();
   switch(status) {
      case FB.ConnectState.connected:
        FB.Connect.logoutAndRedirect("http://www.example.com/login/logout");
        break;
      case FB.ConnectState.userNotLoggedIn:
        window.location = "http://www.example.com/login/logout";
        break;
   }
   return false;
}
Dustin Fineout
Thanks Dustin - I will use this code and will get back to you - I will probably need some time as this occurs very rarely........I will post my results soon - thanks for your time
Gublooo
Just wondering how it's working for you so far, and if you've seen the bug reoccur?
Dustin Fineout

related questions