2012-05-06 80 views
4

我想使用FB.login()使用FB Javascript SDK更改Login +注册流程。使用FB.login注册流程

现在FBML方式wroks罚款:

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

上点击下面的代码上面的按钮触发div来显示注册插件

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> 

但有一种方式来显示上述DIV一次用户从FB.login()登录?因为如果我使用的FB.login(),它会直接给Facebook页面的权限,一旦连接条件下面的功能是

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"; 
      } 
     });  

任何想法如何,我可以subtitute

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

我也需要一个答案。我们唯一可以传入FB.login的是一个回调和一个许可,所以这似乎是不可能的,但我需要它是为了让我的网站在移动网络上工作。 –

回答

0

您可以将事件在JavaScript代码像什么在这个帖子这里 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 
    }); 

描述我希望这将有助于。