HD Quiz

Different emails for different quiz

Published: April 2, 2025
Support status: closed

Hi, im having this issue right now. My webpage have 3 quizzes for people to take and everytime someone passes, it’ll send them a certificate. But the issue right now is because the email is set generic for ALL quizzes. It means that people that take chapter 2 will receive certificate for the chapter 1 quiz. People that took chapter 3 will take certificate for chapter 1 quiz as well. how do I do is so people that took chapter 1 will receive chapter 1 cert and so on?

thread author: Marcus

Hi Marcus,
I can’t really advise unless I know how your certificates are being generated and accessed.

Is each certificate just a page on your site? Or is the email itself being used as the certificate? If your certificate is a page, does it accept URL parameters? Because if they are, we can do some pretty cool stuff here 🙂

02 April 2025 — 12:18 support admin - Dylan

the certs are a google drive link

03 April 2025 — 04:24 thread author - Marcus

basically i need a customisable email for every quiz so that i can send different content based on different quiz. right now i can only send 1 email for all the quiz

03 April 2025 — 04:38 thread author - Marcus

There isn’t a GUI for settings for something like this, but it is still possible. All that is required are two things.

FIRST: I just made a super minor update to the addon. It has the same version number, so please log into your account to download this latest version. The only thing this minor update did was make it easier to pass the quizId to the email function.

SECOND, you’ll need to add the following function to your theme’s functions.php file. ALWAYS backup the file first, as if you make a mistake copy/pasting, it will crash your site.

https://pastes.io/hdq-srp-dynamic-email-based-on-quiz

This small function extends the emails to add custom dynamic content. In our case, it adds a different link depending on which quiz was completed. If you are familiar with HTML, you can of course extend this code to add whatever custom content based on the quiz you want.

The only change you need to make to the code is to set the $quizId and $url variables based on what you want.

For example, if the quizId of your first quiz is 10, and the url to the certificate is google.com, then you can update

if ($quizId === 0) {
    $url = "#";
}

to

if ($quizId === 10) {
    $url = "https://google.com";
}

You can find the quizId by looking at the quiz shortcode.

If you are not comfortable adding the above code to your site let me know and I can package this up for you as an addon. But I’d need to know the quizIds and urls you want first.

03 April 2025 — 13:08 support admin - Dylan

Respond to thread

This thread has been closed / marked as resolved.
You can reply to this thread, but it might be better to start a new thread if you need help
.

You can also upload images to imgur and paste the links here. Just make sure that your images don't include any sensitive information.

Submit