So I’ve successfully integrated Facebook into my WordPress site. I’ve also linked together the accounts. However, the way the site works is that you’re either logged into the site via the
- WordPress Account
- Facebook Account or
- WordPress & Facebook
I know how to log out of Facebook and I know how to log out of WordPress, but the two methods are using Javascript and PHP respectively.
How would I, with one logout link, use both the PHP and Javascript logout methods?
I solved this issue by using
FB.Connect.logoutAndRedirect()
and in fb_logout.php I used:
session_destroy();
like:Which seems to work pretty well.
I would use Ajax. You can call the javascript function and a php script.
If you have no idea how ajax works a really easy way to do is using jQuery.post.