0

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?

4

1 回答 1

2

当您查看Requests 对话框的描述时,您会注意到参数exclude_ids,您可以通过该参数指定将从多朋友选择器中排除的用户 ID。

因此,如果您在数据库中查找您的用户已经向他们的哪些朋友发送了请求,您可以将这些 id 放在那里。

唯一警告:移动设备不支持此参数;因此,如果您的目标是这些,您可能需要寻找另一种解决方案(最有可能创建您自己的多朋友选择器)——但我现在不确定此限制是否仅适用于本机移动应用程序;也许当在网络应用程序中使用 JS SDK 时,它也可以在这些应用程序上工作(文档中的措辞并不完全清楚)。

于 2013-09-08T12:11:29.793 回答