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 ...

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.