Taking quiz in course that is open to guests

Taking quiz in course that is open to guests

by Artem Andreev -
Number of replies: 3
Situation which confused students: course that is open to guests. Authenticated user (not enrolled in this course) enter in quiz and doesn't see "Attempt quiz now" button.
I think it will be good to add some description and button "Enrol me in this course" after quiz introduction. I try search similar bug or improvment request, but didn't find...

P.S. I have moodle 1.8
Average of ratings: -
In reply to Artem Andreev

Re: Taking quiz in course that is open to guests

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This is definitely not the right behaviour. Please can you file a bug in the tracker.
In reply to Tim Hunt

Re: Taking quiz in course that is open to guests

by Artem Andreev -
Ok. added bug 10370
In reply to Artem Andreev

Re: Taking quiz in course that is open to guests

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I have just reported this as
MDL-10376

I have included some rather crude code that may address it as follows

$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if(!isguest()){
if(!has_capability('mod/quiz:attempt',$context)){
 print"<div align=center>";
 print "<h3> You need to be enrolled to make quiz attempts </h3>";
 print "<a href=".$CFG->wwwroot."/course/enrol.php?id=".$course->id .">Click here to enrol </a>";
 print "</div>";
 }
}
This is to go in mod\quiz\view.php just above the comment that reads

//Guests can't do a quiz, so offer them a choice of logging in or going back

The code should be internationalized for its strings and I have not given it serious testing but it might make a reasonable start?