Fb:profile-action

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

This tag is now deprecated.


Renders a link on the user's profile under their photo (such as "View More photos of..").

Attributes

RequiredNameTypeDescription
required url string The URL to which the user is taken after clicking. Must be an absolute link. profileowner's uid will be appended as the id GET parameter

Examples

<fb:profile-action url="http://www.mysite.com/action/"> Perform Action </fb:profile-action> This will render the following HTML: <a href="http://www.mysite.com/action/?id=profileowner">Perform Action</a> * Note that profileowner's uid is appended to the link. (at least on Default Action FBML...).


NOTE: 'if-is-own-profile' deprecated! See that function for details

<fb:if-is-own-profile> <fb:profile-action url="http://apps.facebook.com/myapplication/status/"> View Your Status </fb:profile-action> <fb:else> <fb:if-is-app-user uid="profileowner"> <fb:profile-action url="http://apps.facebook.com/myapplication/status/"> View this person's status </fb:profile-action> <fb:else> <fb:profile-action url="http://apps.facebook.com/myapplication/invite/"> Invite this person to MyApplication </fb:profile-action> </fb:else> </fb:if-is-app-user> </fb:else> </fb:if-is-own-profile>



NOTE: example with fb:visible-to-user instead of the deprecated fb:if-is-own-profile <fb:visible-to-user uid="loggedinuser"> <fb:profile-action url="http://apps.facebook.com/application/my_page"> View Your Application </fb:profile-action> <fb:else> <fb:profile-action url="http://apps.facebook.com/application/"> Check Out Application </fb:profile-action> </fb:else> </fb:visible-to-user>

Notes

  • Use profile.setFBML to add the button to a user's profile.
  • If you add this to the profile of a user who has not added your application, it will appear only to those users who have added your application. By setting the default FBML (in Edit Settings, under My Applications) to include a fb:profile-action, this action appears on every profile the user of your application sees.
  • There is a limit of about 30 characters in the action label. (Note: Leading and trailing white-space counts against this limit, so if your link is being elided, check for and remove any extra spaces between the tags and the label text.)
  • For users for whom you have not called profile.setFBML, the actions are read from the content in "Default FBML" section of your application settings. For the most part, this applies to any user who has not added your application.
  • For users for whom you have called profile.setFBML, the actions are read from whatever content you set when you last called profile.setFBML for that user.
  • Example: There are three friends -- Larry, Curly and Moe. Both Larry and Curly add your application. When Larry views Curly’s profile, the profile actions that Larry sees on Curly’s profile come from the content you posted to Curly’s profile. When Larry views Moe’s profile, the profile actions Larry sees on Moe’s profile come from the default FBML content, because you haven’t called profile.setFBML on Moe, because you don’t necessarily know he exists.

See Also

Errors

fb:profile-action: Required fbml_env var missing: "profile"

- If you get this error, it means you tried to use the fb:visible-to-owner, fb:visible-to-app-users, and the other fb:visible-to-*** elements on a Canvas page.

fb:if-is-own-profile

- Not allowed in profile. Use fb:visible-to-owner, fb:visible-to-app-users, and the other fb:visible-to-*** elements instead.

running example above through the [Facebook FBML validator] returns

- RUNTIME ERROR: fb:if-is-own-profile: "ifs" are not allowed in flavor ProfileBoxFBMLFlavor

--719255867 11:05, 19 November 2007 (PST)

Most punctuation is stripped from the profiles box.

Can someone write a working example that reproduces this behavior WITHOUT if-tags?

Neither of the above examples work (at least in the FBML Test Console). The first one uses a deprecated tag. And in the second one, the <fb:else> tag is ignored, so the owner of the profile would see both "View Your Application" and "Check Out Application". What I want to do is to show one thing to the owner of a profile and another thing to everybody else. But since 'if' tags are no longer allowed on profiles, I can't see any way to do that.

reference