Access denied or Error in access callback with multilingual quiz

Created on 8 October 2019, about 5 years ago
Updated 10 September 2024, 3 months ago

I tested the Quiz module (7.x-5.x) against 2 multilingual sites and discovered problems in both cases. To translate Quiz nodes I use the Content Translation module. In the content type, I have 'Enabled, with translation' mode set up in 'Publishing options -> Multilingual support '.

Two types of issues I am getting depend on how the site's language determination is configured :
- by prefix - I am getting 'Access Denied' while accessing node/%quiz_menu/take or node/%quiz_menu/take/%question_number/feedback pages (quiz_access_question and quiz_question_feedback_access)
- by domain - I am getting an 'unexpected error' message on node/%quiz_menu/take/%question_number/feedback

The thing is that Quiz stores its data (result_id and current question index) in the session under quiz[%quiz_nid] key. Translation nodes have different nid (in my set-up with Content Translation module), so when in the access callback Drupal looks for a certain key in the session array - it does not find it.

My patch ensures that all the keys (quiz translation node ids along with the source node id) are stored in the session. The approach could not be ideal, perhaps it would be better to change access callbacks logic instead, but it solves the problem with how the access callbacks work now.

🐛 Bug report
Status

Postponed: needs info

Version

5.0

Component

Code - Quiz core

Created by

🇨🇦Canada klimp Montréal, QC

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024