You are here

function _privatemsg_block_new in Privatemsg 7.2

Same name and namespace in other branches
  1. 6.2 privatemsg.module \_privatemsg_block_new()
  2. 6 privatemsg.module \_privatemsg_block_new()
  3. 7 privatemsg.module \_privatemsg_block_new()
1 call to _privatemsg_block_new()
privatemsg_block_view in ./privatemsg.module
Implements hook_block_view().

File

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

Code

function _privatemsg_block_new() {
  $block = array();
  if (!privatemsg_user_access()) {
    return $block;
  }
  $count = privatemsg_unread_count();
  if ($count || variable_get('privatemsg_no_messages_notification', 0)) {
    $block = array(
      'subject' => $count ? format_plural($count, 'Unread message', 'Unread messages') : t('No unread messages'),
      'content' => theme('privatemsg_new_block', array(
        'count' => $count,
      )),
    );
    return $block;
  }
  return array();
}