Support

Home Forums Event Espresso Premium Previewing messages with live merge data

Previewing messages with live merge data

Posted: February 8, 2024 at 9:47 am


edwardkay

February 8, 2024 at 9:47 am

Hi,

We’re using https://eventespresso.com/wiki/eea-automated-upcoming-event-notifications/ and it’s generally working well.

We want to create a custom template for a major event, including QR codes for registrants.

I’m happy creating the email and using the merge fields to create the content inc QR code – but I want to test it first.

The “send test message option” only works in the context of a test registrant (Luke Skywalker).

How can I test the template in the context of a real registrant ahead of time? Our event hosting company want to see examples of the emails in advance to test their check-in system.

(I know I could duplicate the event, and use the new template there. But as the email is automated, I’d have to wait a whole day between each test, which is not practical).

I’m happy to use code on a dev site to trigger the emails if that’s an easier option.

Thanks


Tony

  • Support Staff

February 13, 2024 at 7:28 pm

Hi there,

So, currently, the only ‘proper’ method to get test data from an event is to use an actual event to trigger the emails. You can force the message previews to use live event data (event name, datetimes etc) but not registrant data.

Which specific message are you using within the AUEN add-on? (I’ll check for the values it is checking in the DB which should then allow you to trigger the messages just by manipulating those values and triggering the cron task for the add-on on a test event)


edwardkay

February 14, 2024 at 1:47 am

Thanks Tony. We’re using the Automated Upcoming Event Notification (i.e. not Date Time).

In the meantime I found a workaround:

– Use a development copy of the site
– Turn off email sending (this site uses WP SMTP; FluentSMTP also has this option)
– Build the reminder message in the “registration approved” template. This can then be triggered on a per registrant basis by clicking the “resend registration” option on their registration, and will use their data for the merge tags.
– Review the message in the EE mail logs (and also our SMTP plugin mail logs).
– Iterate as needed.
– Once happy with the message and merge data, copy/paste the values (as HTML text) from all the fields on the “registration approved” template into the “upcoming event notification” template.
– Set the upcoming event notification schedule on the dev site so it fires the next day. Use this to check the emails are generated and sent correctly.
– Once happy, transfer the configuration to the live site.

It would still be useful to know how to trigger the AUEN emails manually via the DB/code. Thanks


Tony

  • Support Staff

February 14, 2024 at 5:35 am

Nice workaround 🙂

Here is an example of removing the extra meta row used to store if a notifications has been triggered:


// The AUEN Add-on uses 2 meta keys, one for registrants, the other for the admin notifications
// use whichever key is needed, below its set to the key used for registrants.
$meta_key = 'ee_auen_processed_';
//$meta_key = 'ee_auen_processed_for_admin';

// Set the ID of 'object' the notifications were trigger for here,
// your use case is event, so its the event ID.
$event_id = 21231;

// Similar to the above, your using the Event notifications, so the
// model type which triggered the notifications is 'Event'
$model_type = 'Event';

// Add the detail to the query params
$query_params = [
	[
		'EXM_key'  => $meta_key,
		'OBJ_ID'   => $event_id,
		'EXM_type' => $model_type,
	],
];
// Pas them to the model to delete.
EEM_Extra_Meta::instance()->delete($query_params);

For your use case, you can shorten all of that down to just:

$EVT_ID = 999999;
EEM_Extra_Meta::instance()->delete([
    [
        'EXM_key'  => 'ee_auen_processed_',
	'OBJ_ID'   => $EVT_ID,
	'EXM_type' => 'Event;,
    ],
]);

Having the EVT_ID separate obviously isn’t required but personally I think it helps when using the code multiple times, set the ID, run, set the ID to the new ID, run and so on.

With the above value remove from the database, you just run the cron again to trigger notifications. Use something like WP Crontrol and go to Tools -> Cron Events.

Find the ‘AHEE__EventEspresso_AutomatedEventNotifications_core_tasks_Scheduler__check’ taks and hit run now. The notification will trigger again and a new extra meta value saved, delete it using the same code you ran above and the next time you run the cron it will retrigger, repeat for as many tests as you want.


edwardkay

February 14, 2024 at 5:46 am

Very helpful to know; thank you!

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso