Home » » Facebook Registration Plugin with Custom Fields

Facebook Registration Plugin with Custom Fields

Written By 1 on Sunday, September 15, 2013 | 4:11 AM

Follow the Following Steps:


1. Create New APP on facebook

2. After Creating the App, Edit the same App and fill the following information
Site URL under “Website with Facebook Login”
Canvas URL under “App on Facebook”

3. Analyse the Following  Registration Code


4. Update Following  fields
client_id:  replace the client_id(113869198637480) with your “App ID”
redirect_uri: replace with your URL, where you want to get the post data when user click on “Register” Button

5. When you  click “Register” You will get All the detail of registration in the redirect_uri.


Use the Following code for Quick Facebook Registration Integration.

/** PLEASE ADD YOUR APP_ID AND FACEBOOK_SECRET KEY FROM DEVELOPER PAGE **/
define('APP_ID','13869198637480');
define('FACEBOOK_SECRET','xxxxxxxxxxxxxxxxxxxxxxxxx');

/** print_r short function **/
function pr($data,$msg=null){
echo "
";
print_r($data);
echo "
"; if($msg){ die($msg); } } /** print_r short function **/ function base64_url_decode($input) { return base64_decode(strtr($input, '-_', '+/')); } function parse_signed_request($signed_request,$secret) { list($encoded_sig, $payload) = explode('.', $signed_request, 2); // decode the data $sig = base64_url_decode($encoded_sig); $data = json_decode(base64_url_decode($payload), true); // confirm the signature $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true); if ($sig !== $expected_sig) { error_log('Bad Signed JSON signature!'); return null; } return $data; } if(!empty($_POST)){ $requestData =$_POST['signed_request']; $response = parse_signed_request ( $requestData, FACEBOOK_SECRET ); echo "Following are the Registration Detail"; pr($response['registration'],' '); } $url='http://127.0.0.1/facebook/registration.php'; $fields= "[ {'name':'name'}, {'name':'email'}, {'name':'location'}, {'name':'gender'}, {'name':'birthday'}, {'name':'password'}, {'name':'like', 'description':'Do you like this plugin?', 'type':'checkbox', 'default':'checked'}, {'name':'phone', 'description':'Phone Number', 'type':'text'}, {'name':'anniversary','description':'Anniversary', 'type':'date'}, {'name':'captain', 'description':'Best Captain', 'type':'select', 'options':{'P':'Jean-Luc Picard','K':'James T. Kirk'}}, {'name':'force', 'description':'Which side?', 'type':'select', 'options':{'jedi':'Jedi','sith':'Sith'}, 'default':'sith'}, {'name':'live', 'description':'Best Place to Live', 'type':'typeahead', 'categories':['city','country','state_province']}, {'name':'captcha'} ]"; $clientId=APP_ID;

0 Comment:

Post a Comment