Using Facebook Registration Plugin and Login Button

Facebook Connect button alone can pretty much collect all the information we need from user.  But sometimes we need to collect additional information during the registration, such as favorite Color, number of kittens, movie star name etc. To collect such information, we can use Facebook Registration Plugin. Instead of just showing Facebook Registration plugin, we will use Facebook Login button and call Registration plugin later.  To make it even better I have used colorbox by Jack Moore.I am going to use PHP, jQuery and jQuery Colorbox to achieve this.  I have created four PHP files for the purpose. Index.php, config.php, process.php and receive_data.php and included colorbox files for the registration plugin, which you will find in downloadable file at the bottom of the page.

Config.php

Config.php file will store our settings information. Just replace values with your own.[cc lang="php"] [/cc]

Index.php

Index.php simply displays Facebook Login button, and once user connects using Facebook button, Facebook Registration Plugin pop-up inside colorbox, where user needs to enter additional information.If you look at bottom of the page, using PHP session this page will display user entered details received from receive_data.php using PHP session and distroys it.[cc lang="html"] Facebook Connect & Facebook Registration Part I
$userid,'Name'=>$fullname,'Favorite Color'=>$usercolor,'Location'=>$userfrom,'Likes Saaraan'=>$userlike.' (0=No|1=Yes)');//Output this data echo '
'; print_r($facebookData); echo '
';//distroy session session_destroy(); } ?> [/cc]

Process.php

Process.php can do number of task, such as check connected user in database, display registration form or just redirect logged-in user to a new page. For now, we will just display Facebook registration plugin.[cc lang="php"]
'; } ?> [/cc]

Receive_data.php

This file will receive signed_request data from facebook, and redirect user to homepage.[cc lang="php"] [/cc]Download Demo
New question is currently disabled!