O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making Content Visible to Some Users in Profile Boxes

Problem

I’d really like to make some of the content in my Profile Boxes visible to only a select group of users.

Solution

The fb:visible family of tags will do exactly what you’re looking for. Think of them as the big, burly bouncers who stand inside the velvet rope and won’t let you into the club unless you’re on the magic list. In this case, their clipboards actually contain eight different lists:

fb:visible-to-owner

Content that is visible only to the owner of the Profile.

fb:visible-to-user

Content that is visible only to the specified users. Include a uid parameter containing one or more comma-separated Facebook uids to control who can see it.

fb:visible-to-app-users

Content that is visible only to users who have also added the app and have agreed to the Terms of Service and been granted full permission.

fb:visible-to-connection

Content that is visible only to friends of the user who owns the Profile, or fans of the Page if used on a Page. Note that this effectively replaces fb:visible-to-friends, which worked only on user Profiles.

fb:18-plus

Content that is visible only to users who are 18 years old or older. Unlike the rest of the visible tags, this one and the fb:21-plus tag can both contain an fb:else tag (which displays alternate content) and can be used on Canvas pages.

fb:21-plus

Content that is visible only to users who are 21 years old or older. As per the previous tag, this can contain an fb:else tag to display alternate content ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required