Save Results Pro – Different Email Content for Different Quizzes
Hi there, we are looking to have different email content for different quizzes. We have two of the same quiz, one for organic website/social and one for a paid social campaign. Both quizzes have Save Results Pro emails enabled. Is it possible to have different email content?
Facebook: https://johnsonbrunetti.com/request-a-visit-quiz-fb/
Organic: https://johnsonbrunetti.com/request-a-visit-quiz/
Thank you,
Mikaela
Hi Mikaela,
although this is not a “built-in” feature, I built the addon to be very extendable – so this should totally be possible.
I’ll write up a solution for you tomorrow, but in the meantime, it would be useful if you could explain why you need the email content to differ for these. The more specific you can be, the better my solution for you will be.
We would like to include different links and copy in the email to be more based on the quiz that they completed.
Thanks for the update.
I’ve made a minor update to the addon itself (can be downloaded from your account page) to make this a bit easier.
I’m going to provide the code and explanation here, but please let me know if you’d prefer I package this up as a plugin to make it easier for you to install. I just want to give the overview and explainer here first for full transparency.
The addon has several filters that allow us to modify the content of results as needed. These filters are:
hdq_srp_results_heading
hdq_srp_results_user
hdq_srp_results_form
hdq_srp_results_results
hdq_srp_results_questions
hdq_srp_before_expanded_results
The problem with the above filters is that they are for adding generic content as they are unaware of which quiz is being sent. Because of this, I added in two new filters specifically to modify the email into content / footer content.
hdq_srp_email_intro_content
hdq_srp_email_footer_content
Choose whichever one works for you.
Now all you need is to know the IDs of the quizzes you need to modify the email content for. The ID can be found by looking at the quiz shortcode.
function hdq_srp_custom_email_intro_content($content, $quiz_id)
{
if ($quiz_id === 1) {
$content .= '<p>Hello world!</p>';
}
if ($quiz_id === 2) {
$content .= '<p><a href = "#">Click here</a> to visit something.</p>';
}
return $content;
}
add_filter("hdq_srp_email_intro_content", "hdq_srp_custom_email_intro_content", 10, 2);In the above example, we are assuming 3 things.
We are modifying the Intro content of the email
The quiz IDs are 1 and 2
We are appending the custom HTML to whatever your existing content is.
To add this code to your own site, you can edit your theme’s functions.php file and add it to the line below the opening <?php tag. Just make sure you backup the file first as a mistake could crash your site!
Alternatively, if you can provide me with A) the quiz IDs, and B) what the custom content you want to add is, I can package this up as a plugin for you, so that you can more easily add it to your site.