Reputation: 37
I am trying to implement Fb registration in my site.I want to redirect it to my custom page (under the same domain) after registration.. how should I code? anyone please help me....
Code is here...But it is not redirecting to the specified redirect url..... Is there any other way?? please help....
<fb:login-button registration-url="https://www.facebook.com/plugins/registration.php" redirect-uri="<REDIRECT URL>" />Register</fb:login-button>
Upvotes: 0
Views: 365
Reputation: 18016
It can be implemented. Either using fb registration like this
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js">
</script>
<script>
FB.init({
appId:'YOUR_APP_ID', cookie:true,
status:true, xfbml:true
});
</script>
<fb:registration
fields="[{'name':'name'}, {'name':'email'},
{'name':'favorite_car','description':'What is your favorite car?',
'type':'text'}]" redirect-uri="URL_TO_LOAD_AFTER_REGISTRATION">
</fb:registration>
</body>
OR there can be another way. just place login button and capture the login event and redirect the user to your desired url like this
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({appId: '<?= YOUR_APP_ID ?>', status: true,
cookie: true, xfbml: true});
FB.Event.subscribe('auth.login', function(response) {
//self.location.href='some url' // redirect where do you want
});
</script>
Upvotes: 0