Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API overriding explicitly set Privacy settings

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?

like image 330
Mark Murfin Avatar asked Aug 29 '11 01:08

Mark Murfin


2 Answers

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/

like image 197
Alexcode Avatar answered Nov 13 '22 10:11

Alexcode


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

like image 35
Dhiren Patel Avatar answered Nov 13 '22 10:11

Dhiren Patel