You are here

function workbench_moderation_moderate in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 workbench_moderation.module \workbench_moderation_moderate()

Provide quick moderation of nodes.

Access is controlled by the menu router to these pseudo-form callbacks. This function is also abstracted so that it can be called from any node context.

Parameters

$node: The node being acted upon.

$state: The new moderation state requested.

See also

_workbench_moderation_moderate_access()

workbench_moderation_menu()

workbench_moderation_node_update()

3 calls to workbench_moderation_moderate()
workbench_moderation_moderate_callback in ./workbench_moderation.module
Helper function to redirect after a state change submission.
workbench_moderation_moderate_form_submit in ./workbench_moderation.module
workbench_moderation_node_unpublish_form_submit in ./workbench_moderation.node.inc
Submit handler for unpublishing a live revision of a node.

File

./workbench_moderation.module, line 1718
Content moderation for Workbench.

Code

function workbench_moderation_moderate($node, $state) {

  // Set the current and new moderation state value.
  $node->original = $node;

  // Ensure that published nodes are flagged properly.
  if ($state == workbench_moderation_state_published()) {
    $node->status = NODE_PUBLISHED;
  }
  elseif (isset($node->workbench_moderation['published']) && $node->workbench_moderation['published']->vid == $node->vid) {
    $node->status = NODE_NOT_PUBLISHED;
  }

  // Set the state property for saving.
  $node->workbench_moderation_state_new = $state;

  // Save the node and let drafty handle it.
  node_save($node);
}