public function actionFblogin()
{
$facebook = new Facebook(Yii::app()->params['fb']['config']);
//$session = $facebook->getSession();
$user = $facebook->getUser();
$me = null;
// Session based API call.
if ($user)
{
$fb_uid = $facebook->getUser();
if (Yii::app()->user->id)
{
$user = User::model()->find('fb_uid=?', array($fb_uid));
if ($user === NULL)
{
Yii::app()->user->setState('fb_uid', $fb_uid);
$this->redirect($this->createAbsoluteUrl('profile/settings', array('fbconnect' => 1)));
Yii::app()->end();
}
else
{
$this->redirect($this->createAbsoluteUrl('profile/settings', array('fbconnect' => 2)));
Yii::app()->end();
}
}
else
{
$user = User::model()->find('fb_uid=?', array($fb_uid));
if($user->lastLogin==0)
$firstTime=1;
$_identity = new FbUserIdentity($fb_uid);
$_identity->authenticate();
if ($_identity->errorCode === FbUserIdentity::ERROR_NONE)
{
$duration = 3600 * 24 * 30; // $this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($_identity, $duration);
if($firstTime==1)
$this->redirect($this->createAbsoluteUrl('site/demo', array('name' => $user->firstName)));
else
$this->redirect(Yii::app()->user->returnUrl);
return true;
}
else
$this->redirect($this->createAbsoluteUrl('site/fbregister'));
}
}
else
{
$this->redirect($facebook->getLoginUrl(array('req_perms' => Yii::app()->params['fb']['config']['perms'], 'return_url' => $this->createAbsoluteUrl('site/fblogin'))));
}
}
hi
i have this actionFblogin in my sitecontroller.php
the problem is when i click the button it takes you to facebook page(and it displays error line) THIS IS THE LINK
and it doesnt redirect to my website ?
can anybody help me???