Online Book Reader

Home Category

Facebook Cookbook - Jay Goldman [64]

By Root 603 0
logged-in user.

“your”

“your”

Worth a Thousand Words: Profile Pictures


Problem


Profile pictures are awesome because they’re so easy to recognize and they really draw people in! How can I display someone’s pic?

Solution


The fb:profile-pic tag will display the Profile picture for the user specified by the uid parameter. The simplest form is:

Discussion


In addition to the uid, there are two optional parameters, listed in Table 6-3.

Table 6-3. Parameters for fb:profile-pic

Name

Type

Default value

Description

uid

int

N/A

The Facebook user ID ( uid) of the user or Page whose pronoun you want to show. You can also use loggedinuser or profileowner. This is the only required field.

linked

bool

true

Link to the user’s Profile.

size

string

thumb

Size of image to display (see the upcoming list).

Differently sized pics can be hugely useful in different scenarios. Using my current Profile picture (taken by my good friend Will Pate), the following list shows a breakdown of the options (note that you can use the short form listed in parentheses):

thumb (t): 50 pixels wide

small (s): 100 pixels wide

normal (n): 200 pixels wide

square (q): 50×50 pixels

Linking to Events


Problem


How do I link to an event from the Facebook Events application?

Solution


Use the fb:eventlink tag and specify the event ID:

where 12345 is your eid.

Discussion


This will insert the name of the event as a link to the event’s page in the Events app.

Linking to Groups


Problem


How do I link to a group from the Facebook Groups application?

Solution


Use the fb:grouplink tag and specify the group ID:

Discussion


This will insert the name of the group as a link to the group’s page in the Groups app.

Linking to Networks


Problem


How do I link to a Facebook network?

Solution


Use the fb:networklink tag and specify the network ID:

Discussion


This will insert the name of the network as a link to the network’s page.

Display Content to Group Members


Problem


How do I display content only to members of a specific group?

Solution


Use the fb:if-is-group-member tag and specify the group ID. The simplest form is:

Private content goes here

Discussion


You can use this tag in combination with the fb:else tag to display alternate content to people who aren’t in the group. The tag will default to checking for the loggedinuser, but you can also specify a different uid if you want to check a different member:

Private content goes here

Sorry! You're not in .

Since groups support different roles (member, admin, officer), you can also use the fb:if-is-group-member to check for a user’s access level:

Private content for admins goes here

Sorry! You're not an admin of .

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 uids. The simplest form is:

Private

content goes here

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:

Private content goes here

Sorry! You're not in .

Note that the tag uses network="12345" and not nid="12345" as you might expect.

Displaying Content to App Users


Problem


How do I display

Return Main Page Previous Page Next Page

®Online Book Reader