Facebook要求2.0过滤器 [英] Facebook requests 2.0 filter
问题描述
所以我希望有人打电话帮助我这个问题,因为我不太确定如果它的JavaScript,或如果它的Facebook。
这是我的情况。我在Facebook上升级为请求2.0,这不再允许我添加一个exclude_ids字段到用户将邀请他们的朋友到App的表单。此表单的目的不是邀请朋友,而应该在App中添加朋友。
简而言之,我有一个已经添加的朋友列表,我想从他们的朋友的主列表中过滤,以便当他们想要使用表单,已经添加的朋友不会显示。
这是我的javascript来获取朋友:
< script language =Javascripttype =text / javascript>
var friends_filter ='<?= $ myClass-> getFiltered());?>';
< / script>
将返回以下内容:
999999999,999999999,999999999,999999999,999999999,999999999,999999999
哪些是他们没有添加的用户的ID列表,他们的朋友。
这是我的代码:
function addUser(){
FB.ui(
{
method:'apprequests',
display: '对话',
标题:'添加好友',
消息:'嘿,我添加你作为这样的应用程序的用户/朋友,
数据:'添加' ,
过滤器:[{name:'Non-Added',user_ids:[friends_filter]}],
},
function(response){
if(response&& ; response.request_ids){
showLoading('Adding Relatives');
var dataString ='rids ='+ response.request_ids;
$ .ajax({
type: GET,
url:server_url +ajax / add_relative.php,
data:dataString,
success:function(data){
window.location.reload();
}
});
}
}
);
}
如果您查看过滤器:[{name :'non-Added',user_ids:[friends_filter]}],
行,那就是我在选择器中只想看到IDS的列表。弹出对话框,然后在 friends_filter
中列出这些ID,并显示一条错误消息,指出无法解析为有效的用户ID
这是我感到困惑的地方,如果我复制粘贴什么 friends_filter
输出,并将其替换为 friends_filter
与ID的列表,即 999999999,999999999,999999999,999999999,
完全一样,它的工作正常。
我知道这是一个详尽的帖子,我很抱歉,但我是在我的智慧结束。
我唯一可以想到的是,也许我的javascript变量 friends_filter
需要转换为某种类型某些类型?
任何想法?
代码,它与我一起工作
FB.ui(
{
method:'apprequests' ,
过滤器:['app_non_users'],
message:'msg here!',
title:'title for box'
},
function(response) {
alert(response.request_ids); //发送邀请后返回
}
);
只要您希望过滤结果与用户列表一起使用
过滤器:[{name:'Invite friends',user_ids:<?php echo json_encode($ users_array);?> }],
So I hope someone call help me with this issue as I'm not too sure if its javascript, or if its facebook.
Here's my situation. I upgraded to Requests 2.0 on facebook, which no longer gives me the ability to add an exclude_ids field to the form where users will invite their friends to the App. The purpose of this form is not to just invite friends, but to add friends as something in the App.
In short, I have a list of friends that they have already added, and I want to filter that from the master list of their friends so that when they want to use the form, the friends already added do not show up.
Here is my javascript to get the friends:
<script language="Javascript" type="text/javascript">
var friends_filter = '<?=$myClass->getFiltered());?>';
</script>
Will return something like:
999999999,999999999,999999999,999999999,999999999,999999999,999999999
Which is a list of IDs of the users who they have NOT added that are their friends.
Here is my code for the form:
function addUser() {
FB.ui(
{
method: 'apprequests',
display: 'dialog',
title: 'Add friends',
message: 'Hey, I added you as a user/friend on such-and-such App',
data: 'added',
filters: [{name: 'Non-Added', user_ids: [friends_filter]}],
},
function(response) {
if(response && response.request_ids) {
showLoading('Adding Relatives');
var dataString = 'rids='+response.request_ids;
$.ajax({
type: "GET",
url: server_url+"ajax/add_relative.php",
data: dataString,
success: function(data){
window.location.reload();
}
});
}
}
);
}
If you look at the filters: [{name: 'Non-Added', user_ids: [friends_filter]}],
line, that is where I include the list of IDS that I only want to see in the selector. The dialog pops up, but then list those ID's in friends_filter
and an error message stating "does not resolve to a valid user ID"
This is where I get confused, if I copy and paste what friends_filter
outputs and replace it the friends_filter
with the list of IDs, i.e. 999999999,999999999,999999999,999999999,
exactly as it appears, it works correctly.
I know this is an exhaustive post and I'm sorry, but I'm at my wits end.
The only thing I could think of is that perhaps my javascript variable friends_filter
needs to be converted to some type of some sort?
Any ideas?
i was try this code and it is work good with me
FB.ui(
{
method: 'apprequests',
filters: ['app_non_users'],
message: 'msg here!',
title: 'title for box'
},
function(response) {
alert(response.request_ids);//this is return after send invite
}
);
just if you want filter result with list of user use
filters: [{name: 'Invite friends', user_ids: <?php echo json_encode($users_array);?> }],
这篇关于Facebook要求2.0过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!