Hi Dylan, Thanks for the great plugin. When My user finis…
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/
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.
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
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).
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
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);
} </script>
<?php }
add_action('hdq_before', 'hdq_redirect_js');In the above code, you will see two variables.
redirectURL
andredirectDelay
. 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 updatelet redirectDelay = 0;
tolet redirectDelay = 3000;
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
Hi Dylan,
Bundle of thanks. It works fine.
Regards
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.