From: stronk7 Date: Sun, 16 Nov 2003 22:49:11 +0000 (+0000) Subject: When restoring "teacher" forums, if it exists in destinatio course, discussions X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=73daab351ce37e27ea7c6113d69b7257970d3f1e;p=moodle.git When restoring "teacher" forums, if it exists in destinatio course, discussions are merged mantaining a unique forum (previously, a second "teacher" forum was created). See bug 880 (http://moodle.org/bugs/bug.php?op=show&bugid=880). --- diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php index e6ba310b93..5ba94f3df5 100644 --- a/mod/forum/restorelib.php +++ b/mod/forum/restorelib.php @@ -68,9 +68,23 @@ $forum->scale = -($scale->new_id); } } + + $forumtobeinserted = true; + //If the forum is a teacher forum, then we have to look if it exists in destination course + if ($forum->type == "teacher") { + //Look for teacher forum in destination course + $teacherforum = get_record("forum","course",$restore->course_id,"type","teacher"); + if ($teacherforum) { + $newid = $teacherforum->id; + $forumtobeinserted = false; + } + } - //The structure is equal to the db, so insert the forum - $newid = insert_record ("forum",$forum); + //If the forum has to be inserted + if ($forumtobeinserted) { + //The structure is equal to the db, so insert the forum + $newid = insert_record ("forum",$forum); + } //Do some output echo "