Stream registration using FB.login

I want to change the registration and registration input stream using the FB Javascript SDK using FB.login ().

Now the FBML method works fine:

<fb:login-button registration-url="<?php echo $config["base_url"]; ?>test.php" size="small"></fb:login-button> 

when you click the button above the following code, a div is launched to show the registration plugin

 FB.getLoginStatus(function(response) { if (response.status === 'not_authorized') { // show registration form document.getElementById('reg').style.display = "block"; } }); // registration form placed in a div <div style="display:none;width:540px;position:relative;margin:0 auto;" id="reg"> <fb:registration fields="name,birthday,gender,location,email" redirect uri="http://app.sunosunaao.com/test.php" width="530"> </fb:registration> </div> 

But is there a way to show the above div after user login from FB.login ()? Because if I use FB.login (), it directly goes to the permissions page on Facebook and after connecting the conditions in the next function

 response.status === 'connected' hence the registration plugin is not triggered FB.getLoginStatus(function(response) { if (response.status === 'not_authorized') { // show registration form document.getElementById('reg').style.display = "block"; } }); 

Any idea on how I can fake

 <fb:login-button registration-url="<?php echo $config["base_url"]; ?>test.php" size="small"></fb:login-button> with FB.login(); 
+4
source share
1 answer

You can attach events in your javascript code, as described in this post here http://developers.facebook.com/blog/post/534/

  FB.Event.subscribe('auth.login', function(response) { // this code is executed after login success }); FB.Event.subscribe('auth.logout', function(response) { // this code is executed after logout success }); 

Hope this helps.

0
source

Source: https://habr.com/ru/post/1411023/


All Articles