Adding Profile Boxes and Info Sections

Problem

How can I give my users the opportunity to add a Profile Box if they don’t have one, or to add my app’s info to the Info tab of their Profile?

Solution

Use the fb:add-section-button to give users the ability to add either Profile Boxes or Info sections:

<fb:add-section-button section="profile" />
<fb:add-section-button section="info" />

Discussion

This will render Facebook’s Add to Profile and Add to Info buttons, shown in Figure 6-40.

Add to Profile and Add to Info buttons

Figure 6-40. Add to Profile and Add to Info buttons

The Add to Profile button will appear only if you have previously called Profile.setFBML() for this user and he doesn’t already have your box on his Profile (on either the Wall or Boxes tab). Likewise, the Add to Info button will appear only if you have previously called Profile.setInfo() and the user doesn’t already have your Info section on his Info tab. See Getting and Setting Profile FBML for more on Profile Boxes and Setting Info Sections for more on setting Info.

Clicking the Add to Profile button will show a confirmation dialog like the one in Figure 6-41.

Add to Profile confirmation

Figure 6-41. Add to Profile confirmation

Clicking on Add will take users to their Profile (on either the Wall or Boxes tab, depending on which tab they select in the subtitle of that dialog) and highlight ...

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.