From a71efae327ffe830b38b23c09a737da76a6ff32e Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 27 Mar 2005 05:56:23 +0000 Subject: [PATCH] WHen deleting a chat, delete the messages etc too. Bug 2792 --- mod/chat/lib.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mod/chat/lib.php b/mod/chat/lib.php index 5b02b3d73b0..3b4fdfa6570 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -113,7 +113,7 @@ function chat_delete_instance($id) { /// this function will permanently delete the instance /// and any data that depends on it. - if (! $chat = get_record("chat", "id", "$id")) { + if (! $chat = get_record('chat', 'id', $id)) { return false; } @@ -121,7 +121,13 @@ function chat_delete_instance($id) { # Delete any dependent records here # - if (! delete_records("chat", "id", "$chat->id")) { + if (! delete_records('chat', 'id', $chat->id)) { + $result = false; + } + if (! delete_records('chat_messages', 'chatid', $chat->id)) { + $result = false; + } + if (! delete_records('chat_users', 'chatid', $chat->id)) { $result = false; }