1

I'm using the Quiz and the User Points module.

After a user takes a quiz, the points are granted. But if the quiz is taken multiple times, the points are granted multiple times also. For example;

  • points balance: 0
  • after quiz (1st time), point balance: 10
  • take the same quiz again, point balance becomes: 10+10=20

I don't want it to be cumulative. How can I prevent this?

0

You might use the Rules module to take away the role which has the permission to take the quiz once the quiz has been completed.

0

Using the Rules module, as suggested in the prior answer, is indeed a way to answer this question. Especially now that there is the 7.x-5.x release of the Quiz module, which enables all sorts of Rules logic to be implemented for quizes. However, if you have many quizes, you'd also end up with many roles if you'd use the approach suggested in the prior answer.

Therefor, I suggest you rather use a combination of the Rules module with the Flag module. Here is a summary of how to do so:

  • Use the Flag module to create a flag for tracking Passed Quizes.
  • Use the Rules module to implement this logic: if the quiz node (to which this quiz result relates) is not yet flagged (by the flag that was created for it), and the quiz result is that it is at least equal to the pass rate of that quiz, then it is the very first time this user passed the quiz. At which time the quiz node gets flagged. From then on use a Rules Condition to check if the quiz node was flagged or not by the current user. And based on that Rules Condition, you decide to yes or no perform some Rules Action(s), e.g to grant points (but only 1 time).

For more details, refer to my answer to "How to check if user has passed the quiz already before granting user points?", which also includes an export of the configuration of the flag and the rule to get this to work.

PS: I'm assuming this question is about D7.

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.