Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-10376

Blank screen presented if you are logged in but not enrolled on a course when attempting a quiz on a course that allows in guests

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.9
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      When attempting a quiz where the user is logged in but not enrolled on the course that allows in guests.
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      If a user is logged but not enrolled in a course that allows in guests. If they try to take a quiz they are presented with a screen that tells them how the quiz is graded but no more information. What is needed seems to be some code that prompts them to enroll in the course. I have some general code that seems to add this functionality into the mod\quiz\view.php module.

      If the following code is added just above the comment that says
      //Guests can't do a quiz, so offer them a choice of logging in or going back

      $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>";

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              marcusgreen Marcus Green
              Tester:
              Nobody
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08