From 7685016d202dca78b3390d05bd4d389cde7c9cc1 Mon Sep 17 00:00:00 2001 From: skodak Date: Thu, 1 Jan 2009 22:43:20 +0000 Subject: [PATCH] MDL-16262 fixed resetting of single simple discussions; backported from HEAD --- mod/forum/lib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 98b087cc9ee..b189c404c1f 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -6443,11 +6443,12 @@ function forum_reset_userdata($data) { // remove ratings delete_records_select('forum_ratings', "post IN ($postssql)"); - // all posts - delete_records_select('forum_posts', "discussion IN ($discussionssql)"); + // all posts - initial posts must be kept in single simple discussion forums + delete_records_select('forum_posts', "discussion IN ($discussionssql) AND parent <> 0"); // first all children + delete_records_select('forum_posts', "discussion IN ($discussionssql AND f.type <> 'single') AND parent = 0"); // now the initial posts for non single simple - // finally all discussions - delete_records_select('forum_discussions', "forum IN ($forumssql)"); + // finally all discussions except single simple forums + delete_records_select('forum_discussions', "forum IN ($forumssql AND f.type <> 'single')"); // now get rid of all attachments if ($forums = get_records_sql($forumssql)) {