You are here

function scheduler_set_publish_date_action in Scheduler 7

Set the publish_on date for the node.

Parameters

object $node: The node object to be scheduled for publishing.

int $date: The date for publishing, a unix timestamp integer.

1 string reference to 'scheduler_set_publish_date_action'
scheduler_default_rules_configuration in ./scheduler.rules_defaults.inc
Implements hook_default_rules_configuration().

File

./scheduler.rules.inc, line 126
Scheduler rules functions.

Code

function scheduler_set_publish_date_action($node, $date) {

  // When this action is invoked and it operates on the node being editted then
  // hook_node_presave() and hook_node_update() will be executed anyway. But if
  // this action is being used to schedule a different node then we need to call
  // the functions directly here.
  if (variable_get('scheduler_publish_enable_' . $node->type, 0)) {
    $node->publish_on = $date;
    scheduler_node_presave($node);
    scheduler_node_update($node);
  }
  else {
    $type_name = node_type_get_name($node->type);
    watchdog('scheduler', 'Scheduled publishing is not enabled for %type content. To prevent this message add the condition "Scheduled publishing is enabled" to your Rule, or enable the Scheduler options via the %type content type settings.', array(
      '%type' => $type_name,
    ), WATCHDOG_WARNING, l(t('@type settings', array(
      '@type' => $type_name,
    )), 'admin/structure/types/manage/' . $node->type));
  }
}