So we have been trying to fix this and I am wondering if this is the problem:
In mod/quiz/view there is some script as follows:
// Determine wheter a start attempt button should be displayed.
$viewobj->quizhasquestions = (bool) quiz_clean_layout($quiz->questions, true);
$viewobj->preventmessages = array();
if (!$viewobj->quizhasquestions) {
$viewobj->buttontext = '';
} else {
if ($unfinished) {
if ($canattempt) {
$viewobj->buttontext = get_string('continueattemptquiz', 'quiz');
} else if ($canpreview) {
$viewobj->buttontext = get_string('continuepreview', 'quiz');
}
} else {
if ($canattempt) {
$viewobj->preventmessages = $viewobj->accessmanager->prevent_new_attempt(
$viewobj->numattempts, $viewobj->lastfinishedattempt);
if ($viewobj->preventmessages) {
$viewobj->buttontext = '';
} else if ($viewobj->numattempts == 0) {
$viewobj->buttontext = get_string('attemptquiznow', 'quiz');
} else {
$viewobj->buttontext = get_string('reattemptquiz', 'quiz');
}
} else if ($canpreview) {
$viewobj->buttontext = get_string('previewquiznow', 'quiz');
}
}
I am thinking the solution is in the blue text. "attemptquiznow" is present if there are no previous attempts (numattempts==0). If I knew that I wanted everyone to have 2 attempts only, and I wanted that button to show up ONLY if they had not passed, how would I code for that?