function pm_block_user_form_submit

1 pm_block_user.module pm_block_user_form_submit($form, &$form_state)
7-1 pm_block_user.pages.inc pm_block_user_form_submit($form, &$form_state)
7-2 pm_block_user.pages.inc pm_block_user_form_submit($form, &$form_state)
6-2 pm_block_user.pages.inc pm_block_user_form_submit($form, &$form_state)

Submit callback for block user confirmation form.

File

pm_block_user/pm_block_user.pages.inc, line 54
User menu callbacks for pm_block_user.module.

Code

function pm_block_user_form_submit($form, &$form_state) {
  if ($form_state['values']['confirm']) {
    switch ($form_state['values']['block_action']) {
      case 'block_user':
        db_insert('pm_block_user')->fields(array('author' => $form_state['values']['author']->uid, 'recipient' => $form_state['values']['recipient']->uid))->execute();
        drupal_set_message(t('@author has been blocked from sending you any further messages.', array('@author' => privatemsg_recipient_format($form_state['values']['author'], array('plain' => TRUE)))));
        break;
      case 'unblock_user':
        db_delete('pm_block_user')->condition('author', $form_state['values']['author']->uid)->condition('recipient', $form_state['values']['recipient']->uid)->execute();
        drupal_set_message(t('@author is now allowed to send you new messages.', array('@author' => privatemsg_recipient_format($form_state['values']['author'], array('plain' => TRUE)))));
        break;
    }
  }
  $form_state['redirect'] = $form_state['values']['destination'];
}