Display Content to Network Members
Problem
How do I display content only to members of a specific network?
Solution
Use the fb:is-in-network
tag and specify the network and uid
s. The simplest form is:
<fb:is-in-network network="12345" uid="12345">Private content goes here</fb:is-in-network>
Discussion
Although this tag doesn’t start with the word “if”, you can
still use it in combination with the fb:else
tag to display alternate content to people who aren’t in
the network:
<fb:is-in-network network="12345" uid="loggedinuser"> Private content goes here <fb:else> Sorry! You're not in <fb:networklink nid="12345"/>. </fb:else> </fb:is-in-network>
Note that the tag uses network="12345"
and not nid="12345"
as you might expect.
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.