开发者

Problem Getting mutual friends of logged in facebook account and other account FBML

Well at the current moment I'm attempting to get the mutual friends between two users, and then pick a random one of those. It then gets the name of the random mu开发者_运维技巧tual friend, but it's not working for some reason.

here's what I have (where $lg_userid is the logged in users id, and $target_id is the friend, I then get the mutual friends between them and pick a random one)

$common = $facebook->api_client->friends_getMutualFriends($lg_userid,$target_id);
$one_common = array_slice(array_shuffle($common), 0, 1);
$common_user_details = $facebook->api_client->users_getInfo($one_common, array('first_name'));
$firstnamecommon = $common_user_details['first_name'];

It's giving me this error

Error message: The underlying FQL query made by this API call has encountered the following error: Can't lookup all friends of (not logged in user id); can only lookup for the logged in user (logged in user) or for pairs of users Error code:13

Not really sure what I'm doing wrong, could anyone help me out?

Thanks!


I think the error is that you are trying to lookup mutual friends between two of your friends and one of their privacy settings disallow showing friends. For example:

var sql = "SELECT uid1 FROM friend WHERE uid2=" + friendId + " AND uid1 IN (SELECT uid2 FROM friend WHERE uid1=" + userUid + ")";

The above FQL works fine between you and pretty much any of your friends, but not between two of your friends.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜