diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/chat.php | 11 | ||||
-rw-r--r-- | include/conversation.php | 4 | ||||
-rw-r--r-- | include/nav.php | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/include/chat.php b/include/chat.php index b8fb185df..5c3d0c9d9 100644 --- a/include/chat.php +++ b/include/chat.php @@ -189,6 +189,17 @@ function chatroom_list($uid) { return $r; } +function chatroom_list_count($uid) { + require_once('include/security.php'); + $sql_extra = permissions_sql($uid); + + $r = q("select count(*) as total from chatroom where cr_uid = %d $sql_extra", + intval($uid) + ); + + return $r[0]['total']; +} + /** * create a chat message via API. * It is the caller's responsibility to enter the room. diff --git a/include/conversation.php b/include/conversation.php index 8f1767482..6e56782dd 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1545,8 +1545,8 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ } require_once('include/chat.php'); - $chats = chatroom_list($uid); - if (count($chats)) { + $has_chats = chatroom_list_count($uid); + if (count($has_chats)) { $tabs[] = array( 'label' => t('Chatrooms'), 'url' => $a->get_baseurl() . '/chat/' . $nickname, diff --git a/include/nav.php b/include/nav.php index c6bc4d293..714f4b63d 100644 --- a/include/nav.php +++ b/include/nav.php @@ -105,8 +105,8 @@ EOT; $nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files')); require_once('include/chat.php'); - $chats = chatroom_list(local_user()); - if (count($chats)) { + $has_chats = chatroom_list_count(local_user()); + if($has_chats) { $nav['usermenu'][] = Array('chat/' . $channel['channel_address'],t('Chat'),"",t('Your chatrooms')); } |