HD Quiz

Hi Dylan, is there a way to avoid that the “quiz_pass_tex…

Published: July 20, 2022
Support status: closed

Hi Dylan,
is there a way to avoid that the “quiz_pass_text” is visible (in html code) also if the user not answer the question?
I need to pass to the user information only if the quiz was passed.
Many thanks

This thread has been imported from harmonicdesign.ca/hd-quiz/

thread author: Beniamino

Hi Beniamino,
sorry for the late response; I somehow missed your message!

The best way I can think of is to do the following.

First, set all of your “pass text” to blank. This way nothing is printed on the page.

Then use the hdq_submit hook to run a custom JavaScript function on quiz completion. HD Quiz passes basic information to this function such as the score and quiz id. You can use this in the JS function to determine if the user passed or failed.

If the user failed, great – do nothing. HD Quiz will show the “fail text” as normal. If the user passed, then HD Quiz will show to “pass text” – which you set the blank. So if your JS function determines the user passed, you can then do an ajax call to your backend to grab whatever you want your real pass text to be.

Basically what the above does is removes the pass text by default, then if the user passes the quiz we contact the backend of your site to grab that content from the server.

Hope this makes sense!

22 July 2022 — 10:42 support admin - Dylan

If you are enjoying HD Quiz please leave a review here on the official WordPress.org page. HD Quiz is developed by me, just some dude, and is supported and available for free. It may seem dumb, but truly nothing makes me happier than knowing that people are using and loving HD Quiz and my hard work.

This thread has either been marked as complete or has been automatically closed due to inactivity.