我正在尝试使用以下代码为Facebook评论社交插件添加主持人。似乎无论我输入什么Facebook用户ID,唯一可以缓和的用户是被设置为应用程序管理员的人(在Facebook方面)。任何人都可以建议我可能做错了什么。
<!DOCTYPE html>
<html xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<meta property="fb:admins" content="xxxxxxxxxxxxxxxx"/>
<meta property="fb:moderator" content="xxxxxxxxxxxxxxxxxx"/>
<meta property="fb:app_id" content="xxxxxxxxxxxxxxxxxxx"/>
</head>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#appId=xxxxxxxxxxxxx&xfbml=1"></script>
<fb:comments href="" numposts="10" width="480" colorscheme="dark" migrated=1> </fb:comments>
</div>
<div id="user-info"></div>
<p>
<button id="fb-auth">
Login
</button>
</p>
<script>
//Facebook
window.fbAsyncInit = function() {
FB.init({
appId: 'xxxxxxxxxxxxxxxxxx',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
function updateButton(response) {
var button = document.getElementById('fb-auth');
if (response.authResponse) {
//user is already logged in and connected
var userInfo = document.getElementById('user-info');
var actionInfo = document.getElementById('action-info');
FB.api('/me', function(response) {
userInfo.innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture">' + response.name;
button.innerHTML = 'Logout';
});
button.onclick = function() {
FB.logout(function(response) {
var userInfo = document.getElementById('user-info');
userInfo.innerHTML="";
});
};
} else {
//user is not connected to your app or logged out
button.innerHTML = 'Login';
button.onclick = function() {
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
var userInfo = document.getElementById('user-info');
userInfo.innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture" style="margin-right:5px"/>' + response.name;
});
} else {
//user cancelled login or did not grant authorization
}
}
,{scope:'email'}
);
}
}
}
// run once with current status and whenever the status changes
FB.getLoginStatus(updateButton);
FB.Event.subscribe('auth.statusChange', updateButton);
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
</body>
</html>