You are here

function workbench_moderation_moderate_form_validate in Workbench Moderation 7.3

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

File

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

Code

function workbench_moderation_moderate_form_validate($form, &$form_state) {

  // Make sure that the revision that was shown to the user is still the current
  // revision before changing the current revision's state.
  $moderated_node = $form_state['values']['node'];
  $current_node = workbench_moderation_node_current_load(node_load($moderated_node->nid));
  if ($moderated_node->vid != $current_node->vid) {
    form_set_error('', t('The moderation state could not be changed because the draft has been updated by another user. Please review the current draft.'));

    // Redirect the form so that it rebuilds with the current revision.
    drupal_redirect_form($form_state);
  }
}