“weighted answers” for HD Quizz

comment

Hello

I’ve read, in one of your previous answer last year, you planned to add the “weighted answers” in the future.
Do you still plan to add this functionality and if it is the case, do you have a rough idea when it will be added?
I’ve also noticed you wrote about the numerous hooks and filters included in your code: is it possible for me to use them to add this functionality?
Thanks in advance

Olivier

June 7, 2025 at 7:39pmOlivier

Hi Oliver,
this is something still being worked on. No release time, but I’m hoping before the end of the summer. Lots of work and testing still to be done.

You can of course, modify HD Quiz in any way you like, so feel free to add this functionality in yourself, but to be honest, I don’t think I’d recommend it as however you choose to implement weighted answers, it will almost certainly not be compatible with how I do it in the official release.

To get weighted questions working, the following needs to happen.

  1. Editing questions
    Each question type needs to be edited to allow users to set the weight for each answer. Questions can be found under ./hd-quiz/classes/questions/*.

  2. Displaying questions.
    Now, when actually displaying the quiz, you need to edit each question type so that it provides the value for the weighted answer. ./hd-quiz/includes/questions/*.

  3. Marking the quiz.
    On quiz completion, we need to edit the validation functions to account for the value of each answer. Also need to write a function to calculate what the “maximum” score is if you want to keep the x / y format for scores ⇾ which would be recommended as it is used in other addons such as the Save Results addons. ./hd-quiz/assets/frontend/*.

My eventual solution

When this feature finally drops, it will also come with the ability for other developers to add their own custom question types! So my system will work as a templated framework so that ALL question types will actually be “weighted” questions and answers. I will simply default the weight of each answer to 1 unless a user selects a different value.

This is to stop the final script from needing to do a billion different calculations depending on which answers are weighted, etc, and to ensure that every quiz, no matter the questions, answers, or settings, all use the same code and scoring systems.

This also means that for the majority of HD Quiz users who do not care about weighted answers, the UI remains very simple and clean. I’ll be adding a toggle to each question when editing, that when enabled, will show the inputs for the weights.

Hope this all makes sense!

09 June 2025 — 15:25support admin Dylan

Hello
Thanks for your quick answer. I’ll check the files once I’ve access to the filesystem (not my site, I’ve only used WP interface so far).
Will the modified files be overwritten after upgrading to your planned version (I would prefer, to avoid inconsistency)?
And I forgot previously: many thanks for your fantastic free plugin.
Olivier

This thread has either been marked as complete or has been automatically closed due to inactivity. Please consider opening a new support thread for help.