General plugins (Local): Purge question categories

Maintained by Picture of Vadim DvorovenkoVadim Dvorovenko
This plugin allows to delete question category with all questions and subcategories
113 sites
8 fans
Current versions available: 1

This plugin extends question bank navigation node with "Purge categories" item.

Select category you want to delete and specify where to move questions, that cannot be deleted. Questions, that cannot be deleted, are questions, that are used in quizes or in history of quiz attempts. Such questions will be moved to specified categories and marked as hidden.

This can be useful if you are importing a lot of questions with many categories and want to delete all of them and reimport them.


This plugin is part of set Question bank improvements.


Screenshot #0
Screenshot #1
Screenshot #2


Picture of Vadim Dvorovenko
Vadim Dvorovenko (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Mike Churchward
    Tue, May 10, 2016, 10:39 PM
    Hi Vadim.

    I am doing the initial review of your plugin for the Plugins Guardians.
    I have posted one issue you need to look at in your tracker -

    Another consideration would be to consider adding the line 'defined('MOODLE_INTERNAL') || die();' to all files that are not called directly (for example, all your "classes/*" files. While not strictly necessary, it adds one more level of security to those files that should not be accessed directly.

    I'll post any more comments I have as I work through.
  • Picture of Mike Churchward
    Tue, May 10, 2016, 10:56 PM
    Hi Vadim -

    I may not be using / testing this plugin correctly. When I go to the page: "/local/purgequestioncategory/category.php?courseid=2" (for example) using the "Purge categories" menu item, I am provided a page that lists categories of questions in the context, with a number in brackets, similar to what I would see with the standard "Edit categories" function. But there are no other controls or links on that page. Should I be able to do something more there?
  • Picture of David Mudrák
    Thu, May 12, 2016, 6:44 PM

    Thanks Vadim for sharing this plugin with the Moodle community, and thanks Mike for detailed peer-review of it. I left some more feedback in the plugin's tracker but I believe this is good and safe to be approved now. You are cleared to land, welcome to the Plugins directory!

  • Picture of mart van der niet
    Fri, Jun 10, 2016, 5:52 PM
    Is this a bug?
    Moodle V3.1




    Coding problem: $PAGE->context was not set. You may have forgotten to call require_login() or $PAGE->set_context(). The page may not display correctly as a result
    line 458 of /lib/pagelib.php: call to debugging()
    line 773 of /lib/pagelib.php: call to moodle_page->magic_get_context()
    line 1420 of /lib/weblib.php: call to moodle_page->__get()
    line 1164 of /lib/pagelib.php: call to format_string()
    line 51 of /local/purgequestioncategory/confirm.php: call to moodle_page->set_title()

    After choosing "continue" on the confirmation page result is:

    A required parameter (courseid) was missing

    More information about this error

    ×Debug info:
    Error code: missingparam
    ×Stack trace:
    line 495 of /lib/setuplib.php: moodle_exception thrown
    line 552 of /lib/moodlelib.php: call to print_error()
    line 290 of /question/editlib.php: call to required_param()
    line 31 of /local/purgequestioncategory/category.php: call to question_edit_setup()

    Categories are purged though.

  • Picture of Matthew Wilson
    Fri, Jan 5, 2018, 6:14 AM
    Are there any plans to make this available for 3.3 or 3.4?
  • Picture of Vadim Dvorovenko
    Sat, Jan 6, 2018, 12:14 AM
    I hope i'll found time to do it in this month. Currently you can try to use 3.2 version, but it will show depreceted message on pix_url
  • King Crab Fishing in Norway
    Thu, May 2, 2019, 12:25 AM
    This is a great plugin. I do wish this purge plugin had an option to quickly delete all categories and the unused questions within them at once.
Please login to post comments