/** * Get the count of new messages for a user * @param string $username The username * @param int $lastId The id of the last received message * @return int The count fo new messages */ public function countNewMessages($username, $lastId = 0) { $userInfo = api_get_user_info_from_username($username); $userId = $userInfo['user_id']; return MessageManager::countMessagesFromLastReceivedMessage($userId, $lastId); }