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.
Asked
Active
Viewed 132 times
1 Answers
1
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));
}

Russell England
- 9,436
- 1
- 27
- 41
-
Thank you for your effort. This is a solution for programmers. As I can recognize, this is PHP code. I am not skilled enough to use it. I would prefer a menu command and it seems that there is not something like that. – adobro Sep 23 '22 at 19:33
-
Ah... StackOverflow is a website for programmers – Russell England Sep 23 '22 at 19:40
-
Sorry! I am a programmer and use stackoverflow regularly, but I don't use PHP (more or less Python). To be honest I used PHP in the past on Moodle and I don't have a good experience. Therefore, I'm a little bit afraid to use it. Aplogize. Was not the right place to post this question here. – adobro Sep 23 '22 at 19:45