Update course cache when creating new standard forums!
authormoodler <moodler>
Thu, 14 Nov 2002 02:33:48 +0000 (02:33 +0000)
committermoodler <moodler>
Thu, 14 Nov 2002 02:33:48 +0000 (02:33 +0000)
mod/forum/lib.php

index 1e8cd04..944339c 100644 (file)
@@ -407,6 +407,8 @@ function forum_grades($forumid) {
 
 function forum_get_course_forum($courseid, $type) {
 // How to set up special 1-per-course forums
+    global $CFG;
+
     if ($forum = get_record_sql("SELECT * from forum WHERE course = '$courseid' AND type = '$type'")) {
         return $forum;
 
@@ -466,6 +468,11 @@ function forum_get_course_forum($courseid, $type) {
                 notify("Could not update the course module with the correct section");
                 return false;
             }
+            include_once("$CFG->dirroot/course/lib.php");
+            $modinfo = serialize(get_array_of_activities($courseid));
+            if (!set_field("course", "modinfo", $modinfo, "id", $courseid)) {
+                error("Could not cache module information!");
+            }
         }
             
         return get_record("forum", "id", "$forum->id");