Thanks for this thread everybody,
Just like Mary I never realised that one can actually link to orphaned sections. It looks like you were exploiting the bug in Moodle behavior as a feature.
To summarise what was set above, here are the reproduction instructions (on Moodle 3.2 or earlier):
- Set up a course in "topics" format to display one section per page
- Add activities to every topic and then decrease the number of sections down to 0
- Add nice buttons to "general section" with links to pages http://YOURSITE/course/view.php?id=12345§ion=1 ; http://YOURSITE/course/view.php?id=12345§ion=2 ; ...
- When student opens the course page they only see the buttons and do not see sections headings
- student will be able to follow the links and the sections will be displayed with all activities they contain (one per page)
I must say, Moodle users are very creative! I would never think of doing that, I would just install a course format that does buttons for you. I'm pretty sure Grid format was designed exactly for this scenario.
This is what I can recommend you in Moodle 3.3 to keep this behavior:
After upgrade all orphaned sections will automatically become "hidden". You will need to unhide sections one by one.
Now you need to hide the links to the sections from the course main page. You can do it by adding the CSS :
ul.topics li.section-summary { display:none}
How can you add CSS? There are multiple options for it.
- If you are an admin on the site, you can add it to "Custom CSS" in your theme settings. In this case it will apply to ALL courses in topics format that have "display one section per page" setting.
- If you are an admin but want to apply to one course only you'll need to prefix it with course-specific identifier: "body.course-12345 ul.topics li.section..." (where 12345 is the course id)
- If you are not an admin you can add CSS style somewhere in your course, for example in general section summary or as a label. You need to disable Atto editor in your preferences to do it because Atto will remove <style> tag. See screenshot
As I said, these are all just workarounds and hacks to make the "Topics" format look like some other course format. The best solution will be to use the proper course format.