$mod->visible = 0;
$mod->visibleold = 0;
$mod->groupmode = 0;
-
- print_object($mod);
-
+
if (!$cmid = add_course_module($mod)) {
error('Could not create new course module instance for the teacher forum');
} else {
$mod->coursemodule = $cmid;
- if (!add_mod_to_section($mod)) {
- error('Could not add new forum instance to section 0 in the course');
+ if (!$sectionid = add_mod_to_section($mod)) {
+ error('Could not add converted teacher forum instance to section 0 in the course');
+ } else {
+ if (!set_field('course_modules', 'section', $sectionid, 'id', $cmid)) {
+ error('Could not update course module with section id');
+ }
}
}
}
break;
}
- // Drop column forum.open.
- modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN open;');
-
// $forum->assessed defines whether forum rating is turned
// on (1 or 2) and who can rate posts:
break;
}
-
// $forum->assesspublic defines whether students can see
// everybody's ratings:
// 0 = Students can only see their own ratings
assign_capability('mod/forum:viewanyrating', CAP_ALLOW, $studentrole->id, $context->id);
break;
}
- // Drop column forum.assesspublic.
- modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN assesspublic;');
}
- } // End foreach $teacherforums.
+ } // End foreach $forums.
+
+ // Drop column forum.open.
+ modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN open;');
+
+ // Drop column forum.assesspublic.
+ modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN assesspublic;');
+
+ // We need to rebuild all the course caches to refresh the state of
+ // the forum modules.
+ rebuild_course_cache();
+
} // End if.
}
$generalforums = array(); // For now
$learningforums = get_all_instances_in_course("forum", $course);
-
+
if ($forums = get_records("forum", "course", $id, "name ASC")) { // All known forums
if ($learningforums) { // Copy "full" data into this complete array
$forum->assessed = 0;
$forum->forcesubscribe = 0;
break;
- case "teacher":
- $forum->name = addslashes(get_string("nameteacher", "forum"));
- $forum->intro = addslashes(get_string("introteacher", "forum"));
- $forum->assessed = 0;
- $forum->forcesubscribe = 0;
- break;
default:
notify("That forum type doesn't exist!");
return false;