Using Facebook Registration Plugin and Login ButtonFacebook 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.phpConfig.php file will store our settings information. Just replace values with your own.[cc lang="php"] [/cc]
Index.phpIndex.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"]
$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.phpProcess.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"]