CSV, Question Type and Multiple questions.

closed

Good morning,

My name is Luca and I think this plugin is fantastic!

But I have a problem.
I’ve seen a lot of people asking about it, but I can’t seem to apply the suggested solutions.
In short: I have 1,000 questions for a quiz and I’d like the answers to be “text-based”. I created the CSV file and it loads perfectly, except that all the answers are “Multiple choice – text.”

Is there a way to automatically make them all text-based?

I saw that you suggested a solution by modifying the plugin code, but I think the plugin has changed since then and I can’t find the files you’re referring to.

Thank you for your kind attention.

Hi from Italy!

Luca

July 20, 2025 at 8:29pmLuca

Hi Luca,
Ciao from Canada!

The CSV Import tool can be found under ./hd-quiz/classes/csv-import-tool.php.

You’ll need to take a look at and modify this file for your uses.

There is also the JavaScript file that helps with parsing and iteration located under ./hd-quiz/assets/csv-importer.js that you might want to look at if you encounter issues.

Basic idea:

  1. Edit the formatQuestion method and change question_type=>value from multiple_choice_text to text_based_answer
  2. You may need to also change the formatQuestion method, since this is where answers are parsed. Text-based answers are different from multiple choice since there is no “selected” answer. If you need to, you can comment out the second for loop.
20 July 2025 — 16:55support admin Dylan

Hi Dylan!

Thanks for your reply, and yes, it works!
You answered my question almost immediately, but it was almost bedtime for me, and I wasn’t sure whether to test it or not.
I went to sleep.

If something hadn’t worked, I would have kept testing all night, hahahahaha.

Now, after importing, all the questions are set to “text_based_answer.” I’m very happy with it.

I wanted to ask you one more thing: is it possible to do the same thing with the “paginate” function (paginate => yes), so that only one question is displayed at a time?

Thanks again for this plugin and for your kind help!

Best regards from Italy!
(I hope it’s cooler in Canada than here!)

Ciao!

Luca

Hello, I have the same problem,.

I’d like to set all the questions to “pagination” –> “yes” in all the questions.

And also, we’d need to understand what kind of link you shared: is it a file address in the WP-content / root folder?

Thanks a lot!

@Luca

You should be able to add paginate to the $data array in the formatQuestion method.

"paginate" => array(
    "type" => "radio",
    "value" => "yes"
)

@Davide
This thread is specifically for modifying the CSV Import tool.

22 July 2025 — 15:24support admin Dylan

Thank you Dylan,

I just tried, but it doesn’t work.

The questions and the form to enter the answer appear, but I can’t enter the answer, then timer goes on and change question, till the end of quiz.

Sorry if i ask, but are you sure about “radio”?

Anyway I will try tomorrow again.

Have a good day!

Bye!

Luca

Yes, it should be a radio type.

If you edit a question, is Paginate enabled? Also, would you be able to provide a link to the quiz?

The questions and the form to enter the answer appear, but I can’t enter the answer, then timer goes on and change question, till the end of quiz.

This is super interesting and I wonder what could be causing it? Do you get the same behaviour if you remove the timer (or make the timer for whole quiz instead of for each question?).

23 July 2025 — 11:07support admin Dylan

Ciao Dylan,

Thanks for the replies.

No, I don’t have a link to send you because I’m doing everything locally, at the moment.

Interesting. I’m out now, but later I’ll try doing what you said, disabling the timer.

I’ll write to you later.

Thanks again.

See you later!

No, I tried, but it doesn’t work.

I will try again during the weekend.
Maybe I am just tired and I mistake something.

Than You Dylan!

Bye!

I just tested it myself, and it DOES work as intended (well, the enable Paginate on all questions with the importer part).

The $data array should look like

$data = array(
    "question_title" => array(
        "type" => "text",
        "value" => sanitize_text_field($question[1])
    ),
    "question_type" => array(
        "type" => "select",
        "value" => "text_based_answer",
    ),
    "quiz_id" => array(
        "type" => "integer",
        "value" => $this->quiz_id,
    ),
    "question_answers" => array(
        "type" => "hdq_field_answers",
        "value" => $answers,
    ),
    "extra_content" => array(
        "type" => "editor",
        "value" => $extra
    ),
    "paginate" => array(
        "type" => "radio",
        "value" => "yes"
    )
);

Editing after importing a quiz, each question has Paginate enabled and working.

I believe what you have found is a bug with the Timer-per question feature, specifically for when the last question for the section is a text-based question. I’ll need to look into this – it’s not something you can fix yourself.

Until I release a bug fix for HD Quiz, you will need to either not use a quiz timer, or at the very least, not use the timer-per-question feature.

23 July 2025 — 20:37support admin Dylan

…Hello Dylan, I tried and i have to say…

It works!!

Thank you very much, Dylan!

I don’t care about timer, anyway, if you will correct the bug, I will give it a try.

Good job, Dylan!

Have a good day!

Ciao!

Luca

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.