7

I'm having problems setting the privacy for posts created by my App on behalf of the user.

The problem is that all the posts are getting their privacy value set as ALL_FRIENDS by the Graph API, even though I'm explicitly setting the privacy value to EVERYONE.

This is the code I'm using to submit:

$query = 'message='. urlencode($message) .'&privacy='. urlencode('{"value":"EVERYONE"}');
$url = 'https://graph.facebook.com/'. $obj_id .'/feed?access_token='. $user_fb_access_token;

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($curl, CURLOPT_REFERER, $referrer);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($curl);

curl_close($curl);

Thats it.

This code worked perfectly up until sometime in August when I noticed it.

Anyone else having this issue?

Mark Murfin
  • 776
  • 8
  • 19
  • I dont know the answer to your problem, but i do know that facebook had some major upgrades regarding their privacy handlers and etc. maybe your code is now broken as a result of those upgrades. http://www.ibtimes.com/articles/202801/20110823/facebook-privacy-revamp-upgrade-security-overhaul-tagging-photo-google.htm – Michael Schinis Aug 29 '11 at 01:57
  • Of course, the snarky comment should be: Privacy? On Facebook? BWahahahahahaha. – Marc B Aug 29 '11 at 03:13

3 Answers3

7

This is related to the new per-app post privacy control, if is set to Friends so this App can only set privacy as wide as friends.

Please read the following blog post for more info: https://developers.facebook.com/blog/post/543/

Alexcode
  • 1,598
  • 7
  • 15
1

In your example, you're creating a comment, not a post. Comments don't support the privacy={} parameter.

Dhiren Patel
  • 645
  • 4
  • 6
  • You're right about this example. Sorry. There is a little extra code in my actual script that switches the $url value around depending on whether I'm posting a new post or commenting on a post. I copied the wrong one for this example. Should be fixed now. – Mark Murfin Aug 29 '11 at 13:07
0

This isn't in their graph API docs, but they changed "everyone" to "public" in the UI this month to try and clarify to users what "everyone" meant...

try using '{"value":"PUBLIC"}' and see if it works.

Brian Roach
  • 76,169
  • 12
  • 136
  • 161