You are here

function scheduler_set_unpublish_date_action in Scheduler 7

Set the unpublish_on date for the node.

Parameters

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

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

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

File

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

Code

function scheduler_set_unpublish_date_action($node, $date) {
  if (variable_get('scheduler_unpublish_enable_' . $node->type, 0)) {
    $node->unpublish_on = $date;
    scheduler_node_presave($node);
    scheduler_node_update($node);
  }
  else {
    $type_name = node_type_get_name($node->type);
    watchdog('scheduler', 'Scheduled unpublishing is not enabled for %type content. To prevent this message add the condition "Scheduled unpublishing 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));
  }
}