I'm receiving the following error while taking a test, because I disabled a question type module and still have questions of that type associated with the quiz.

Fatal error: Call to a member function getNodeProperties() on a non-object in /sites/all/modules/quiz/question_types/quiz_question/quiz_question.module on line 562

I know I could remove the questions from the test before disabling it, but that could be time consuming if there are many quizzes and questions.

Can we update quiz_build_question_list() to only include question types that are enabled?
I've attached a patch that seems to be working for me....

Thanks!!

CommentFileSizeAuthor
quiz_only_enabled_question_types.patch1.47 KBjroth

Comments

falcon’s picture

Status: Active » Closed (works as designed)

The patch makes a lot of sense, but I don't think we want to take a performance hit for this. If you disable a module that is needed to make your site work your site stops working...

Also this patch might mess up result statistics. If a question is removed from the quiz the max score of the quiz will change. This is not accounted for here.

jroth’s picture

Hi falcon, thanks for looking into this and so quickly! I am also getting this error after the module is uninstalled. I know, I know, the same logic could apply here as well...if you disable a module that is needed to make your site work your site stops working. However, it would nice if uninstalling the module removed all the functionality and content it created. Maybe this would be better categorized as a "feature request"? If you are interested, I would be happy to help.

falcon’s picture

I agree with you on that, but for some reason the "best practice" seems to be not to remove nodes belonging to the module even if the module is uninstalled. Deleting nodes that way is considered "bad form" or something I've been told. I have actually wanted to delete the nodes on uninstall myself. It doesn't require much code to do so, but I guess if nodes where supposed to be deleted when a module is uninstalled drupal would have deleted them. Doesn't make much sense to me however considering that the nodes are completely useless after the modules tables have been dropped...

jroth’s picture

Yes, I think it would make sense to retain content when a module is disabled and delete it when uninstalled.
Looks like this might be fixed in D8. http://drupal.org/node/874000