Affects Version/s: 2.6, 3.0.5, 3.1.1, 3.1.5, 3.2.2
Enable developer debugging mode Create a course with a graded activity Add another activity with access restriction that depends on grade in the first activity Copy URL of the second activity Try to open this URL as a student who does not satisfy grade condition, you should be redirected to course page In CLI purge caches Try to open the same URL again as a student, you should be redirected to course page without debugging notices
- Enable developer debugging mode
- Create a course with a graded activity
- Add another activity with access restriction that depends on grade in the first activity
- Copy URL of the second activity
- Try to open this URL as a student who does not satisfy grade condition, you should be redirected to course page
- In CLI purge caches
- Try to open the same URL again as a student, you should be redirected to course page without debugging notices
Affected Branches:MOODLE_26_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
Fixed Branches:MOODLE_31_STABLE, MOODLE_32_STABLE
Pull from Repository:
Pull Master Branch:wip-
Pull Master Diff URL:
Rewriting the issue description after investigation:
grade_item->get_name() in conditionlib returns the name that has already been formatted and passed through get_string(). The item name is cached in course modinfo/sectioninfo if there is some module or section with availability depending on the grade in this item.
This was discovered via the debugging message if format_string() is called before page context was set (see below), but it also means that get_string and format_string are called for language, user and context that were used when cache was build and not when the string was displayed. This may cause problems in multilang environment and comprehensive filters that depend on particular course.
Example: with multilang filter enabled, cache was rebuild when english-speaking teacher was accessing the course. The English name of the activity will be displayed to French-speaking student.
It seems that something has been recently broken:
1) master branch (I've not tried stables)
2) Go to ANY activity (DEBUG_DEVELOPER enabled). I've tried glossary, forum, lesson.
3) Purge caches
4) After the redirect, this is shown:
Weird, because it is require_login() the function being executed.