Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to reload the page 2 times to get userid and info
    primarykey
    data
    text
    <p>I am trying to integrate facebook connect on my site. Once i login into facebook and then subscribe, the event will fire and its response.status returns 'connected'. Then i reload the page, but i did not get any userdata. If i manually refresh the page, then only do i get login in the user info </p> <p>My code is:</p> <pre><code>$user = $facebook-&gt;getUser(); if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook-&gt;api('/me'); //print htmlspecialchars(print_r($user_profile, true)); } catch (FacebookApiException $e) { echo '&lt;pre&gt;'.htmlspecialchars(print_r($e, true)).'&lt;/pre&gt;'; $user = null; } } &lt;div id="fb-root"&gt;&lt;/div&gt; &lt;?php if ($user) { ?&gt; Your user profile is &lt;pre&gt; &lt;?php print htmlspecialchars(print_r($user_profile, true)) ?&gt; &lt;/pre&gt; &lt;?php } //else { ?&gt; &lt;fb:login-button&gt;&lt;/fb:login-button&gt; &lt;?php //} ?&gt; &lt;script&gt; window.fbAsyncInit = function() { FB.init({ appId : 'YOUR_APP_ID', status : true, cookie : true, xfbml : true, oauth : true, }); FB.Event.subscribe('auth.login', function(response) { alert("status " + response.status); alert('reload'); window.location.reload(); } }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); &lt;/script&gt; </code></pre> <p>Please help me in solving this</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload