first off, thanks for this great tool, it has fit in well with my company's new content management system.
I was wondering if there is a way to alter the below code to only show other users that happen to be in the same group, and users can be in multiple groups. the database is called group_users and the fields are group_id and user_id. there is 1 user_id per person, but they can have several group_id values.
found this code @ http://elgghacks.com/customizing-frei-chat/ but cant figure out how to begin editing it to do what i want, thanks for looking
the following gets edited into \freichat\server\drivers\custom.php just after $result = $this->getList();
$query = "SELECT guid_two FROM " . DBprefix . "entity_relationships WHERE guid_one = " . $_SESSION[$this->uid . 'usr_ses_id'] . " AND relationship = 'friend'";
$friendsarray = $this->db->query($query)->fetchAll();
$friends = array();
foreach($friendsarray as $array){
$friends[] = $array[0];
}
if(count($friends) == 0){
$result = array();
}
else{
for($i=0; $i<count if unset array_values></count>
first off, thanks for this great tool, it has fit in well with my company's new content management system.
I was wondering if there is a way to alter the below code to only show other users that happen to be in the same group, and users can be in multiple groups. the database is called group_users and the fields are group_id and user_id. there is 1 user_id per person, but they can have several group_id values.
found this code @ http://elgghacks.com/customizing-frei-chat/ but cant figure out how to begin editing it to do what i want, thanks for looking
the following gets edited into \freichat\server\drivers\custom.php just after $result = $this-&gt;getList();
$query = "SELECT guid_two FROM " . DBprefix . "entity_relationships WHERE guid_one = " . $_SESSION[$this-&gt;uid . 'usr_ses_id'] . " AND relationship = 'friend'";
$friendsarray = $this-&gt;db-&gt;query($query)-&gt;fetchAll();
$friends = array();
foreach($friendsarray as $array){
$friends[] = $array[0];
}
if(count($friends) == 0){
$result = array();
}
else{
for($i=0; $i&lt;count($result); $i++){
if(!in_array($result[$i]['session_id'], $friends)){
unset($result[$i]);
}
}
}
$result = array_values($result);