Search code examples
phpjqueryfacebookfacebook-likefacebook-social-plugins

How do I make a fallback for Facebook Facepile Social Plugin?


How would I go about creating a content fallback if the user is not logged into Facebook or does not have any friends who "Liked" my website? The problem I am experiencing is if the above requirements are not met, I get a blank spot on my site where the Facepile plugin would ordinarily show up.


Solution

  • You can use FB.getLoginStatus in the JS SDK to see if the person is logged into Facebook and connected to your site.

    You can use FB.api to call /me/likes to see if the current user liked your site and then conditionally hide/show different elements on the page in JavaScript.