O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required