marinaglancy / moodle-format_flexsections

25 stars 25 forks source link

maxsectionslimit #78

Closed tuttyk closed 9 months ago

tuttyk commented 10 months ago

Hello, There are a limite of sections ? Whenever I try to create a new section, I receive an error message stating, 'Cannot create new section as it would exceed the maximum number of sections allowed for this course ({$a}).' Interestingly, I am able to create sub-sections without any issues, but creating new sections is not possible. Do you have any ideas on how to resolve this limitation?

Thans for your help, Diana

DiagonalChan commented 9 months ago

Hi! Are you sure that this is a flex section problem? Did you check the maxsections limit in site administration > Courses > Course default settings > maxsections.

Hoping this is helping you!

marinaglancy commented 9 months ago

This was changed in version 4.0.4, see also https://github.com/marinaglancy/moodle-format_flexsections/issues/20

the $CFG->maxsections applies only to the number of the sections on the first level.

The fact that the error message does not contain the actual limit but displays ({$a}) is a core problem and I recommend you to create an issue in Moodle tracker for it. The fix is very simple, this line https://github.com/moodle/moodle/blob/MOODLE_403_STABLE/course/format/classes/stateactions.php#L309

should have $maxsections as the 4th argument, not as the 3rd.