HD Quiz

Need to send invoices?
Check out my new WordPress plugin HDInvoice
Limited time launch sale

Hi Dylan, Thanks for the great plugin. When My user finis…

Published: February 19, 2020
Support status: closed

Hi Dylan,
Thanks for the great plugin. When My user finishes the quiz, how can I redirect him/her to another page instead of results?
Thanks

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

thread author: Julia

Hi Julia,
there are two ways.

The first is to just add a link to the quiz pass or quiz fail results. The second would require custom code. I can help provide this code for you, but I’d need to know your use case – why you need to do this.

19 February 2020 — 23:20 support admin - Dylan

Hi Dylan,
Thanks for your reply. Actually I am trying to build a survey and I want my users redirected to a thank you page
https://bengalcatfans.com/2020/02/20/146/
I want to collect leads by putting autoresponder code
Please help.
Regards

20 February 2020 — 01:29 Julia

Hi Julia,
although certainly possible to use HD Quiz this way, it would require a lot of extra work since HD Quiz does not store a user’s answers upon quiz completion.

I think that you’d be better served by using a plugin such as HDForms, which is a contact form builder. With this, you can ask any questions you need (including multiple choice) and the results will be emailed to you. This plugin is also compatible with custom functions that can run once a form has been submitted, meaning you’ll be able to redirect to a new page as well if you wish (if you like HDForms, let me know and I can send you the code needed for the redirection).

20 February 2020 — 10:38 support admin - Dylan

Hi Dylan,
I have created my own thank you page with autoresponder code.
https://aiopsplashbuilder.com/splash.php?id=32573
I just want my user redirected to this page on clicking finish button.
Please let me know the code to redirect and where to place the code.
Regards

21 February 2020 — 01:17 Julia

Hi Julia, the following code is what you need. Please add this code to your theme’s functions.php and let me know if you need help doing this.

function hdq_redirect_after_complete_action($quizOptions){
    array_push($quizOptions->hdq_submit, "hdq_redirect");
    return $quizOptions;
}
add_action('hdq_submit', 'hdq_redirect_after_complete_action');

function hdq_redirect_js(){ ?> <script> function hdq_redirect(){ let redirectURL = "https://aiopsplashbuilder.com/splash.php?id=32573"; let redirectDelay = 0; setTimeout(function(){ window.location = redirectURL; }, redirectDelay);

    }
&lt;/script&gt;

<?php }
add_action('hdq_before', 'hdq_redirect_js');

In the above code, you will see two variables. redirectURL and redirectDelay. The redirectURL is the page you are redirecting to, and the redirectDelay is how many miliseconds to way before doing the redirect (I’ve currently set it to 0). If, for example, you want to wait 3 seconds before the redirect, then you can update let redirectDelay = 0; to let redirectDelay = 3000;

22 February 2020 — 10:58 support admin - Dylan

Also quick note: do NOT use the code sent in the email – it’s likly to have some of the code stripped out for security, instead, come visit this reply to see the full/real code

22 February 2020 — 11:15 support admin - Dylan

Hi Dylan,

Bundle of thanks. It works fine.
Regards

23 February 2020 — 13:01 Julia

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.