You are here

function privatemsg_view_form_submit in Privatemsg 5

Same name and namespace in other branches
  1. 5.3 privatemsg.module \privatemsg_view_form_submit()

File

./privatemsg.module, line 1964

Code

function privatemsg_view_form_submit($form_id, $form_values) {
  global $user;
  switch ($form_values['op']) {
    case t('Reply'):
      drupal_goto('privatemsg/reply/' . $form_values['pm_id']);
    case t('Delete'):
      if ($_POST['js_bypass'] == 1) {
        drupal_goto('privatemsg/delete/' . $form_values['pm_id']);
      }
      drupal_goto('privatemsg/delete/confirm/' . $form_values['pm_id']);
    case t('Move to folder'):
      $fid = $form_values['folder'];
      if ($fid == 'new') {
        $_SESSION['privatemsg'] = array(
          $form_values['pm_id'] => array(
            'selected' => TRUE,
          ),
        );
        $_SESSION['fromfolder'] = 'view/' . intval($form_values['pm_id']);
        drupal_goto('privatemsg/folders/movetonew');
      }
      db_query("UPDATE {privatemsg} SET folder = %d WHERE id = %d AND recipient = %d", $fid, $form_values['pm_id'], $user->uid);
      $link = l(t('%folder', array(
        '%folder' => $form_values['extra_folders'][$fid],
      )), 'privatemsg/list/' . $fid, array(), NULL, NULL, FALSE, TRUE);
      drupal_set_message(t('Your message has been moved to !link.', array(
        '!link' => $link,
      )));
      break;
  }
}