function privatemsg_unread_count in Privatemsg 6.2
Same name and namespace in other branches
- 6 privatemsg.module \privatemsg_unread_count()
- 7.2 privatemsg.module \privatemsg_unread_count()
- 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.
$reset: Reset the static $counts variable.
Related topics
4 calls to privatemsg_unread_count()
- privatemsg_service_unread_count in privatemsg_service/
privatemsg_service.inc - Get the number of unread private messages of the logged-in user.
- privatemsg_title_callback in ./
privatemsg.module - privatemsg_user in ./
privatemsg.module - _privatemsg_block_new in ./
privatemsg.module
File
- ./
privatemsg.module, line 831 - Allows users to send private messages to other users.
Code
function privatemsg_unread_count($account = NULL, $reset = FALSE) {
static $counts = array();
if ($reset) {
$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];
}