function privatemsg_unread_count

1 privatemsg.module privatemsg_unread_count($account = NULL)
7-1 privatemsg.module privatemsg_unread_count($account = NULL)
7-2 privatemsg.module privatemsg_unread_count($account = NULL)
6-2 privatemsg.module privatemsg_unread_count($account = NULL, $reset = FALSE)

Return number of unread messages for an account.

Parameters

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

Related topics

File

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

Code

function privatemsg_unread_count($account = NULL) {
  $counts = &drupal_static(__FUNCTION__, array());
  if (!$account || $account->uid == 0) {
    global $user;
    $account = $user;
  }
  if (!isset($counts[$account->uid])) {
    $counts[$account->uid] = _privatemsg_assemble_query('unread_count', $account)->execute()->fetchField();
  }
  return $counts[$account->uid];
}