From f9a9499a62e6701736301a36dd90dd4329b25a8d Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 20 Oct 2002 10:13:04 +0000 Subject: [PATCH] Guests can no longer see or attempt quizzes --- mod/quiz/attempt.php | 6 ++++++ mod/quiz/view.php | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index fc0953329c..4f3d929ed4 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -146,6 +146,12 @@ /// Print the quiz page + if (isguest()) { + print_heading(get_string("guestsno", "quiz")); + print_footer($course); + exit; + } + /// Actually seeing the questions marks the start of an attempt if (!$unfinished = quiz_get_user_attempt_unfinished($quiz->id, $USER->id)) { diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 6dc2a9428d..eeaacc42eb 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -38,7 +38,7 @@ add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", "$quiz->id"); $timenow = time(); - $available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose); + // Print the page header @@ -62,6 +62,8 @@ echo "

id\">".get_string("viewallanswers","quiz",$answercount)."

"; } + $available = ($quiz->timeopen < $timenow and $timenow < $quiz->timeclose); + // Print the main part of the page print_heading($quiz->name); @@ -76,6 +78,12 @@ echo "

".get_string("quizclosed", "quiz", userdate($quiz->timeclose)); } + if (isguest()) { + print_heading(get_string("guestsno", "quiz")); + print_footer($course); + exit; + } + if ($attempts = quiz_get_user_attempts($quiz->id, $USER->id)) { $numattempts = count($attempts); } else { -- 2.39.5