You are here

function privatemsg_delete_submit in Privatemsg 7.2

Same name and namespace in other branches
  1. 6.2 privatemsg.pages.inc \privatemsg_delete_submit()
  2. 6 privatemsg.module \privatemsg_delete_submit()
  3. 7 privatemsg.pages.inc \privatemsg_delete_submit()

File

./privatemsg.pages.inc, line 108
User menu callbacks for Privatemsg.

Code

function privatemsg_delete_submit($form, &$form_state) {
  global $user;
  $account = clone $user;
  if ($form_state['values']['confirm']) {
    if (isset($form_state['values']['delete_options']) && $form_state['values']['delete_options']) {
      privatemsg_message_change_delete($form_state['values']['pmid'], 1);
      drupal_set_message(t('Message has been deleted for all users.'));
    }
    else {
      privatemsg_message_change_delete($form_state['values']['pmid'], 1, $account);
      drupal_set_message(t('Message has been deleted.'));
    }
  }
  $form_state['redirect'] = $form_state['values']['delete_destination'];
}