Hide all topics in a single course at once

Viewed 22

I have to prepare courses for a new student year. All courses have to be reset and all topics within courses have to be hidden. Is there a way to acomplish this with a single command or at least with the single command within a course. Now I am doing it by clicking hide on each single topic in each course what takes a lot of time.

1 Answers

I don't think there is a bulk command for this.

I wouldn't recommend an SQL update because there are some background updates when the section visibility is changed.

Maybe trying something like this

$course = get_course($courseid);
$sections = $DB->get_records('course_sections', array('course' => $course->id));
foreach ($sections as $section) {
    course_update_section($course, $section, array('visible' => $visible));
}
Related