}
if ($forum->type == 'teacher') {
-
+
// Teacher forums should be converted to normal forums that
// use the Roles System to implement the old behavior.
+ // Note:
+ // Seems that teacher forums were never backed up in 1.6 since they
+ // didn't have an entry in the course_modules table.
require_once($CFG->dirroot.'/course/lib.php');
if (count_records('forum_discussions', 'forum', $forum->id) == 0) {
$mod->module = $forummodid;
$mod->instance = $forum->id;
$mod->section = 0;
- $mod->visible = 0;
- $mod->visibleold = 0;
+ $mod->visible = 0; // Hide the forum
+ $mod->visibleold = 0; // Hide the forum
$mod->groupmode = 0;
if (!$cmid = add_course_module($mod)) {
$forum->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$forum->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
-
// These get dropped in Moodle 1.7 when the new Roles System gets
// set up. Therefore they might or not be there depending on whether
// we are restoring a 1.6+ forum or a 1.7 or later forum backup.
} else {
$status = false;
}
-
+
// If the backup contained $forum->open and $forum->assesspublic,
// we need to convert the forum to use Roles. It means the backup
- // was made pre Moodle 1.7. We check the backup_version to make
- // sure.
+ // was made pre Moodle 1.7.
if (isset($forum->open) && isset($forum->assesspublic)) {
-
+
$forummod = get_record('modules', 'name', 'forum');
if (!$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {