function content_unpublish_content_form_submit

7.x content.module content_unpublish_content_form_submit(&$form, &$form_state)
6.x content.module content_unpublish_content_form_submit(&$form, &$form_state)

File

modules/content/content.module, line 557

Code

function content_unpublish_content_form_submit(&$form, &$form_state) {

  $values = $form_state ['values'];

  if (isset($values ['submit_cancel']) && trim($values ['submit_cancel']) != '') {
    // We want to CANCEL this operation!

    // find out if we should redirect anywhere in particular for this cancelation
    if (isset($form ['#redirect'])) {
      fp_add_message(t("The operation was cancelled."));
      $form ['#redirect']['query'] .= "&cancel=yes";
    }
    else {
      // No redirect was specified, so let's just return.
      fp_add_message(t("The operation was cancelled."));
    }
    return;

  }



  $cid = $form_state ['values']['cid'];
  $content = content_load($cid);
  $content->published = 0;

  content_save($content);

  watchdog('content', "Content with cid $cid was removed/unpublished.");

  fp_add_message("Content has been removed.");

}