function privatemsg_privatemsg_block_message

7-1 privatemsg.module privatemsg_privatemsg_block_message($author, $recipients, $context = array())
7-2 privatemsg.module privatemsg_privatemsg_block_message($author, $recipients, $context = array())
6-2 privatemsg.module privatemsg_privatemsg_block_message($author, $recipients, $context = array())

Implements hook_privatemsg_block_message().

File

./privatemsg.module, line 1450
Allows users to send private messages to other users.

Code

function privatemsg_privatemsg_block_message($author, $recipients, $context = array()) {
  $blocked = array();
  if (privatemsg_is_disabled($author)) {
    $blocked[] = array(
      'recipient' => 'user_' . $author->uid,
      'message' => t('You have disabled private message sending and receiving.'),
    );
  }
  foreach ($recipients as $recipient) {
    if (privatemsg_is_disabled($recipient)) {
      $blocked[] = array(
        'recipient' => 'user_' . $recipient->uid,
        'message' => t('%recipient has disabled private message receiving.', array('%recipient' => privatemsg_recipient_format($recipient, array('plain' => TRUE)))),
      );
    }
    // Do not send private messages to blocked users.
    else if (isset($recipient->status) && (!$recipient->status)) {
      $blocked[] = array(
        'recipient' => 'user_' . $recipient->uid,
        'message' => t('%recipient has disabled his or her account.', array('%recipient' => privatemsg_recipient_format($recipient, array('plain' => TRUE)))),
      );
    }
  }

  return $blocked;
}