Welcome Guest, Not a member yet? Register   Sign In
facebook connect: can't switch user
#1

[eluser]tmengttm[/eluser]
Hi all,
I'm developing a website with codeigniter. When i switch user account on facebook (from user1 to user2) and then do a "login with facebook" on my website, it still show the facebook info of the first user. I find some info regarding clear facebook cache or cookie, but how to do it with codeigniter?

I user this to get user data: $fb_usr = $this->fb_connect->user; (it seems that no matter how the facebook user changs, fb_connect always return same user)

and fb_connect is sth like this:
Quote: <?php
include(APPPATH.'libraries/facebook/facebook.php');

class Fb_connect extends Facebook{

//declare public variables
public $user = NULL;
public $user_id = FALSE;

public $fbLoginURL = "";
public $fbLogoutURL = "";

public $fb = FALSE;
public $fbSession = FALSE;
public $appkey = 0;

//constructor method.
public function __construct()
{
$CI = & get_instance();
$CI->config->load("facebook",TRUE);
$config = $CI->config->item('facebook');
parent::__construct($config);
$this->user_id = $this->getUser(); // New code
$me = null;
if ($this->user_id) {
try {
$me = $this->api('/me');
$this->user = $me;
} catch (FacebookApiException $e) {
error_log($e);
}
}

if ($me) {
$this->fbLogoutURL = $this->getLogoutUrl();
} else {
$this->fbLoginURL = $this->getLoginUrl();
}
} //end Fb_connect() function
}

I also tried to manually set $fbSession, $this->fb_connect->user, $fb to FALSE/NULL, but it doesn't work ,anyone could help?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB