Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Question Engine Changes in Moodle 1.9.

Question Engine Changes in Moodle 1.9

From MoodleDocs


General Clean Up of UI and Code

  • Many parts of the question code have been cleaned up. The Quiz / Question UI has some improvements - the category editing page's table has been replaced by unordered lists and the controls for editing categories have been improved.
  • Question code no longer relies on browser sessions. Before if you had more than one browser window open for editing a quiz / questions navigation would have been unpredictable now you can have several independent browser windows open at once to edit quizzes and questions.
  • Further work has been done on separating the question bank code from the quiz module to make it possible to access questions in the question bank from other modules.

Better Management of Files Linked to In Questions

Since Moodle 1.9 we have some automatic handling of files linked to from questions. When you move questions between sharing contexts and when you back up courses with questions in them, Moodle will now help you manage files linked to in your questions.

Separated Questions into Different Category Hierarchies in Different Context Levels

Before 1.9 questions were always associated with one course. You could 'share' a question to allow it to be visible in another course. Now questions can be shared in an activity, a course, a course category or with the whole system. These different levels of sharing are Moodle 'contexts'. More info here Question contexts

Upon upgrade :

  • a category that was shared will now be in the System context and it will have the course name from which it has been taken appended to the category name in brackets.
  • Questions that were not shared will be put in the course context upon upgrade.
  • The only exception to this is the special case outlined below in #Random Questions Selecting from Subcategories

More Granular Capabilities

Since Moodle 1.9 we have more granular capabilities for access and use of questions see Question permissions for more info. Question permissions are now tested in the context in which the questions are shared see Question contexts for more info.


On upgrade from an older version of Moodle question capabilities are automatically assigned.

Roles that previously had the moodle/question:manage capability will have :

This will give all users effectively the same permissions as they had previously for questions shared at the course level.

Potential Issues on Upgrade

Access to question categories shared outside a course

Questions that are shared above the course level may not be available to course teachers. Normally the teacher role is assigned at the course level so the teacher's capabilities will only cover the course in which they are assigned the teacher role. You must define a new role and assign all users that you want to be able to share questions above the course level that role. You do this by :

You can also create a role 'Shared question user':

  • log in as an admin
  • go to Administration > Users > Permissions > Define roles
  • click on Add New Role button
  • define a new Role Shared question user
  • give the role these question permissions :

Assign the role at the system level to give the user the 'Shared question user' / 'Shared Question Creator' permissions in the System context and in all the Course Categories. The user will also have the same permissions in all courses and activities unless you override the permissions at these levels for any of the roles the user has (eg. Teacher / Student etc) a 'prevent' at a lower context level will override an allow at the system or course category level. You assign a role at the system level by going to Administration > Users > Permissions > Assign global roles.

You can also assign a role at the course category level by going to Administration > Courses > Add/edit courses and clicking on one of the course category names and then clicking on the Assign Roles link to the top right of the screen. The role will apply to all contained course categories and also to all courses / activities contained.

Random Questions Selecting from Subcategories

Screen shot of problems reported in environment check upgrading to 1.9

Normally upon upgrade questions that are shared are moved to a category in the system context. Questions that are not shared are kept in the course context.

In the following special case this is not true and the sharing status of some questions may have been changed :

  • You have some random questions in your quizzes which are selected from sub categories.
  • AND the sub categories the random questions are selected from have a different 'shared' status to any of the sub categories. Eg. you have a random question in a category that is not shared and some of the sub categories you are selecting from are not shared. OR you have a random question in a category that is shared and some of the sub categories you are selecting from are shared.

There is a special check for this case in the environment check code and a special admin report for checking this.

When a random question as above is found in the question bank then :

  • all sub categories below the random question are set to the same 'shared' status as the category the random question is in.
  • if there is another random question in one of the sub categories it is ignored, all sub categories are set to the same status.

Questions already included in quizzes will continue to work as before.

There is an environment check to check for possible problems with 'Random Questions Selecting from Subcategories'. See screen shot.

Screen shot of questions admin report reporting problems with random questions.

More information about the issue on your system is available in Admin / Reports / Question, this is linked to from the environment check message when a problem is detected. Environment checks and the question admin report have been backported to the latest version of MOODLE_18_STABLE.

More info about changes in Moodle 1.9 can be found on these pages

The following permissions are new in Moodle 1.9 (they replace moodle/question:manage, giving more control over exactly what someone can do) :

And the following no longer exist :