function workbench_moderation_set_state_action in Workbench Moderation 7.3
Same name and namespace in other branches
- 7 workbench_moderation.module \workbench_moderation_set_state_action()
Changes the moderation state for a given node.
1 string reference to 'workbench_moderation_set_state_action'
- workbench_moderation_set_state_rules_action in ./
workbench_moderation.rules.inc - Action: Change the moderation state of a given node.
File
- ./
workbench_moderation.module, line 2261 - Content moderation for Workbench.
Code
function workbench_moderation_set_state_action($node, $context) {
if (empty($context['state'])) {
return;
}
// Check access to perform this moderation, on the latest revision of the node
$node = workbench_moderation_node_current_load($node);
if (_workbench_moderation_moderate_access($node, $context['state'])) {
$node->workbench_moderation_state_new = $context['state'];
$node->revision = 1;
$node->log = "Bulk moderation state change.";
node_save($node);
watchdog('action', 'Change node %nid moderation state to %state.', array(
'%nid' => $node->nid,
'%state' => $context['state'],
));
}
else {
drupal_set_message(t('You do not have permission to moderate %node', array(
'%node' => $node->title,
)), 'warning');
}
}