Using Facebook Registration Plugin and Login Button
Written by Saran on June 25, 2012, Updated December 21, 2013
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 file will store our settings information. Just replace values with your own.
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.
Facebook Connect & Facebook Registration Part I
$userid,'Name'=>$fullname,'Favorite Color'=>$usercolor,'Location'=>$userfrom,'Likes Saaraan'=>$userlike.' (0=No|1=Yes)');
//Output this data
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.
This file will receive signed_request data from facebook, and redirect user to homepage.
Sanwebe.com was founded in 2011 by Saran Chamling. A blog truely inspired by the ever changing web development world. It is a small effort to provide useful tips, tutorials and related resources to web developers.