Max sections
When creating a course in Moodle in the ‘Custom sections’ you can decide how many sections you want up to a maximum that has been set by the administrator. It has been this way since the setting site ‘maxsections’ was introduced in Moodle 2.1 by the tracker issue ‘MDL-25357’. This is set to change in Moodle 5.1 with its removal from use by ‘MDL-84291‘, ‘Deprecate max sections setting’, which will remove it for the ‘Custom sections’ format but allow its use in other contributed formats until Moodle 6.0.
In this post I’ll discuss my feelings about this and consider the implications of the change.
Disclaimers
Names / logos can be trademarks of their respective owners. Please review their website for details. I am independent from the organisations mentioned and am in no way writing for or endorsed by them. The information presented in this article is written according to my own understanding, there could be inaccuracies, so please do undertake your own research. The featured image is my copyright, please don’t use without my permission.
The problem
When an editing teacher is creating or editing a course, then there is a current limit on the number of sections. This is set at the site level by ‘maxsections’ (On the ‘Course settings’ page but not described by docs.moodle.org/500/en/Course_settings), which can be frustrating if you get the message:

Or similar. Normally this is not a problem because the number set will be the default, fifty two, or higher. However, if the value of ‘maxsectons’ is lower and you’re using ‘sub-sections’, please see my post on ‘Subsections’, then this can easily happen, which I’ll now admit is frustrating. But if ‘sub-sections’ aren’t really ‘sections’ (moodle.org/mod/forum/discuss.php?d=464693) then that wouldn’t be so much of an issue, however, taking into account MDL-83056, where ‘sub-sections’ are considered to be ‘sections’ then hitting the maximum number of sections permitted is a real possibility.
A solution
A solution to the problem is to simply remove the ‘maxsections’ setting and not have any enforced upper bounds on the number of sections that can be created. This is what ‘MDL-84291’ will do (at the time of typing) in Moodle 5.1. Initially I was against this, my software engineer brain kicking in as one of the golden rules is to ensure that all user input is bound checked, i.e. cannot be lower or greater than a certain value. To prevent the user from doing something that causes mess and a panic, the ‘edge’ cases. This and more I raised as comments on ‘MDL-84291‘, where you can read my frustrations. Frustrations not out of any malice but rather to prevent issues before they become a real issue when Moodle 5.1 is released.
A perspective
Now that I’ve understood from a user’s perspective that reaching the limit is frustrating, and potentially annoying, then there needs to be a compromise. One that allows flexibility for the user to quickly get what they want and yet at the same time prevent them from doing silly things. We’re all human, we make mistakes, we need tools to help us create things for our use and at the same time repair what we have broken. This in a way is what the course ‘numsections’ setting did. It allowed you to create and remove sections simply by changing its value from ‘0’ to the default maximum of ‘52’, which could then be changed by the ‘maxsections’ setting. If however, we do away with these, then we still need the same bulk section creation and removal flexibility, but one that certainly doesn’t allow us to create ‘65536’ sections in one go.
The problem with the solution
The issue I have with ‘MDL-84291‘ is that it takes away without giving back. Now when you create a course in the ‘Custom sections’ course format you have no choice over the number of sections you initially want:

Instead the number of initial sections created is set by the administrator:

With the ‘numsections’ site setting. Note that this is a different thing to the previous course instance of this.
Then when you enter the course, then you have the ‘four’ sections and no means of adding multiple new sections with the bulk editing tool:

Instead your only option is to add each new section one by one:

Now equally, if not more frustrating than hitting the maximum number of sections. Especially if you want lots.
If the administrator set ‘numsections’ to ‘8’ instead, then you’d get eight on creation then have to delete them, but admittedly this looks as it can be done with the bulk editing tool in one go.
A workaround
One way to get around this is to first create the course as ‘Weekly sections’, there you get on creation the ability to set the ‘Number of sections’ between ‘0’ and a ‘hard coded’ ‘52’ (‘maxsections’ setting no longer affects this), where ‘hard coded’ means that only a programmer can change it:

Then after saving, going back to the course settings and changing the ‘Format’ to ‘Custom sections’.
A question
To me this feels like an incomplete solution to a problem, one that creates a bigger problem than the one it attempts to resolve. The existing solution may not be brilliant, but it’s better than taking away functionality before fully replacing it with something far better. Hopefully between now and the release of Moodle 5.1 this could still happen.
Therefore the question I pose is ‘Am I correct?’.
- Max sections – 16th June 2025
- Static adjustment – 16th May 2025
- Static publishing – 16th April 2025