function scheduler_node_update in Scheduler 7
Same name and namespace in other branches
- 8 scheduler.module \scheduler_node_update()
Implements hook_node_update().
4 calls to scheduler_node_update()
- scheduler_remove_publish_date_action in ./
scheduler.rules.inc - Remove the publish_on date for the node.
- scheduler_remove_unpublish_date_action in ./
scheduler.rules.inc - Remove the unpublish_on date for the node.
- scheduler_set_publish_date_action in ./
scheduler.rules.inc - Set the publish_on date for the node.
- scheduler_set_unpublish_date_action in ./
scheduler.rules.inc - Set the unpublish_on date for the node.
File
- ./
scheduler.module, line 638 - Scheduler publishes and unpublishes nodes on dates specified by the user.
Code
function scheduler_node_update($node) {
// Only update database if we need to (un)publish this node at some date,
// otherwise the user probably cleared out the (un)publish dates so we should
// remove the record.
if (!empty($node->publish_on) || !empty($node->unpublish_on)) {
db_merge('scheduler')
->key(array(
'nid' => $node->nid,
))
->fields(array(
'publish_on' => $node->publish_on,
'unpublish_on' => $node->unpublish_on,
))
->execute();
// Invoke the events to indicate that an existing node has been scheduled.
if (module_exists('rules')) {
if (!empty($node->publish_on)) {
rules_invoke_event('scheduler_existing_node_is_scheduled_for_publishing_event', $node, $node->publish_on, $node->unpublish_on);
}
if (!empty($node->unpublish_on)) {
rules_invoke_event('scheduler_existing_node_is_scheduled_for_unpublishing_event', $node, $node->publish_on, $node->unpublish_on);
}
}
}
else {
scheduler_node_delete($node);
}
}