CodeIgniter Forums
Logout from facebook php sdk with codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Logout from facebook php sdk with codeigniter (/showthread.php?tid=50896)



Logout from facebook php sdk with codeigniter - El Forum - 04-12-2012

[eluser]mojitoo[/eluser]
Hey!

I have problem with my logout button for facebook with their php sdk package. I've created a link in my view that redirects to a controller called logout

controller
Code:
function logout()
{
  $this->session->sess_destroy();
  $this->Facebook_model->destroy_fb_session();
  $logout_url = $this->Facebook_model->get_logout_url();
  echo $logout_url;
  redirect($logout_url);
        }

model
Code:
function destroy_fb_session() {

  $this->facebook->destroySession();
}

but when I press the link will I receive the following message: Message: Cannot modify header information - headers already sent by

It works just fine to log out if I'm using the logout url without going through a controller and a model like this http://www.dannyherran.com/2011/02/facebook-php-sdk-and-codeigniter-for-basic-user-authentication/ but the reason I want to go though a controller is to be able to kill some of my own sessions and maybe something more.

I would appreciate if anyone would be able to help me to get this logout button to work.


Logout from facebook php sdk with codeigniter - El Forum - 04-14-2012

[eluser]Stavros[/eluser]
try to remove that echo $logout_url;