CodeIgniter Forums
Help needed for CI and Facebook problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Help needed for CI and Facebook problem (/showthread.php?tid=56531)



Help needed for CI and Facebook problem - El Forum - 12-28-2012

[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....


Help needed for CI and Facebook problem - El Forum - 12-28-2012

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

Facebook for Web Developers



Help needed for CI and Facebook problem - El Forum - 12-29-2012

[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...


Help needed for CI and Facebook problem - El Forum - 12-29-2012

[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.


Help needed for CI and Facebook problem - El Forum - 12-29-2012

[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....


Help needed for CI and Facebook problem - El Forum - 12-29-2012

[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.


Help needed for CI and Facebook problem - El Forum - 12-31-2012

[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....