-
Bug
-
Resolution: Fixed
-
Trivial
-
1.9.3
-
None
-
CENT OS 5, PHP 5.1.6
-
MOODLE_19_STABLE
-
MOODLE_19_STABLE
To reproduce: Using the latest 1.9 build ( cvs -z3 -d:pserver:anonymous@eu.cvs.moodle.org:/cvsroot/moodle co -P -r MOODLE_19_STABLE moodle )
1) Login as an instructor
2) Create a course
3) Create a new quiz, with no "close" date
4) View the quiz
Expected result: I expect the "preview quiz now" button to appear.
Actual result: The message "This quiz closed on " appears, with the date of the UNIX epoch listed as the close date.
5) Change the "close" date to sometime in the future
6) View the quiz
Expected result: I expect the "preview quiz now" button to appear, accompanied by the closing date of the quiz.
Actual result: The message "This quiz closed on " appears, with the correct (future) closing date of the quiz.
This appears to be a result of a code change to mod/quiz/view.php at line 108, which ANDs the quiz open/close times with the has_capability('mod/quiz:attempt'). This capability will (correctly) be missing for instructors, as they can only preview the quiz, not attempt it.
My fix was to OR that capability has_capability('mod/quiz:manage') so lines 105-108 now appear as:
// Print information about timings.
$timenow = time();
$available = ($quiz->timeopen < $timenow and ($timenow < $quiz->timeclose or !$quiz->timeclose)) &&
(has_capability('mod/quiz:attempt', $context) || has_capability('mod/quiz:manage', $context));
- is duplicated by
-
MDL-18064 Janauary 1970 quiz close date date shown when switching role to Teacher
-
- Closed
-