From c8c9cb7bb7a14643e4ebba7688f8de93deaa23ec Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 4 Sep 2003 22:08:06 +0000 Subject: [PATCH] Included chat_get_participants() function. --- mod/chat/lib.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mod/chat/lib.php b/mod/chat/lib.php index c5539a4551..20919684a5 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -545,4 +545,21 @@ function chat_format_message($message, $courseid=0) { } +function chat_get_participants($chatid) { +//Returns the users with data in one chat +//(users with records in chat_messages, students) + + global $CFG; + + //Get students + $students = get_records_sql("SELECT DISTINCT u.* + FROM {$CFG->prefix}user u, + {$CFG->prefix}chat_messages c + WHERE c.chatid = '$chatid' and + u.id = c.userid"); + + //Return students array (it contains an array of unique users) + return ($students); +} + ?> -- 2.39.5