I wanted to add the option for a timeout between attempts. It was very tricky to add this feature with hooks in a custom module. I added it directly to the quiz module and created a patch. You may consider bringing it into the next release?

You would need to add something to it, though, to add the 'timeout' column to the 'quiz_node_properties' table in the database. I just enabled the module, post patch, on a database that never had quiz installed before on it. I would also suggest adding a column for a 'next_attempt' timestamp, or something similar, to make the function _quiz_get_next_allowed_attempt() in quiz.module more performant.

Please let me know if you have any questions.

Peace

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

genellann created an issue. See original summary.

djdevin’s picture

Take a look at quiz.api.php

In that file there is an example of implementing your own access handler using hook_quiz_access() - you can use this to add your own functionality to restrict quiz taking based on whatever criteria you need.

If you wanted to add this as feature it needs some work - there's no tests and you have a lot of redundant code for handling the time limit. Take a look at how Quiz does it by using timeperiod. Also, you should use the access system that Quiz already has instead of trying to do it in a nonstandard way.

djdevin’s picture

genellann’s picture

Thank you so much. For the quick reply, wow. And for pointing me in a better direction.

djdevin’s picture

Version: 7.x-6.x-dev » 7.x-5.x-dev

You're welcome!

I'll leave this open as a feature request to see if there's any interest.

genellann’s picture

Can you tell me, please, how to add to the settings array in _quiz_get_node_defaults()?

djdevin’s picture

Here's an example, a module that adds a configuration: https://git.drupalcode.org/sandbox/devin-3008617/blob/master/quiz_answer...