문제

I am writing an app to add to users pages and need it to do the following:

1) When a user adds my app to their page, a form will appear asking for them to complete some details prior to the app fully working.

2) If any other user visits this page and the details have not been entrered by the page owner, a message appears saying 'not currently set up'.

3) Once the page owner has completed the details the app will be displayed on their page and any user visiting the page will see this.

I therefore need to detect whether the current user is the page owner, if so do a check to see if they have completed the details or not to decide what to display on the page. I am using the PHP SDK. Can anyone help with this?

도움이 되었습니까?

해결책

require_once('facebook.php');
$facebook = new Facebook(array(
    'appId'=>'', // replace with your value
    'secret'=>'' // replace with your value
));
$signedRequest = $facebook->getSignedRequest();

The $signedRequest variable has a page['admin'] boolean variable that tells you if the user is an admin of that page.

So you can just do a check:

if( $signedRequest['page']['admin'] )

http://developers.facebook.com/docs/authentication/signed_request/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top