JS API M FB.Connect.showFeedDialog

From Facebook Developer Wiki

Jump to: navigation, search

Facebook will deprecate this method December 20, 2009.

To pop up Feed forms, please use FB.Connect.streamPublish or Facebook.streamPublish instead.

Contents

public static bool showFeedDialog (string template_bundle_id, Dictionary template_data, string target_id, string body_general, FeedStorySize story_size, RequireConnect require_connect, OnFeedFormCompleted callback, string user_message_prompt, object user_message)

Description

This call lets a user publish a Feed story to his or her Wall or to one of his or her friends' Walls.

This method pops up a Feed form, like feed.publishUserAction, but you don't need a session, and an IFrame pops up letting the user confirm publication of the story.

For a simpler method that doesn't require templates, use FB.Connect.streamPublish.


Parameters

RequiredNameTypeDescription
required template_bundle_id string The id of the feed template you want to use
template_data object Data associated with template (for short stories). For information on forming the template_data array, see Template Data.
target_id string If you are publishing to a friend's Feed, this string contains that friend's user ID. The Feed story template must include the {*target*} token. The story will be published to that friend's Feed, and a one-line story will be published to the user's Feed.
body_general string Associated text for short and full stories
story_size FeedStorySize This parameter has been deprecated. Pass null in its place.
require_connect RequireConnect Either FB.RequireConnect.doNotRequire, FB.RequireConnect.require, or FB.RequireConnect.promptConnect - The action to occur if the user has not authorzed this app.
callback OnFeedFormCompleted Callback to be executed after function is completed. This function is passed three arguments: postId, exception, and data. postId is the ID of the post created by the Feed form. exception is currently not used (but is used by FB.Connect.streamPublish). data currently has one defined key: user_message, which contains the message entered by the user after the Feed form is accepted.
optional user_message_prompt string The label (which could be in the form of a question) that appears above the text box on the Feed form next to the Facebook-provided question, "What's on your mind?".
user_message object/string Either a simple JavaScript object containing single property, value, which is set to the content that the user enters into the Feed form, or a simple string containing the same data. This message should have been entered by the user (e.g., in a comment field on your site). The user can then edit this text. When the user publishes the Feed form, Facebook sets the value property to whatever text the user typed (if an object was passed in), and passes it to the callback.


Example Requests

var user_message_prompt = "What do you think of this book?"; var user_message = {value: "write your review here"}; ... FB.Connect.showFeedDialog(47130247983, template_data, 563683308, body_general, null, FB.RequireConnect.require, callback, user_message_prompt, user_message);


Return

bool
boolean- If there is already a dialog, return false. Otherwise, return true.


Notes

You must pass null for the deprecated story_size parameter. It comes between body_general and require_connect.

  • Posts to a target_id friend's wall will only appear in the streams of users who are friends with both users, and thus is less viral in general than posts with no target, which appears to all the friends of the actor.
  • I'm having a lot of trouble with the require_connect feature. doNotRequire doesn't seem to work the same as require. promptConnect will pring up a login screen, but after that will not go to the feed dialog. For all types, the following behavior occurs: 1) the dialog does not come up because not logged in. 2) log in. 3) try to open dialog again. It does not open. 4) try a second time and it does open as it should usually. (12 Jun 09) [possible bug?]
  • I can't use user_message to get the user's input. I define a variable (ex: x = {value: 'sample'}) and pass it in for user_message. The 'sample' text does appear correctly in the input box, but then if I edit the text to something else and click "Publish", I inspect the value of x again and it still has 'sample'. (12 Jun 09) [possible bug?]


See Also




Back to class public FB.Connect

reference