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 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C