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

Prompting for Extended Permissions

Problem

I need to get permission from users to send them email, get an infinite session, update their status, upload and tag photos, and create or modify Marketplace listings. Is there an easy way to do that?

Solution

Sure is! Use the fb:prompt-permission button, which was added in the mid-2008 Profile redesign:

<fb:prompt-permission perms="set_status">Can we set your status?
 </fb:prompt-permission>

The tag will display the text (or any other FBML) you put into it as a link that opens a confirmation dialog like the one shown in Figure 6-44.

Prompt permissions confirmation dialog

Figure 6-44. Prompt permissions confirmation dialog

Discussion

The following extended permission strings are available:

  • email

  • offline_access

  • status_update

  • photo_upload

  • create_listing

Facebook will show links (or other FBML) only for permissions the user hasn’t already granted you. You can optionally pass a next_fbjs parameter into the fb:prompt-permission tag to specify an FBJS function that you’d like called after permission has been granted, which gives you the option of hiding the link.

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