I have this code if user is not logged in through facebook on check show facebook for user to log in through facebook.
if($req_user['oauth_provider'] != "facebook")
{
<input type="checkbox" name="fb_post" id="fb_post" value="1" onclick="facebookPermissionsGrant(); return false;">}
?>
If user is logged in through facebook show checkbox checked:
if($req_user['oauth_provider'] == "facebook" && $CONFIG['fb_status'] == 1) {
<input type="checkbox" name="fb_post" id="fb_post" value="1" checked>
}
Problem i am having is if user is not logged in through facebook and checks the checbox and enter username and password on facebook. He has to refresh the page again to see that box checked.
Is there a way in ajax or in jquery so that i dont have to refresh the page and if user logged in it will show box checked?
Yes, there is. Facebook’s Javascript API has got FB.Event.Subscribe, which notifies your javascript when the user’s login status changes.
Example:
You can read more about FB.Event.subscribe here: http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/