dongzan2740 2013-04-04 12:26
浏览 19
已采纳

我的Facebook标签应用无法在用户NOT管理员使用时将照片发布到页面墙上

Alright, here's what I'm facing:

I have made an app for my facebook fan page, my app is a Facebook Page Tab app.

I have added the application to my facebook page by following:

http://developers.facebook.com/docs/appsonfacebook/pagetabs/

respectively, entering:

http://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL

and choosing which page to be added to.

When I have done this I did it with my Facebook Page Admin user.

I have allowed manage_pages and publish_stream and publish_actions permissions.

Here is my code:

$objFacebook = App_Utils_Facebook::getFacebook();

    $user_id = $objFacebook->getUser();
    $objFacebook->setFileUploadSupport(true);


    if(isset($_REQUEST['pageId'])){
        $arrPriv = $objFacebook->api("/".$_REQUEST['pageId']."/", array('fields'=>'access_token'));
        $link = 'http://link/here/'.$this->objAnunt->id;
    }


    $privacy = json_encode(array('value'=>'SELF'));

    if(isset($arrPriv['access_token'])){
        $access_token = $arrPriv['access_token'];
    }else{
        $access_token = $objFacebook->api("/".$_REQUEST['pageId']."/", array('fields'=>'access_token'));
    }


    if($user_id){
        try{
            $ret=$objFacebook->api("/".$arrPriv['id']."/photos",'POST',array(
                    'source'=>'@link/to/pic.jpg',
                    'message'=>$strTitle.'

                               For more details click here  '.$link,
                    'access_token'=>$access_token,
                    'privacy'=>$privacy
                                                )
            );
            unlink('link/to/pic.jpg');
        }catch(FacebookApiException $e) {
            echo $e;
        }
    }else{
            $permissions = $objFacebook->api("/me/permissions");
            if( !array_key_exists('publish_stream', $permissions['data'][0]) ||
            !array_key_exists('manage_pages', $permissions['data'][0])) {
                // We don't have one of the permissions
                // Alert the admin or ask for the permission!
                header( "Location: " . $objFacebook->getLoginUrl(array("scope" => "publish_stream, manage_pages")) );
            }
    }

So I repeat myself, I want to allow the average user to access my application and THE PAGE ITSELF to post on it's own wall.

Can I do it? If not are there any alternatives.

Thank you for your time and patience to help me figure this out!

  • 写回答

1条回答 默认 最新

  • doulun5683 2013-04-04 13:05
    关注

    As far as I know, you do not need the manage_pages permission to post to a page.

    Please see this documentation.

    Making an API call to /{page_id}/feed using a valid user access_token should be enough to post to a page's feed.


    As mentioned in the comments, Facebook probably doesn't allow a common user to upload photos to a page's albums. You'll need an access_token from an admin of that page (ensuring that the manage_pages permission is granted), retrive the page access token, and upload photos that way.

    That page access token should be good for the life of the user access token.

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度