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

Students locally assigned as teachers can't create new questions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.2
    • Fix Version/s: 1.9.5
    • Component/s: Questions, Quiz
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      To reproduce.

      Create a quiz
      Locally assign in that quiz the teacher role to a student.
      Login in the course as that student and enter the quiz (edit tab)
      You can't create new questions. You got the message "You don't have permission to add questions here."

      a workaround:
      create a question subcategory under the default for the quiz
      go back editing the quiz, select the subcategory (you can create questions there) and select again the default category for the quiz. Now you can create new questions in the quiz's default category. As long as there's another category in the quiz this trick works (selecting the subcategory and back again the default category in the category select menu)

      We track down the problem to the function question_make_default_categories() as it returns only the categories in the course context. So to fix this we change the CONTEXT_COURSE for the CONTEXT_MODULE. The function is always called from a quiz so the module context makes more sense than the course context.

      — moodle/lib/questionlib.original.php,v 1.119.2.13 2008/07/10 09:48:44
      +++ moodle/lib/questionlib.php 2009-03-12 10:09:29.000000000 +0100
      @@ -1903,7 +1903,7 @@
      }
      }
      }

      • if ($context->contextlevel == CONTEXT_COURSE)
        Unknown macro: {+ if ($context->contextlevel == CONTEXT_MODULE){ $toreturn = clone($category); } }

      We tested this solution on a 1.9.2 moodle with a 8.2.4 postgres installed in a SUSE Linux Enterprise Server 10 SP1

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/09