如何检查用户是否已经喜欢该 Facebook 页面?
我的网站上有一个喜欢按钮(供用户喜欢 Facebook 粉丝页面)。
如果用户单击“喜欢”,我会检查事件是否已被触发(事件订阅),然后向他们显示一些内容。
我非常感谢您提供以下帮助:
如果用户登录了 facebook 并且他们已经喜欢该页面,我希望它显示“您已经一个粉丝!”并显示内容。 (而不是显示灰色的“点赞”按钮)
或
如果用户未登录 facebook 并且他们点击了“点赞”按钮,我希望它显示“您是已经是粉丝了!”并显示内容。 (而不是显示灰色的类似按钮)
编辑:伙计们,我对此进行了研究,并发现了类似的问题,但不完全是我所追求的。也许我错了,但如果有人可以提供一个描述我的确切问题的链接,那么它会比问题上的“-”更有帮助。我已检查以下内容:
检查用户是否连接到 Facebook,然后检查他是否喜欢某个页面
Facebook Like Box:如何检测是否用户已经喜欢该页面?
当页面已被喜欢时 Facebook LIKE 按钮隐藏用户
如何检查是否用户喜欢该页面或未使用 php/javascript
检查用户是否已经喜欢粉丝专页
I have a like button on my website (which is for users to like the fb fan page).
If the user clicks like, I check to see if the even has been fired (event subscribe), and then display some content to them.
What I would really appreciate help with is the following:
If the user is logged in to facebook AND they already like the page, I want it to display "You're already a fan!" and show the content. (rather than displaying the greyed out like button)
OR
If the user is not logged in to facebook and they click the like button, I want it to display "You're already a fan!" and show the content. (rather than displaying the greyed out like button)
edit: Guys, I've researched this on SO and have found similar questions but not quite what I'm after. Maybe I'm mistaken but if someone can provide a link to one which describes my exact problem, it would be a lot more helpful than a - on the question. I have checked the following:
Check if the user is connected to facebook and then check if he liked a page
Facebook Like Box: How to detect if user already liked the page?
Facebook LIKE button hiding when page is already LIKED by user
How to check whether user has liked the page or not using php/javascript
Check if user already likes fanpage
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 facebook php API。我想出了这个简短的函数,您可以将其包含在 BaseFacebook 类的 base_facebook.php 文件中。
If you use the facebook php API. i've came up with this short function that u can include inside the base_facebook.php file into the class BaseFacebook.
确保您使用的是 xfbml,
这个对我有用
page_id 将是 id 而不是您页面的名称,要查找 id,只需访问
http://graph.facebook.com/[your fb page name]
希望如此将来帮助某人。
Make sure you are using xfbml,
this one works for me
page_id will be the id not the name of your page, to find out the id, just visit
http://graph.facebook.com/[your fb page name]
hope this helps someone in the future.