You are here

function hook_workbench_moderation_states_next_alter in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 workbench_moderation.api.php \hook_workbench_moderation_states_next_alter()

Allows modules to alter the list of possible next states for a node.

Parameters

&$states: An array of possible state changes, or FALSE if none were found before invoking this hook. Passed by reference.

$current_state: The current moderation state.

$context: An associative array containing:

  • 'account': The user object being checked.
  • 'node': The node object being acted upon.

See also

workbench_moderation_states_next()

1 invocation of hook_workbench_moderation_states_next_alter()
workbench_moderation_states_next in ./workbench_moderation.module
Provides a list of possible next states for this node.

File

./workbench_moderation.api.php, line 45
API documentation file for Workbench Moderation.

Code

function hook_workbench_moderation_states_next_alter(&$states, $current_state, $context) {

  // Do not permit users to give final approval to their own nodes, even if
  // they would otherwise have rights to do so.
  $published = workbench_moderation_state_published();
  if (isset($states[$published]) && $context['account']->uid == $context['node']->uid) {
    unset($states[$published]);
  }
}