You are here

function _scheduler_allow in Scheduler 7

Checks whether a scheduled action on a node is allowed.

This provides a way for other modules to prevent scheduled publishing or unpublishing, by implementing hook_scheduler_allow_publishing() or hook_scheduler_allow_unpublishing().

Parameters

object $node: The node object on which the action is to be performed.

string $action: The action that needs to be checked. Can be 'publish' or 'unpublish'.

Return value

bool TRUE if the action is allowed, FALSE if not.

See also

hook_scheduler_allow_publishing()

hook_scheduler_allow_unpublishing()

3 calls to _scheduler_allow()
scheduler_node_presave in ./scheduler.module
Implements hook_node_presave().
_scheduler_publish in ./scheduler.cron.inc
Publish scheduled nodes.
_scheduler_unpublish in ./scheduler.cron.inc
Unpublish scheduled nodes.

File

./scheduler.module, line 246
Scheduler publishes and unpublishes nodes on dates specified by the user.

Code

function _scheduler_allow($node, $action) {

  // Default to TRUE.
  $result = TRUE;

  // Check that other modules allow the action.
  $hook = 'scheduler_allow_' . $action . 'ing';
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    $result &= $function($node);
  }
  return $result;
}