function fb_feed_update in Drupal for Facebook 5.2
File
- ./
fb_feed.module, line 440 - Helpers for Facebook feeds (http://wiki.developers.facebook.com/index.php/New_Design_Feed_Wall)
Code
function fb_feed_update($node) {
//dpm($node, "fb_feed_update");
// deactivate the previously registered bundle
if ($node->bundle_id) {
fb_feed_deactivate_template($node->fb_app_nid, $node->bundle_id);
unset($node->bundle_id);
}
// Register the new template with facebook.
$bundle_id = fb_feed_register_template($node);
if (!$bundle_id) {
// Show an error, but save the node anyway.
drupal_set_message(t('Failed to register template bundle with Facebook. This template bundle may not be used.'), 'error');
}
$data = serialize($node->fb_feed_data);
// We're going to save the apikey, although it may be redundant with the
// fb_app_nid, so that we can detect any inconsistencies (i.e. the apikey
// has changed on us).
$fb_app = fb_get_app(array(
'nid' => $node->fb_app_nid,
));
db_query("UPDATE {fb_feed_template} SET fb_app_nid=%d, apikey='%s', bundle_id=%f, fb_feed_data='%s' WHERE nid=%d", $node->fb_app_nid, $fb_app->apikey, $bundle_id, $data, $node->nid);
if ($bundle_id) {
watchdog('fb_feed', t('Updated Facebook feed template bundle %id for application %app', array(
'%id' => $bundle_id,
'%app' => $fb_app->title,
)));
}
}