Support

Home Forums Event Espresso Premium Registration confirmation using check/money order

Registration confirmation using check/money order

Posted: March 20, 2015 at 12:35 pm

Viewing 2 reply threads


winnipegconstructionassociation

March 20, 2015 at 12:35 pm

Currently we are using EE3 and offer two payment options when users register for an event. Our issue surrounds the confirmation e-mails that get sent-out after registrants have chosen the check/money order option. These e-mails were not being sent until an admin manually set the transaction as completed. What we require is to have these e-mails sent out immediately after registration to notify the admins and the registrant that they are registered. (we can’t set e-mails to send before payment because we are also using paypal) We searched the forums and found the exact issue in a thread:

https://eventespresso.com/topic/question-on-registration-confirmationnotification-email/

We followed the instructions given by the EE support person in the thread and were able to solve the problem. But we are now experiencing the same problem that was raised in the thread—emails are being sent-out in duplicate. If we could get some help on this, it would be greatly appreciated.

thank-you


Josh

  • Support Staff

March 20, 2015 at 3:15 pm

Hi Jory,

I think the issues you’re seeing with using the code from the other thread may be related to all of the hooks that are run though the [ESPRESSO_PAYMENTS] shortcode. If a hook gets run twice, it will trigger the email sending twice. Instead of hooking into the function that returns content for the [ESPRESSO_PAYMENTS] shortcode, I can advise making a new shortcode and placing it on the same (Thank You) page. Then you can trigger the emails from a hook within your custom shortcode.

So here’s how you can do that:
Step 1) You remove the code you added to check_ipn.php
Step 2) You add this to the bottom of the gateways/check/init.php file:

if (!empty($_REQUEST['payment_type']) && $_REQUEST['payment_type'] == 'cash_check') {
	add_action('action_hook_espresso_send_check_message_thank_you', 'espresso_send_email_on_check_finalize', 10);
}

function espresso_send_email_on_check_finalize($attendee_id) {
	event_espresso_email_confirmations(array('attendee_id' => $attendee_id, 'send_admin_email' => 'true', 'send_attendee_email' => 'true'));
}

Step 3: You add the following code to a custom snippets plugin or your theme’s functions.php file:

function my_espresso_check_message_shortcode() {
	if ( isset( $_REQUEST['id'] ) && !empty($_REQUEST['payment_type']) && $_REQUEST['payment_type'] == 'cash_check') {
		$attendee_id = $_REQUEST['id'];
		do_action( 'action_hook_espresso_send_check_message_thank_you', $attendee_id );
		return "

An email notification has been sent

"; } else { return ''; } } add_shortcode('ESPRESSO_CHECK_MESSAGE', 'my_espresso_check_message_shortcode');

Note that you can customize the message that’s returned to the shortcode in the above snippet.

Step 4: You add this shortcode to your Thank You page and save the page:
[ESPRESSO_CHECK_MESSAGE]


winnipegconstructionassociation

March 20, 2015 at 3:45 pm

Thank-you Josh! You have solved our problem.

Viewing 2 reply threads

The support post ‘Registration confirmation using check/money order’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso