function fb_stream_publish_dialog in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 fb_stream.module \fb_stream_publish_dialog()
- 6.2 fb_stream.module \fb_stream_publish_dialog()
Publish to a user's stream or update their status, via a dialog.
Calling this method will, through javascript, add content to a user's wall or update their status. The javascript will be written either during the current page request, or the next complete page that Drupal serves. (So it is safe to call this during requests which end in a drupal_goto() rather than a page.)
When invoked on an FBML canvas page request, http://wiki.developers.facebook.com/index.php/Facebook.streamPublish will be invoked. When a Facebook Connect page, http://developers.facebook.com/docs/?u=facebook.jslib.FB.Connect.streamP... will be called instead. The result should be the same.
Parameters
$params: An associative array of parameters to pass to Facebook's API. See Facebook's doc for additional detail. Pass in strings and data structures. Drupal for Facebook will json encode them before passing to javascript. Use these keys:
- 'user_message'
- 'attachment'
- 'action_links'
- 'target_id'
- 'user_message_prompt'
- 'auto_publish'
- 'actor_id'
4 calls to fb_stream_publish_dialog()
- fb_example_comment_insert in contrib/
fb_example.module - Implements hook_comment_insert().
- fb_example_comment_update in contrib/
fb_example.module - Implements hook_comment_update().
- fb_example_node_insert in contrib/
fb_example.module - Implements hook_node_insert().
- fb_example_node_update in contrib/
fb_example.module - Implements hook_node_update().
File
- ./
fb_stream.module, line 438 - Support for Facebook's Stream API.
Code
function fb_stream_publish_dialog($params, $fb_app = NULL) {
if (!isset($_SESSION[FB_STREAM_DIALOGS])) {
$_SESSION[FB_STREAM_DIALOGS] = array();
}
if (!isset($fb_app)) {
$fb_app = $GLOBALS['_fb_app'];
}
if (!isset($_SESSION[FB_STREAM_DIALOGS][$fb_app->apikey])) {
$_SESSION[FB_STREAM_DIALOGS][$fb_app->apikey] = array();
}
$_SESSION[FB_STREAM_DIALOGS][$fb_app->apikey][] = $params;
}