开发者

Facebook Like button - how to get the number of friends who 'liked' something

开发者 https://www.devze.com 2023-02-03 14:52 出处:网络
Is it possible to get the number of a user\'s friends who clicke开发者_StackOverflowd \'Like\' on a particular item on a page on my site? i.e. something along the lines of \'45 of your friends Like th

Is it possible to get the number of a user's friends who clicke开发者_StackOverflowd 'Like' on a particular item on a page on my site? i.e. something along the lines of '45 of your friends Like this'.

Cheers.


I did have the exact same issue, and I'm not satisfied with the option show_faces cause I wanted to have an integer value.

I found the solution using FQL query :

select uid from page_fan where uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND page_id ='000000000'

it will give you a list in json, using .length will give you the number!


When you put a like button on a website, facebook renders it in the following format:

a) if the current user is logged in on facebook: Friend 1, Friend 2 and x others like this (or just the number of total likers if no friend like that)

b) if the current user is not logged in: x people like this.

In order to get the above result, you need to use standard layout and to have show_faces value set to true. If you want to customize that, you have to use the Graph API/FQL. But it is not that simple :)


Facebook can do all the hardwork for you and generate a like button:

http://developers.facebook.com/docs/reference/plugins/like


Yes it is, checkout Facebook's API. Facebook "Objects" that can be liked have the 'likes' property.

http://developers.facebook.com/docs/reference/api/

0

精彩评论

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

关注公众号