开发者

Testing for permissions for wall delivery

开发者 https://www.devze.com 2023-04-11 00:23 出处:网络
This is a first time post.Myself and another devel开发者_如何学JAVAoper have built an application to allow non-profits to easily setup a facebook gift storefront.http://apps.facebook.com/goodgiftsdemo

This is a first time post. Myself and another devel开发者_如何学JAVAoper have built an application to allow non-profits to easily setup a facebook gift storefront. http://apps.facebook.com/goodgiftsdemo

We've recently run into a problem I don't know how to solve.

Some users have set permissions so they don't allow you to post to their wall so we can't deliver the gift. The problem is we have no way to find out until we get too deep into the flow. Here is the error code:

OAuthException: (#210) User not visible

Is there any way in the api to query whether the recipient can actually receive a wall post?

From the FB forum:

"When trying to stream publish (http graph api, granted stream publish, the 2 users are friends) to a User, whose wall was set to Visible to "ONLY ME" (a rather obscure setting deep in privacy)"

Anyone know a way to query a friend to see if we'll be able to complete delivery?


I don't think there's any way to query a user's privacy settings like this - best solution is likely to catch the error when the calling user hasn't got permission to write on the intended recipient's wall and surface this in your application


You can check for the stream_publish permission using a FQL query...

var query = FB.Data.query('select stream_publish from permissions where uid={0}', session["uid"]);
query.wait(function(rows) {
    if(rows[0]['stream_publish']){
        alert("user has permissions");
    }
    else{
        alert("user does not have permissions");
    }
});


You can test if the current user/application can post to the target uid's wall with the following query:

select can_post from user where uid=?
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号