function _privatemsg_get_new_messages in Privatemsg 5
Same name and namespace in other branches
- 5.3 privatemsg.module \_privatemsg_get_new_messages()
2 calls to _privatemsg_get_new_messages()
- privatemsg_menu in ./
privatemsg.module - Implementation of hook_menu().
- _privatemsg_block_inbox in ./
privatemsg.module
File
- ./
privatemsg.module, line 2108
Code
function _privatemsg_get_new_messages($uid = 0) {
global $user;
static $cache = array();
if ($uid == 0) {
$uid = $user->uid;
}
if (!isset($cache[$uid])) {
$cache[$uid] = (int) db_result(db_query('SELECT COUNT(*) FROM {privatemsg} WHERE recipient = %d AND newmsg = 1 AND recipient_del = 0', $uid));
}
return $cache[$uid];
}