You are here

function revisioning_unpublish_confirm_submit in Revisioning 6

Same name and namespace in other branches
  1. 8 revisioning.pages.inc \revisioning_unpublish_confirm_submit()
  2. 6.4 revisioning.pages.inc \revisioning_unpublish_confirm_submit()
  3. 6.3 revisioning.pages.inc \revisioning_unpublish_confirm_submit()
  4. 7 revisioning.pages.inc \revisioning_unpublish_confirm_submit()

Submission handler for the unpublish_confirm form.

File

./revisioning.module, line 276

Code

function revisioning_unpublish_confirm_submit($form, &$form_state) {
  $nid = $form_state['values']['node_id'];
  $title = check_plain($form_state['values']['title']);
  $type = check_plain($form_state['values']['type']);
  db_query("UPDATE {node} SET status=0 WHERE nid=%d", $nid);
  cache_clear_all();
  drupal_set_message(t('%title has been unpublished.', array(
    '%title' => $title,
  )));
  watchdog('content', 'Unpublished @type %title', array(
    '@type' => $type,
    '%title' => $title,
  ), WATCHDOG_NOTICE, l(t('view'), "node/{$nid}"));

  // Redirect to the same page as publish and revert
  $form_state['redirect'] = "node/{$nid}/revisions";

  // Invoke the revisioning trigger passing 'unpublish' as the operation
  module_invoke_all('revisioning', 'unpublish');
}