Purge question categories

General plugins (Local) ::: local_purgequestioncategory
Maintained by Vadim Dvorovenko
This plugin allows to delete question category with all questions and subcategories
Latest release:
246 sites
23 downloads
17 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.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

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

Comments RSS

Show comments
  • mart van der niet
    པ་སངས་, 10 ཟླ་༦ 2016, 5:52 PM
    Is this a bug?
    Moodle V3.1


    Doing:

    http://***.***.***/local/purgequestioncategory/confirm.php?purge=16

    Gives:

    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.

    MvdN
  • Matthew Wilson
    པ་སངས་, 5 ཟླ་༡ 2018, 6:14 AM
    Are there any plans to make this available for 3.3 or 3.4?
  • Vadim Dvorovenko
    སྤེན་པ་, 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
    ཕུར་བུ་, 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.
  • Greg watching STS 132 takeoff!
    པ་སངས་, 12 ཟླ་༦ 2020, 5:32 AM
    Thank you for this plugin it is a real timesaver.

    One thing I did notice (using moodle 3.5.2) is that it throws an error after deleting the questions/categories (at first I thought it did not work):

    A required parameter (courseid) was missing

    More information about this error

    ×Debug info:
    Error code: missingparam
    ×Stack trace:
    line 482 of /lib/setuplib.php: moodle_exception thrown
    line 573 of /lib/moodlelib.php: call to print_error()
    line 296 of /question/editlib.php: call to required_param()
    line 31 of /local/purgequestioncategory/category.php: call to question_edit_setup()
  • Vadim Dvorovenko
    པ་སངས་, 12 ཟླ་༦ 2020, 12:47 PM

    Greg Lyon. thanks for your feedback. I've found this porblem was reported before, but i can't reproduce problem. Currently i have some ideas.
    Are you purging categories on context or system level? i've tested it only on course and course module levels
  • Blair F.
    སྤེན་པ་, 10 ཟླ་༤ 2021, 1:22 AM
    I'm a little confused by this plugin. Above, it states, "Select category you want to delete and specify where to move questions." However, core Moodle already does that. However, in my testing with this so far (only 10 minutes, admittedly), it doesn't ask me where I want to move questions. One thing it does do, though, is state that the questions are UNUSED. Does the option to move only show up if there ARE unused questions, then? So far, I haven't found this any faster than just deleting them the usual way, so I feel I really am missing something.
  • Blair F.
    སྤེན་པ་, 10 ཟླ་༤ 2021, 1:33 AM
    By the way, I've got at least one course with 1700 categories and 35,000 questions. That's why I'm excited about the possibilities here.
  • Vadim Dvorovenko
    ཉི་མ་, 11 ཟླ་༤ 2021, 10:49 PM

    Blair F., This plugin work same as base category deleting. The only difference, it can delete all subcategories at once. For example, you have category, having 30 subcategories, eatch ot hem have 10 subcategories. With builtin deletion you have to delete 30 * 10 = 300 times, with this plugin - only once.
    The category you specify is neededed to move USED questions. UNUSED quiestion can be safely deleted, so they are deleted. Build in deletion works the same
  • Blair F.
    ཕུར་བུ་, 15 ཟླ་༤ 2021, 11:20 PM
    Ah, I see. So, it's the multi-levels of sub-categories that makes the difference. I hadn't considered that. Thank you.
  • Eric Katchan
    པ་སངས་, 15 ཟླ་༡༠ 2021, 1:20 AM
    Hello, just want to confirm behavior. This plugin will only remove items that are not in the default category for the course. I installed th eplugin, navigated to a course and when i navigated to the question bank I was just shown a list of categories but no ability to delete. when I moved some questions from default category to a new one, I was able to delete the category. Is that the expected behavior?

    I ran into the same issue as Mike Churchward above.

    Moodle 3.9.9
  • Vadim Dvorovenko
    ཉི་མ་, 17 ཟླ་༡༠ 2021, 1:00 PM
    Eric Katchan, yes, that's expected. This plugin works same way as standard category deletion - you cannot remove last category in context. You may create other empty category in the Top level, and then pugre first category
  • A K M SAFAT SHAHIN
    པ་སངས་, 12 ཟླ་༨ 2022, 6:55 AM
    Hi,
    In Moodle 4.0, the question bank has changed quite a lot (see https://docs.moodle.org/dev/Question_bank_improvements_for_Moodle_4.0).
    In particular, there is a new type of plugin: qbank_.... This should be documented at https://docs.moodle.org/dev/Question_bank_plugins, but I am afraid that this is not complete yet. (However, there is information in the upgrade.txt files in the code, and the PHPdocs in the code should explain things.)

    So, I think it is a case of
    Bad news: you will have to re-write all your local plugins as qbank plugins to work with Moodle 4.0+.
    Good news: if you do, then they will probably work even better for users and you can probably reuse almost all of your code.

    There are a lot of references in question/bank directory in Moodle 4.0 repository. Please do not hesitate to get in touch if you have any questions.

    Cheers!
  • Henrik sune Pedersen
    ཕུར་བུ་, 10 ཟླ་༨ 2023, 9:33 PM
    Is this being updated for Moodle 4 as well?
  • chandan kumar
    ཉི་མ་, 8 ཟླ་༡༠ 2023, 2:00 PM
    This Plugin does not work anymore with moodle 4.0 and ahead. Please develop a version of this plugin for moodle 4.0 and ahead also. It is very useful plugin.
1 2
Please login to post comments