Fb:comments
From Facebook Developer Wiki
Contents |
Description
Displays a set of comments for a unique identifier. Facebook handles posting, drawing, and see all page.
The fb:comments tag is essentially a Wall for developers to drop on canvas pages and application tabs on profiles easily. Using the tag implies a Wall-like comments set exists that can be posted or identified by the passed XID. Please note the following:
- Every pageload for posting, see all page, and so forth refetches the configuration from the
callbackurlsupplied. Thecallbackurldefaults to the page where it was originally found, so the tag should work without any extra coding. However, you can point acallbackurlto a special page that can be more efficient.
Note: If you render the fb:comments tag from FBJS using setInnerFBML(), you must set acallbackurl. - An
fb_sig_xidparameter is passed to these pages. Facebook looks for thisxid. You can use it to short-circuit your application logic and only output the fb:comments tag with the proper parameters. - When an action occurs, the page is also passed an
fb_sig_xid_actionparameter. Currently this can be "post" or "delete". If you return true for the action requested in the fb:comments tag, you can assume the action was performed.
Note: Facebook redirects immediately to the same page again after passing the post to that page - but without the post information. - The refetch is in the form of a POST to the URL supplied in the
callbackurl, mimicking a canvas page. - You can style fb:comments arbitrarily by using overriding styles and embedding CSS (or using link tags) as described in CSS Tips and Tricks. You can turn off the rounded-corners chrome by specifying the
simpleattribute below. - Comments can be published to a user's Feed only if the user checks Post comment to my Facebook profile. Previously, all comments would be published if developer set the 'publish_feed' parameter to true.
Attributes
| Required | Name | Type | Description | |
| required | xid | string | The unique identifier for this set of comments. Comments can contain alphanumeric characters (Aa-Zz, 0-9), hyphens (-), percent (%), period (.), and underscores (_) (in effect, the result of any urlencode can be a valid XID). | |
|---|---|---|---|---|
| canpost | bool | Indicates whether the viewing user can post on this comment set. | ||
| candelete | bool | Indicates whether the viewing user can delete any post on this comment set. Any user visiting that user's profile where the comment appears can delete comments made to it (so, avoid using candelete unless this is the intended functionality). | ||
| numposts | int | The maximum number of posts to display (must be positive). | ||
| optional | callbackurl | string | The URL to refetch this configuration. (Default value is the current page.) Note: If you render the fb:comments tag from FBJS using setInnerFBML(), you must set a callbackurl. | |
| returnurl | string | The URL where the user is returned after selecting a "back" link. (Default value is the current page.) | ||
| showform | bool | Boolean whether to show the form (canpost "true" only) for inline posting. Posts using this form will not go to a see-all page after posting, but rather refresh the page. | ||
| send_notification_uid | int | User ID to send a notification to upon someone posting a comment. (Only one uid allowed). | ||
| publish_feed | bool | Indicates whether to publish a Feed story when the comment gets posted. The comment must be at least 5 words in length in order to be published to Feed. Note: The comment can be published to a user's Feed only if the user checks Post comment to my Facebook profile. | ||
| simple | bool | Removes the rounded box around the text area to allow greater customization. | ||
| reverse | bool | Changes the order of comments and comment area to allow greater customization. | ||
| quiet | bool | When true, ensures that posts to this board don't send any notifications. By default, they are automatically sent to the last n commenters. (Default value is false.) |
Examples
<fb:comments xid="titans_comments" canpost="true" candelete="false" returnurl="http://apps.facebook.com/myapp/titans/">
<fb:title>Talk about the Titans</fb:title>
</fb:comments>
Notes
- This tag works on application canvas pages and application tabs on profiles only, but not in other integration points like profile boxes. The
uidpassed to the tab link for FBML generation is the profile owner's user ID, not the viewer's user ID. - This tag may contain fb:title.
- This tag works on its own; don't use it with fb:wall.
See Also
- Comment FQL Table
- Comments Box - Social Widget that shares XIDs with fb:comments.
- fb:comments (XFBML) - XFBML tag used for rendering fb:comments in iframe applications and on external sites.
- Comments API
