He Said, She Said: Dealing with Pronouns

Problem

Gender issues are complicated. I could just use the third-person pronouns (“they” and “their”) for everything, but that’s really not grammatically correct. How do I figure out whether to use “he” or “she”? And what about people who didn’t specify a gender on their Profiles?

Solution

The fb:pronoun tag will output the correct pronoun for the user specified by the uid parameter. The simplest form is:

<fb:pronoun uid="12345" />

Discussion

Just like the fb:name tag, the fb:pronoun tag gets itself into all kinds of trouble with possessives and reflexives and lots of other grammar ghouls that you don’t want to have to deal with. Luckily, FBML will deal with them for you! See Table 6-2 for a list of the tag’s parameters.

Table 6-2. Parameters for fb:pronoun

Name

Type

Default value

Description

They see

I see

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.

“he”

“you”

capitalize

bool

false

Capitalize the pronoun.

“He”

“You”

objective

bool

false

Use the objective form (him/her/you/them).

“him”

“you”

possessive

bool

false

Use the possessive form (his/her/your/their).

“his”

“you”

reflexive

bool

false

Use the reflexive form (himself/herself/yourself).

“himself”

“yourself”

usethey

bool

true

Use “they” if gender is not specified.

“him” (but if I removed my gender, “they”)

“you”

useyou

bool

true

Use “you” if uid matches the logged-in user.

“your”

“your” ...

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.