WHen deleting a chat, delete the messages etc too. Bug 2792

This commit is contained in:
moodler 2005-03-27 05:56:23 +00:00
parent fae1077b2a
commit a71efae327

View File

@ -113,7 +113,7 @@ function chat_delete_instance($id) {
/// this function will permanently delete the instance /// this function will permanently delete the instance
/// and any data that depends on it. /// and any data that depends on it.
if (! $chat = get_record("chat", "id", "$id")) { if (! $chat = get_record('chat', 'id', $id)) {
return false; return false;
} }
@ -121,7 +121,13 @@ function chat_delete_instance($id) {
# Delete any dependent records here # # 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; $result = false;
} }