0

I used quiz module version 7.x-4.0-rc2 and drupal7 to create content in my site. I created student role to access quiz content.

I want each student can start only one quiz per day. Example: Today is 22/04/12, a student can start only one quiz. If they open and start quiz1, they can't start any other quiz until to 23/04/2012.

Please help me, How to do that. Thank you so much, Bien Hoang

  • Hi, welcome to Drupal Answers! Please add some more information to your question, like: exactly which quiz module you are using, which Drupal version you're on, and what you tried so far. That will make it easier for us to help you. – marcvangend Apr 25 '16 at 9:23
1

I have never used the Quiz module myself so I can only give you a generic answer.

What I would do, is to create a custom module which contains a hook implementation and a helper function:

  • In the helper function, check if the current has the permission to create quiz content and if the user has already posted a quiz today. You may need to write a database query to retrieve this information, but I'm not sure, that depends on the way the quiz module was programmed. Return TRUE if the user is allowed to post a quiz, return FALSE if not.
  • In a hook_menu_alter implementation, change the access callback property of the quiz creation form, setting it to the helper function you just wrote. This will deny access to the quiz creation page if the use is not allowed to create a new quiz.

Hope that helps.

| improve this answer | |
0

Thank Marcvangend, I finished this task. I write some coding on quiz dependence module. Now, in my site user can start only one quiz per day and they need pass the quiz one before start the quiz 2.

Thank, Bien

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.