CodeIgniter Forums

Full Version: Help needed for CI and Facebook problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]sajid19991[/eluser]
Hello Dear Fellas,

im working on a project which requires me to validate if a user has liked the company's fb page or not, if not then that members account will not be active or else active, but im stuck on the fb like validation thing....how to validate if a user has liked the page or not? and of course with codeigniter and jquery.

For I.E....user123 is added in database and is logged in to facebook.

how to validate if user123 has liked the page facebook,com/somepage ...?.


Please guys help me, im stuck here, im not new to coding but im new to facebook sdk, im very much familiar with ci....

El Forum

[eluser]InsiteFX[/eluser]
See the Facebook Developers API

Facebook for Web Developers

El Forum

[eluser]sajid19991[/eluser]
[quote author="InsiteFX" date="1356741412"]See the Facebook Developers API

Facebook for Web Developers
[/quote]

hi, thanx for your help, but couldnt find there what i wanted...

El Forum

[eluser]pickupman[/eluser]
You first need to setup an application to get an app_id from the link InsiteFX gave you. Using the app id, you would need to get users to authorize your app to their account. Once they accept the permissions of your app, you are able to use the API to see if they have like your specific page.

jQuery is not really used in any way, as Facebook uses their specific Javascript SDK.

I have this on a Facebook page to create a signup form if a user doesn't like a page yet:
Code:
require 'facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => 'your_app_id',
  'secret' => 'your_app_secret',
  'cookie' => true
));

$signed_request = $facebook->getSignedRequest();

var_dump($signed_request);

This works for application/page that is accessed on Facebook. If you are trying to handle this data on your own website, without Facebook at all, would likely require using oAuth.

El Forum

[eluser]sajid19991[/eluser]
[quote author="pickupman" date="1356803794"]You first need to setup an application to get an app_id from the link InsiteFX gave you. Using the app id, you would need to get users to authorize your app to their account. Once they accept the permissions of your app, you are able to use the API to see if they have like your specific page.

jQuery is not really used in any way, as Facebook uses their specific Javascript SDK.

I have this on a Facebook page to create a signup form if a user doesn't like a page yet:
Code:
require 'facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => 'your_app_id',
  'secret' => 'your_app_secret',
  'cookie' => true
));

$signed_request = $facebook->getSignedRequest();

var_dump($signed_request);

This works for application/page that is accessed on Facebook. If you are trying to handle this data on your own website, without Facebook at all, would likely require using oAuth.[/quote]

thanx a lot dear, im quit familiar with facebook php and javascript sdk, but the problem which im facing is the code, could you provide me a bit of sample code on how to validate if a user has liked the page? I have setted up oauth, tokens, permission everything,,,,and im using this app out of facebook....so using oauth....

El Forum

[eluser]pickupman[/eluser]
The $signed_request variable from the code above will return a an array with the index $signed_request['pages']['like'] as a boolean value. If true, the user has already liked your page.

El Forum

[eluser]sajid19991[/eluser]
[quote author="pickupman" date="1356829180"]The $signed_request variable from the code above will return a an array with the index $signed_request['pages']['like'] as a boolean value. If true, the user has already liked your page.[/quote]


thanx pickupman.....i will try this for one of my app on FB when i get time.....i needed a solution for Web App out of fb. i guess it will be something similar so will try it and post it here....