October 2008
Intermediate to advanced
434 pages
12h 7m
English
How do I display content only to friends of a specific user?
Use the fb:if-is-friends-with-viewer tag. The simplest form is:
<fb:if-is-friends-with-viewer>You're friends!</fb:if-is-friends-with-viewer>
As with all fb tags that
begin with if, you can use the
fb:else tag inside the fb:if-is-friends-with-viewer to provide
alternate content if they aren’t friends. You can also specify a
different uid if you don’t want to
check for friendship with the loggedinuser, and you can explicitly
exclude the loggedinuser if you
don’t want to treat them as being friends with themselves (you will
also be a friend of yourself unless you set includeself to false):
<fb:if-is-friends-with-viewer uid="12345" includeself="false">
You're friends with <fb:name uid="12345" />. Yay!
<fb:else>
You aren't friends with <fb:name uid="12345" />. Boo!
</fb:else>
</fb:if-is-friends-with-viewer>Read now
Unlock full access