Hi,
I'm trying to use Freichat for creating "private" chatrooms for Joomla users. "Private" means administrator creates chatroom and sets who can access that room.
To achieve this I've created additional table - frei_private__rooms with just two rows - user_id and room_id. This table is to hold information which user is allowed to use witch room.
IF THERE ARE NO USERS SET TO PARTICULAR ROOM, THAT MEANS THE ROOM IS PUBLIC.
In original code (/server/freichat.php)I've changed just two SQL Queries:
1st (line about 265)
<?php $query2 = "SELECT r.room_name,r.id as room_id,count(s.id) as online_count
FROM frei_rooms as r
LEFT join frei_session as s
on r.id=s.in_room
where r.id NOT IN (select distinct room_id from frei_private_rooms)
or r.id IN (select room_id from frei_private_rooms where user_id=".$_SESSION[$this->uid . 'usr_ses_id'].")
AND time>" . $this->online_time2 . "
Group BY r.id ORDER BY r.room_order";
?>
And second (line about 545)
<?php $query2 = "SELECT r.room_name,r.id as room_id,count(s.id) as online_count
FROM frei_rooms as r
LEFT join frei_session as s
on r.id=s.in_room
where r.id NOT IN (select distinct room_id from frei_private_rooms) or r.id IN (select room_id from frei_private_rooms where user_id=".$_SESSION[$this->uid . 'usr_ses_id'].")
Group BY r.id ORDER BY r.room_order";
?>
Modified QUERY is to filter just PUBLIC rooms, or that user is assigned to.
And it works pretty well. BUT....
But when user is clicking on different room name, those private rooms are disappearing! What else should I change, or where to look for room function that refreshes room list?
I know this is complicated but if anyone could help me it would be great :)