I want to assign the user a role on successful completion of quiz so that a badge based on role can be assigned.
Here is what I have tried: 1. In Quiz module, Taking Options in Edit Quiz, added Assign Action of Node > save content 2. Created a VBO for Quiz which has context parameter of (Quiz) NID and User UID 3. Tried to call this VBO as a condition
Issues: 1. When assign this action, I get an error on Quiz that you need to start again and don't see the content actually getting saved right (shows the results incorrectly) 2. When I try to call the VBO from Rule, it gives me handler error
Questions: 1. Is the approach right or there is a better way to do it? 2. If the approach is fine, any obvious mistakes I am making.
Got this approach from drupal site after much searching - https://www.drupal.org/node/1149930
I recommend you to use a quiz hook to do that:
Read it: http://api.dlcdev.com/quiz/doc/html/group__quiz__public.html#ga6dce0ee8805024c0ba2058b8871f3d3b
Quiz has a hook named hook_quiz_finished, that is fired after the last question is submitted.
You have to implement your own module and use it like this:
Hope it helps.
Regards.