Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Love this module! We are using it with much success in our regular training sessions!
We are currently printing out (or at least saving to HTML) results for each trainee. It would be great if you could show username of the user that took the quiz at the top of the page.
Would this be difficult to implement?
Thanks!!!
Comment | File | Size | Author |
---|---|---|---|
#3 | quiz.admin_.inc_.txt | 98.89 KB | ratinakage |
#1 | quiz.admin_.inc_.txt | 98.74 KB | ratinakage |
Comments
Comment #1
ratinakage CreditAttribution: ratinakage commentedHi all,
I went into the code to see if I could fix this myself.
Before is said:
Now it says:
I think its much more user-friendly this way. I am not 100% sure how to create a patch so I just attached the quiz.admin_inc.txt file for review.
I added this line in function quiz_admin_results(...) line 359
$score[result_username] = db_result(db_query('SELECT name FROM {quiz_node_results} INNER JOIN {users} ON {quiz_node_results.uid = users.uid} WHERE result_id = %d', $rid));
And much further down in theme_quiz_admin_summary(...) line 1911
I changed the code to:
I am quite new to PHP and Drupal module development so please let me know if I have done anything wrong. I have tested and it seems to work nicely for me. Would you add this to the release?
Thanks!!
Comment #2
ratinakage CreditAttribution: ratinakage commentedComment #3
ratinakage CreditAttribution: ratinakage commentedBump!
Hey guys, I'm not great with adding patches but this seems to work nicely for me at least.
I've patched the latest version of the quiz with my change and its still working. Its a pretty small fix.
Hopefully one of you can help me submit it to dev??
Thanks!
Comment #4
rennsix CreditAttribution: rennsix commentedAs of 6.x-4.4 you can add this little line to quiz/quiz.pages.inc after line 527
$output .= (check_plain($user->name));
Here is the whole function with new output to spit out the username.
Comment #5
ezraw CreditAttribution: ezraw commentedComment #6
MBroberg CreditAttribution: MBroberg commentedThe code in #1 and #3 worked for me in v. 6x-4.4. I can see username on the admin pages.
The code in #4 is for the logged in user and only works for that user to see his own results.
Comment #7
djdevinWas fixed #2386103: Decouple quiz result/scoring
!username got %num_correct of %question_count possible points.