Question

While coding I have started wondering if there is a possibility to perform an action before the actual request is send.

For example I have a code:

FB.ui({method: 'apprequests',
    title: 'The Challenge Game!',
    message: 'I challenge you!',
}, challengeCallback);

And I would like my user to be able to challenge a friend only once - that means, If a challenge exists in DB connecting two users, there should not be another challenge created until the first one is finished or expired.

So between picking friends and sending requests there should be a function call.

However I know, that I won't get users fb_id before the request is actually send.

I can always prompt my user, after choosing friends, that the challenge for that particular person already exists and is pending. But what happens to request that is waiting for the challenged in his/hers inbox?

Is there something I can do not being made to create my own friend picker? Maybe alter FB.ui somehow?

Was it helpful?

Solution

When you look at the description of the Requests dialog, you’ll notice the parameter exclude_ids, by which you can specify user ids that will be excluded from the multi-friend selector.

So if you look up in your database which of their friends your user has already send a request to, you can put those ids in there.

Only cave-at: This parameter is not supported on mobile devices; so if you are targeting those, you might have to look for another solution (which would be most likely to create your own multi-friend selector) – but I’m not sure right now whether this restriction only applies to native mobile apps; maybe when using the JS SDK in a web-app it’ll work on those as well (the wording in the docs is not totally clear on that).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top