在 Facebook 应用程序中邀请好友

发布于 2024-07-24 22:12:27 字数 486 浏览 4 评论 0原文

我有一个在 facebook 平台上发布的 facebook 应用程序,我使用 facebook API 来邀请朋友,并且我已成功创建邀请表单,但问题是,当您邀请朋友并发送邀请并将邀请请求发送给用户和用户时接受它 该朋友再次出现在可以再次邀请的朋友列表中

例如:

我的朋友列表中有一个名为 X 的朋友,当我向他发送邀请时,邀请已发送,并且 X 接受邀请,当我尝试发送时邀请再次出现,朋友 X 再次出现在列表中,我可以从中选择发送邀请,这意味着我可以向该用户 (X) 发送邀请,并且他已经在玩游戏了,我需要知道如何解决此问题,所以朋友仅显示在好友列表中(用于邀请)不使用该应用程序的好友。

我的申请在以下链接 我的游戏应用程序 访问它并查看邀请好友后再次出现的问题,这在任何游戏应用程序中都是正常的吗?

预先感谢您的任何回复

I have a facebook application that is published at facebook platform and i used facebook API to invite friends and i have succeeded in creating invitation form but the problem is that when u invite friend and send invitation and the invitation request sent to the user and the user accept it this friend appears again in the friend list that can be invited again

For example :

i have friend in my friend list named X and when i send invitation to him the invitation is sent and and X accept the invitation and when i try to send invitation again the friend X appears again in the list that i can select from to send invitation this means that may i send an invitation to this user (X) and he is already playing the game i need to know how to fix this problem so friends appear in the friend list (for invitation )only friends that not use the application.

My application at the following link
My Game application
visit it and see the problem exactly after inviting friends they will appear again is this normal in any game application?

thanks in advance for any reply

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め可乐爱微笑 2024-07-31 22:12:27

在 FBML 中,如果您使用好友选择器你可以向它传递一个数组exclude_ids。 如果您使用 api 来查找已经在使用您的应用程序的用户的朋友,您可以通过这种方式排除他们。

这也适用于multi-friend-selector< /a> 位于 fb:请求表单 标签。

编辑:要排除的用户数组可以通过API调用获取Friends.getAppUsers

以下示例使用 .NET Facebook 开发人员工具包。 (主要是因为我以前就是这样做的!)

代码隐藏:

public string CURRENT_USER_FRIENDS = "";

//Call this function on pageload or where you like
private void PopulateFriendsData()
{
//exclude friends who already have the app from the inviter
string UsersToExclude = string.Empty;
IList<long> AppUserFriends = this.Master.API.friends.getAppUsers();
foreach (long L in AppUserFriends)
{
    UsersToExclude += L.ToString() + ",";
}
CURRENT_USER_FRIENDS = UsersToExclude.TrimEnd(',');
}

页面:

<fb:multi-friend-selector 
actiontext="Select the friends you want to invite" 
rows="3" 
exclude_ids="<%=CURRENT_USER_FRIENDS%>"/>

In FBML if you are using the friend-selector you can pass it an array exclude_ids. If you use the api to find the users' friends who are already using your app, you can exclude them this way.

This also works in the multi-friend-selector which sits inside an fb:request-form tag.

EDIT: the array of users to exclude can be obtained through the api call Friends.getAppUsers.

Following example uses the .NET Facebook Developer Toolkit. (mainly because that's how I've done it before!)

CODE BEHIND:

public string CURRENT_USER_FRIENDS = "";

//Call this function on pageload or where you like
private void PopulateFriendsData()
{
//exclude friends who already have the app from the inviter
string UsersToExclude = string.Empty;
IList<long> AppUserFriends = this.Master.API.friends.getAppUsers();
foreach (long L in AppUserFriends)
{
    UsersToExclude += L.ToString() + ",";
}
CURRENT_USER_FRIENDS = UsersToExclude.TrimEnd(',');
}

PAGE:

<fb:multi-friend-selector 
actiontext="Select the friends you want to invite" 
rows="3" 
exclude_ids="<%=CURRENT_USER_FRIENDS%>"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文