Changes to forum reset By Lori Bakken May 14, 07 mod/forum/lib.php In function forum_reset_course_form() line 4834 - added after print_checkbox('reset_question_answer', 1, true, get_string('qandaforum','forum'), '', ''); echo '
'; replace whole function forum_delete_userdata with function forum_delete_userdata($data, $showfeedback=true) { global $CFG; $sql = "DELETE FROM {$CFG->prefix}forum_posts WHERE discussion IN ( SELECT fd.id FROM {$CFG->prefix}forum_discussions fd, {$CFG->prefix}forum f WHERE f.course={$data->courseid} AND f.id=fd.forum "; // closing ) added bellow // Delete actual discussion for the forum $sql2 = "DELETE FROM {$CFG->prefix}forum_discussions WHERE forum IN ( SELECT f.id FROM {$CFG->prefix}forum f WHERE f.course={$data->courseid} "; // closing ) added bellow $strreset = get_string('reset'); if (!empty($data->reset_forum_news)) { $select = "$sql AND f.type = 'news' )"; $select2 = "$sql2 AND f.type = 'news' )"; if (execute_sql($select, false) and $showfeedback) { notify($strreset.': '.get_string('namenews','forum'), 'notifysuccess'); } if (execute_sql($select2, false) and $showfeedback) { notify($strreset.': '.get_string('namenews','forum'), 'notifysuccess'); } } if (!empty($data->reset_forum_single)) { $select = "$sql AND f.type = 'single' ) AND parent <> 0"; $select2 = "$sql2 AND f.type = 'single' ) AND parent <> 0"; if (execute_sql($select, false) and $showfeedback) { notify($strreset.': '.get_string('singleforum','forum'), 'notifysuccess'); } if (execute_sql($select2, false) and $showfeedback) { notify($strreset.': '.get_string('singleforum','forum'), 'notifysuccess'); } } if (!empty($data->reset_forum_eachuser)) { $select = "$sql AND f.type = 'eachuser' )"; $select2 = "$sql2 AND f.type = 'eachuser' )"; if (execute_sql($select, false) and $showfeedback) { notify($strreset.': '.get_string('eachuserforum','forum'), 'notifysuccess'); } if (execute_sql($select2, false) and $showfeedback) { notify($strreset.': '.get_string('eachuserforum','forum'), 'notifysuccess'); } } if (!empty($data->reset_forum_general)) { $select = "$sql AND f.type = 'general' )"; $select2 = "$sql2 AND f.type = 'general' )"; if (execute_sql($select, false) and $showfeedback) { notify($strreset.': '.get_string('generalforum','forum'), 'notifysuccess'); } if (execute_sql($select2, false) and $showfeedback) { notify($strreset.': '.get_string('generalforum','forum'), 'notifysuccess'); } } if (!empty($data->reset_question_answer)) { $select = "$sql AND f.type = 'qanda' )"; $select2 = "$sql2 AND f.type = 'qanda' )"; if (execute_sql($select, false) and $showfeedback) { notify($strreset.': '.get_string('qandaforum','forum'), 'notifysuccess'); } if (execute_sql($select2, false) and $showfeedback) { notify($strreset.': '.get_string('qandaforum','forum'), 'notifysuccess'); } } if (!empty($data->reset_forum_subscriptions)) { $subscripsql = "DELETE FROM {$CFG->prefix}forum_subscriptions WHERE forum IN ( SELECT id FROM {$CFG->prefix}forum WHERE course = {$data->courseid} )"; if (execute_sql($subscripsql, false) and $showfeedback) { notify($strreset.': '.get_string('resetsubscriptions','forum'), 'notifysuccess'); } } }