You are here

function privatemsg_privatemsg_block_message in Privatemsg 6.2

Same name and namespace in other branches
  1. 7.2 privatemsg.module \privatemsg_privatemsg_block_message()
  2. 7 privatemsg.module \privatemsg_privatemsg_block_message()

Implements hook_privatemsg_block_message().

File

./privatemsg.module, line 2339
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,
          )),
        )),
      );
    }
  }
  return $blocked;
}