You are here

function privatemsg_unread_count in Privatemsg 6

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

Return number of unread messages for an account.

Parameters

$account: Specifiy the user for which the unread count should be loaded.

Related topics

3 calls to privatemsg_unread_count()
privatemsg_title_callback in ./privatemsg.module
privatemsg_user in ./privatemsg.module
_privatemsg_block_new in ./privatemsg.module

File

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

Code

function privatemsg_unread_count($account = NULL) {
  static $counts = array();
  if (!$account || $account->uid == 0) {
    global $user;
    $account = $user;
  }
  if (!isset($counts[$account->uid])) {
    $query = _privatemsg_assemble_query('unread_count', $account);
    $counts[$account->uid] = db_result(db_query($query['query']));
  }
  return $counts[$account->uid];
}