From 0487bbe1bd0df6b9787a72792e0a6f146f6ed855 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 2 Mar 2012 18:03:34 +0000 Subject: [PATCH] count the messages properly, and show them... --- contrib/pm/main.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/pm/main.php b/contrib/pm/main.php index 01cef106..c7ef0092 100644 --- a/contrib/pm/main.php +++ b/contrib/pm/main.php @@ -82,7 +82,7 @@ class PrivMsg extends Extension { if(!$user->is_anonymous()) { $count = $this->count_pms($user); $h_count = $count > 0 ? " ($count)" : ""; - $event->add_link("Private Messages", make_link("user")); + $event->add_link("Private Messages$h_count", make_link("user")); } } @@ -190,13 +190,13 @@ class PrivMsg extends Extension { global $database; $count = $database->cache->get("pm-count-{$user->id}"); - if(is_null($count)) { + if(is_null($count) || $count === false) { $count = $database->get_one(" SELECT count(*) FROM private_message - WHERE to_id = :toid + WHERE to_id = :to_id AND is_read = :is_read - ", array("toid" => $user->id, "is_read" => "N")); + ", array("to_id" => $user->id, "is_read" => "N")); $database->cache->set("pm-count-{$user->id}", $count, 60); } return $count;