You are here

function pm_block_user_form in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 pm_block_user/pm_block_user.pages.inc \pm_block_user_form()
  2. 6 pm_block_user/pm_block_user.module \pm_block_user_form()
  3. 7.2 pm_block_user/pm_block_user.pages.inc \pm_block_user_form()

@file User menu callbacks for pm_block_user.module.

1 string reference to 'pm_block_user_form'
pm_block_user_menu in pm_block_user/pm_block_user.module
Implements hook_menu().

File

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

Code

function pm_block_user_form($form, $form_state, $author) {
  global $user;
  $form['author'] = array(
    '#type' => 'value',
    '#value' => $author,
  );
  $form['recipient'] = array(
    '#type' => 'value',
    '#value' => $user,
  );
  $form['destination'] = array(
    '#type' => 'value',
    '#value' => isset($_GET['destination']) ? $_GET['destination'] : 'messages/',
  );
  if (pm_block_user_has_blocked($author, $user)) {
    $form['block_action'] = array(
      '#type' => 'value',
      '#value' => 'unblock_user',
    );
    return confirm_form($form, t('You have previously blocked "@author" from sending you any more messages. Are you sure you want to unblock this user?', array(
      '@author' => privatemsg_recipient_format($author, array(
        'plain' => TRUE,
      )),
    )), isset($_GET['destination']) ? $_GET['destination'] : 'messages/', '', t('Unblock @author', array(
      '@author' => privatemsg_recipient_format($author, array(
        'plain' => TRUE,
      )),
    )), t('Cancel'));
  }
  else {
    $form['block_action'] = array(
      '#type' => 'value',
      '#value' => 'block_user',
    );
    return confirm_form($form, t('Are you sure you want to block "@author" from sending you any more messages?', array(
      '@author' => privatemsg_recipient_format($author, array(
        'plain' => TRUE,
      )),
    )), isset($_GET['destination']) ? $_GET['destination'] : 'messages/', '', t('Block @author', array(
      '@author' => privatemsg_recipient_format($author, array(
        'plain' => TRUE,
      )),
    )), t('Cancel'));
  }
}