facebook fan gate只能使用管理员帐号Javascript [英] facebook fan gate only work with admin account Javascript
问题描述
我已经检查了页面ID,这是正确的。
感谢您的帮助
FB.getLoginStatus(function(response){
if(response.status = ='connected'){
var user_id = response.authResponse.userID;
var page_id =[pageid];
var fql_query =SELECT uid FROM page_fan WHERE page_id =+ page_id +和uid =+ user_id;
var the_query = FB.Data.query(fql_query);
the_query.wait(function(rows){
if(rows.length == 1&& rows [0] .uid == user_id){
$(#container)。show();
$(#container_notlike) .hide();
$(#notloggedin)hide();
alert(用户喜欢页面)
}
else {
$(#container_notlike)。show();
$(#container)。hide ;
$(#notloggedin)。hide();
alert(User not like page)
login();
}
});
} else {
$(#container_notlike)。hide();
$(#container)。hide();
$(#notloggedin)。show();
login();
}
});
}
init();
从评论来看,似乎你的登录代码实际上并不是要求 user_likes
许可,您需要检查页面是否被没有完全公开的用户喜欢
Re:评论中的另一个问题,请参阅< a href =https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/ =nofollow> https://developers.facebook.com/docs/reference/javascript/FB .Event.subscribe / - 订阅edge.create回调,当点击相似按钮时,您会收到通知。
I have a facebook fan gate in my facebook app (iframe app), but it's only working when logged in with the administrator account. When i was testing the app without sandbox mode with normal users they get stuck in the not fan section, but they are fans. I have checked the page ID, it's correct. Thanks for help
FB.getLoginStatus(function (response) {
if (response.status == 'connected') {
var user_id = response.authResponse.userID;
var page_id = "[pageid]";
var fql_query = "SELECT uid FROM page_fan WHERE page_id =" + page_id + " and uid=" + user_id;
var the_query = FB.Data.query(fql_query);
the_query.wait(function (rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
$("#container").show();
$("#container_notlike").hide();
$("#notloggedin").hide();
alert("User like page")
}
else {
$("#container_notlike").show();
$("#container").hide();
$("#notloggedin").hide();
alert("User NOT like page")
login();
}
});
} else {
$("#container_notlike").hide();
$("#container").hide();
$("#notloggedin").show();
login();
}
});
}
init();
From the comments, it seems your Login code wasn't actually asking for the user_likes
permission which you'll need to check if the page is liked by users who don't have completely Public likes
Re: the other question in the comments, see https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/ - subscribe to the edge.create callback and you'll be notified when the like button is clicked
这篇关于facebook fan gate只能使用管理员帐号Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!