Reputation: 4975
When a request is sent using the new fbjs requests 2.0 on Facebook: 1 - a notification is shown under the globe icon in the header 2 - a incremental number is shown next to the app name on the left menu
If the user clicks the notification, request_ids=123... is appended to the url. This can be used to clear out the request. If they navigate to the app another way such as the left menu, the requests are passed. So if the user skips over the notifications, they accumulate a lot of outstanding requests.
Is there a way to get all outstanding requests for a user without relying on them clicking the notifications?
Upvotes: 2
Views: 647
Reputation: 47966
To retrieve all the users outstanding requests you can make a call as follows :
$facebook->api('/me/apprequests/');
You can retrieve all the data for all the requests (for your application) into an array and remove them from facebook.
// Retrieve ALL request-2.0's for user
$res = $facebook->api('/me/apprequests/');
$requests = $res['data'];
foreach ($requests AS $request){
echo 'Deleting '.$request['id'] . '<br/>';
$facebook->api('/'.$request['id'].'/','DELETE');
}
Now you have all the users outstanding requests in $requests
and you can act accordingly.
Upvotes: 6