aalso change the way we check for number of chatrooms
This commit is contained in:
parent
bd54358aa6
commit
6c806f6f48
@ -189,6 +189,17 @@ function chatroom_list($uid) {
|
|||||||
return $r;
|
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.
|
* create a chat message via API.
|
||||||
* It is the caller's responsibility to enter the room.
|
* It is the caller's responsibility to enter the room.
|
||||||
|
@ -1545,8 +1545,8 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
|
|||||||
}
|
}
|
||||||
|
|
||||||
require_once('include/chat.php');
|
require_once('include/chat.php');
|
||||||
$chats = chatroom_list($uid);
|
$has_chats = chatroom_list_count($uid);
|
||||||
if (count($chats)) {
|
if (count($has_chats)) {
|
||||||
$tabs[] = array(
|
$tabs[] = array(
|
||||||
'label' => t('Chatrooms'),
|
'label' => t('Chatrooms'),
|
||||||
'url' => $a->get_baseurl() . '/chat/' . $nickname,
|
'url' => $a->get_baseurl() . '/chat/' . $nickname,
|
||||||
|
@ -105,8 +105,8 @@ EOT;
|
|||||||
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'));
|
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'));
|
||||||
|
|
||||||
require_once('include/chat.php');
|
require_once('include/chat.php');
|
||||||
$chats = chatroom_list(local_user());
|
$has_chats = chatroom_list_count(local_user());
|
||||||
if (count($chats)) {
|
if($has_chats) {
|
||||||
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'],t('Chat'),"",t('Your chatrooms'));
|
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'],t('Chat'),"",t('Your chatrooms'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user