Giving Users a Voice: Wall Posts in Your App

Problem

I’d really like to have something like the Profile Wall in my app so that users can leave comments.

Solution

Don’t settle for something like the Wall; have the Wall! Use the fb:comments tag to add a real, live Wall to your Canvas pages. The simplest form is:

<fb:comments xid="my_quick_and_easy_wall" />

which will give you something like Figure 6-37.

The simplest form of fb:comments

Figure 6-37. The simplest form of fb:comments

Note

You might consider using a Discussion Board–type system instead of a Wall, depending on whether you want a one-way message board or more of a conversation. See Discussion Boards Made Simple. The implementation of both tags is virtually identical, so this might all seem very familiar if you’ve already read that recipe.

You could also use the fb:wall and fb:wallpost tags if you wanted to format content to look like Wall posts, but since they don’t provide any mechanism to create new posts, they are much less useful. You can find more information about them on the Platform Wiki if you’re curious.

Discussion

The xid parameter needs to be unique across all of Facebook, so put on your imagining cap and make up something that no one else will have come up with (note that you’re limited to alphanumeric characters (Aa–Zz, 0–9), hyphens (-) and underscores (_)). You’ll see why it needs to be unique once you have the Wall on your page and you can see the ...

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.