Facebook LIKE button hiding when page is already LIKED by user
Asked Answered
L

3

1

I'm trying to create a page on my site where the Like button should be hidden if the user already likes the page. If I can't hide it, then maybe there's a way to get a callback when the like button is rendered with a user who already likes the page. This way I can hide/reveal the iframe myself.

Any clues?

Howie

Labored answered 2/7, 2010 at 3:39 Comment(4)
How are you storing the likes. How are you generating the page.Breakfront
@Graphain Facebook stores likes, not the site.Kessiah
@Kessiah Yeah the OP mentioned Facebook in the title but Ward is talking about their own site so I assumed it was their own like buttons.Breakfront
@Graphain Facebook allows you to embed a Facebook "Like" button on your site. The code's hosted by and saves to Facebook.Kessiah
B
0

Assuming you can echo the ids of the like buttons to the page for the likes you want hidden/get from a JSON call.

var hideLikes = ["#like1", "#like2", "#like3", "#like4", "#like5"]; 
var hideLikesSelector = hideLikes.join(",");
$(hideLikesSelector).hide();
Breakfront answered 2/7, 2010 at 3:48 Comment(2)
thanks. The hiding part I have down. It's determining whether or not the visitor already likes the page when it loads that I can't figure out. There must be something that changes when the like button is rendered if the user already likes the page. I figured I can tap into that and hide the element accordingly.Labored
I wouldn't know but surely the like button doesn't render if they already like it?Breakfront
L
0

You should not hide the Like button as you're suggesting. It is against Facebook policy to hide it after the user has liked the thing in question, you should give them the opportunity to unlike it if they chose to do so.

Linotype answered 12/7, 2010 at 1:1 Comment(0)
H
0

@Graphain, why are you commenting? You have no valid input.

@Others, I have been trying this too and had it working by looking at the opacity of certain tag's classes but it no longer works again. You can make an api call to /me/likes and go through the returned array to look at each name or id...

Hope that helps.

Hydrops answered 19/1, 2011 at 11:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.