Why is the following not working?
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
header("Location: ".$login_url);
}
Using xdebug, I can see that it is going through the else
section, but when it gets to the end of the file, it stays on the current page, instead of opening the new login_url
page which should show the facebook login screen.
Anyone know why it's not going to the facebook page?
Figured out the problem. I had a typo... I was assigning the url to
$logoutUrl
and was trying to get the url from$logout_url
...Thanks
Try this:
I used this solution in php: