]> git.mjollnir.org Git - moodle.git/commitdiff
Included chat_get_participants() function.
authorstronk7 <stronk7>
Thu, 4 Sep 2003 22:08:06 +0000 (22:08 +0000)
committerstronk7 <stronk7>
Thu, 4 Sep 2003 22:08:06 +0000 (22:08 +0000)
mod/chat/lib.php

index c5539a4551b7697f12d2524973ef80df89b00178..20919684a52523a8ba0cc93dfea83e53d346e3d5 100644 (file)
@@ -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);
+}
+
 ?>