Posted: August 1, 2020 at 1:08 pm
I have the need to stop some individual datetime reminder emails for a class from sending while allowing others through.
I have used customized shortcodes to create a wide range of new functionality in our reminder emails (and other emails) so kudos to you guys for creating such a flexible system. I am constantly amazed by what is possible!
For instance, here is one code snippet where we look up a meta value on an event and then insert a shortcode if it exists.
So, I know there are datetime-specific and event-specific shortcodes… but can I make a registration-specific shortcode that can be applied to a shortcode like [RECIPIENT_EMAIL] that is normally in the TO field?
What I’d like to do is simply stop an email from sending based on a user’s registration question answers. For instance, if they choose “do not send me reminder emails” on our question form in checkout I want to stop the email from sending to them. I had an idea that I could customize the [RECIPIENT_EMAIL] to be something like [CUSTOM_RECIPIENT_EMAIL_BASED_ON_QUESTION] and then simply route the email to a “dead-letter” email address thereby stopping delivery of the email.
Is this possible to use a custom EVENT context shortcode in the TO field?
Sure you can.
Take a look in
You may also want to look into the
Side note, you’re now getting into the a library that is usually passed an
Just return an empty string
Possible, yes, but event-specific shortcodes won’t help you here unless I’m misunderstanding.
Event shortcodes would be things like
Great! I was missing the insight that each “section” of the email has its own class that is passed parser data. The EE_Recipient_Details_Shortcodes is the class I was looking for – thanks!
I added this to the shortcodes after parser filter (not sure if I need all of the “instanceof” ternary operations at the beginning, but I can confirm that this code works when added to a ‘FHEE__EE_Shortcodes__parser_after’ hook and added to the list of shortcodes in ‘FHEE__EE_Shortcodes__shortcodes’):
Any feedback on this code welcome!
Your current code can’t do anything without an
You can also check for an
What you have should work anyway so up to you, now it’s just a case of pulling a value for the registration question and doing whatever you need from there.
I am back to this thread again with an issue that I am having trouble approaching.
We composed the event this way to keep the ticket chooser as simple as possible. It works well.
Now, I am trying to customize the reminder emails to dead-letter only reminder emails when they don’t match up with the specific timeslots indicated in the checkout questions. Basically, dead-letter any emails that are trying to remind a customer about a datetime they didn’t sign up for.
It seems that I need to get access to the specific datetime object that triggered the email. Only then will I be able to extract the correct info to do the question data comparison.
I am able to access the recipient info and I can get generic datetime info through the registration, but I need to get access to the exact data in the datetime object that triggered the reminder email.
Am I going about this in the wrong way?
Have you checked how the AUEN add-on pulls the specific datetime object it is generating data for?
If not, take a look in:
I think the