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.
The My results tab shows when the user has no access, but it does tell them so after they click it. The attached patch removes it when they don't have access, which is cleaner.
I'm filing this as a bug report, because the way you're supposed to indicate permissions to view a menu item is through the 'access callback' and/or 'access arguments' values when adding it through hook_menu(). The way Quiz does it for that tab is way off. Anyone who can view their own results is allowed to see that tab, no matter what user the tab actually belongs to.
Comment | File | Size | Author |
---|---|---|---|
#3 | quiz-537046-3.patch | 3.04 KB | falcon |
quiz-myresults_tab_access.patch | 971 bytes | darktygur-1 | |
Comments
Comment #1
Netbuddy CreditAttribution: Netbuddy commentedAnyone tested this patch? Think i might have to give it a whirl, but im using Quiz 6.4 dev. This tab is still a problem.
Comment #2
falcon CreditAttribution: falcon commentedThanks for the report!
I'll create a pointer to this issue in the 4.x-dev issue list as well. I only work on Quiz 4.
Comment #3
falcon CreditAttribution: falcon commentedThanks!
I have had a look at this patch, and it will be commited to 4.x-dev.
I also cleaned up the quiz_get_user_results function.
Patch for both is attached.
Comment #4
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedI tried this several times but i am not able to reproduce the same behavior here. I can't view the
My results
tab, unlessview own results
permission is granted.Comment #5
falcon CreditAttribution: falcon commentedI think I was able to reproduce it when viewing other users profiles.
1. Log in as a user with "view own results" permission and not "view user results".
2. View someone elses profile(you should se the "My results" tab)
3. Click the "My Results" tab(You should get a custom access denied message)
Comment #6
darktygur-1 CreditAttribution: darktygur-1 commentedI just looked at the currently available versions of Quiz. Version 4.0-beta2 is fixed. Versions 3.4 and 3.x-dev both don't have it. Since I originally reported this against 3.x, I'm surprised that 4.x is the only version with the fix.
Sivaji, could you have been testing with a 4.x version?
Comment #7
falcon CreditAttribution: falcon commentedAdding tags. This issue will be closed when quiz 4 RC is released.
Comment #8
falcon CreditAttribution: falcon commented