I’m tried invite multiple users to a event.
reading the documentation facebook, I found this:
http://developers.facebook.com/docs/reference/api/event/#invited
I wrote the following code(that does not works):
$facebook = new Facebook(array(
'appId' => '',
'secret' => '',
'cookie' => true,
));
if ($user = $facebook->getUser()) {
$friends = $facebook -> api('/me/friends');
$e_id = ""; //the event id
$friends = $friends['data'];
$e_details = $facebook -> api("/{$e_id}"); //information about the event
for($ids = null,$i = 0,$len = count($friends); $i < $len; $i++) {
$friend = $friends[$i];
$ids .= $friend['id'].',';
}
$data = $facebook -> api("/{$e_id}/invited?users={$ids}", 'POST');
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl(array('scope' => 'create_event'));
}
I’m getting the fowllowing error:
Uncaught OAuthException: (#200) Permissions error thrown in
what’s the permission that he is saying? of according to the documentation only one permission is necessary, which I set.
Can someone point out my error? Any help is appreciated. Thanks in advance.
so first try and store the ids in an array not sure if the trailing comma is messing with it. Also remove your self if it is in the list. you can also test the call at http://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fgroups to see if there is anything else to test for. Maybe add a test to double check if the user has the create_event permission as well.