duancao1951 2011-11-07 11:53
浏览 25
已采纳

Facebook应用程序 - 检查用户是否是页面所有者(PHP SDK)

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?

  • 写回答

1条回答 默认 最新

  • dpb56083 2011-11-07 11:59
    关注
    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/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么