Support

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

Registration confirmation using check/money order (2)

Posted: March 23, 2015 at 11:11 am


winnipegconstructionassociation

March 23, 2015 at 11:11 am

Hello Josh.

You helped us fix a problem we were having last week:
https://eventespresso.com/topic/registration-confirmation-using-checkmoney-order/

We are now having another problem with the e-mails not being sent. It appears that not all of the multiple attendees are receiving e-mail, along with the contact person on the registration (who is not always an attendee). Is there something else we need to add to the code to get these working?

thanks


Lorenzo Orlando Caum

  • Support Staff

March 23, 2015 at 1:02 pm

Hi Meryl,

Does this issue appear to be sporadic or can you duplicate the issue by following a certain set of steps?

If it is sporadic, then it may be an issue with some emails being marked as SPAM or junk email.

Could you share additional feedback?


Lorenzo


winnipegconstructionassociation

March 23, 2015 at 2:13 pm

Hello Lorenzo.

If you have a look at the original support item (link above), we are forcing the e-mails to be sent at registration (cheque/money order option). The issue lies in only the first attendee receiving an e-mail, but the contact person and additional attendees not receiving it. I think it’s in how the code is being executed…


winnipegconstructionassociation

March 23, 2015 at 2:45 pm

We have verified that e-mails are not going into junk or spam. It appears that registrants after #1 do not get the confirmation e-mail and the contact person registering also does not get an e-mail. IS there something we can add in the php code to force these e-mails too?


Dean

March 24, 2015 at 7:55 am

Hi,

The issue lies in that the code relies on confirming that a cheque has been selected. At that time, only the Primary attendee data is available, so the code only uses that to send out the email.

In order to send an email out to the rest, you would have to do a database query based on the registration ID (which unless you are using Multiple Event Registration should be the same for each attendee in the group), then fire the event_espresso_email_confirmations function for each attendee.

This *should* work as a replacement to the Shortcode function Josh gave you, and send emails to every attendee, but it will be slower as it needs to pull data from the database:

function my_espresso_check_message_shortcode() {

  if ( isset( $_REQUEST['id'] ) && !empty($_REQUEST['payment_type']) && $_REQUEST['payment_type'] == 'cash_check') {

    $attendee_id = $_REQUEST['id'];

    $r_id = $_REQUEST['r_id'];

    global $wpdb;
    $SQL = "SELECT * FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id =%s ";
    $x = $wpdb->get_results($wpdb->prepare( $SQL, $r_id ));

    foreach ($x as $att) {      
      do_action( 'action_hook_espresso_send_check_message_thank_you', $att->id );
    }

    return "<h3>An email notification has been sent</h3>";

  } 
  else {
    return '';
  }

}
add_shortcode('ESPRESSO_CHECK_MESSAGE', 'my_espresso_check_message_shortcode');


winnipegconstructionassociation

March 24, 2015 at 8:51 am

Thanks Dean. We will give this a try and let you know how it goes. Our other issue is that we have a field in our registration that is a contact person and not necessarily an attendee. How would we get an e-mail going to this person?


Josh

  • Support Staff

March 24, 2015 at 10:00 am

You’d need to add on a separate function that pulls the contact email address from the db, and sends it to the contact person.


winnipegconstructionassociation

March 24, 2015 at 10:03 am

Is this something that support can help us with?


winnipegconstructionassociation

March 24, 2015 at 1:22 pm

Confirming that the code Dean supplied works great. Our last issue is having the contact person at registration also receive the attendee confirmations, otherwise they have no feedback as to whether the registrations have occurred or not.Could the contact person be cc’d on every attendee confirmation that goes out?


Josh

  • Support Staff

March 25, 2015 at 5:18 pm

Hi Meryl,

CC’ing or sending an attendee confirmation to a non attendee isn’t a feature that’s included with EE3, but it’s possible to add with some custom PHP programming. You could start with making a copy of the espresso_prepare_email() function from email.php (you copy from the core ee3 plugin, rename it to something like espresso_prepare_extra_email(), and paste into your custom function file.

At the very bottom of the function, there’s an array:

return array(
		'send_to' => $data->attendee->email,
		'email_subject' => $email_subject,
		'email_body' => $email_body,
		'headers' => $headers
);

There, you change the value for ‘send_to’ to use the email address for the contact person. Since the answer for the contact email field is in another table, you can use the ANSWERS shortcode to grab the email address. You’ll need to find the question ID for the contact person email field, and you can get this by looking at the ID column in the Questions editor. Once you have that, you can plug that in to your custom code. So for example, if the ID is 20, it will be:

'send_to' => do_shortcode( '[EE_ANSWER q="20" a="'.$data->attendee->id.'" ]' ),

Then you’ll need a separate function for sending the email:

function espresso_extra_email_by_attendee_id( $attendee_id, $multi_reg = FALSE, $custom_data='' ) {
    
	$data = espresso_prepare_email_data($attendee_id, $multi_reg, $custom_data); 
	$email_params = espresso_prepare_email($data);  
	event_espresso_send_email($email_params);

}

Then you can add the above function as a callback to the action:

add_action('action_hook_espresso_send_check_message_thank_you', 'espresso_extra_email_by_attendee_id', 10);


winnipegconstructionassociation

March 26, 2015 at 1:02 pm

Hi Josh,

The solution you provided did send a copy of the attendee registration emails to the ‘contact person email’ as desired.

The last issue is the matter of two identical copies of the registration being sent to each attendee, as mentioned in the original referenced thread seen here: https://eventespresso.com/topic/question-on-registration-confirmationnotification-email/#post-41682

If the issue was ever resolved for user, ‘Yolande Grill’, it was never posted publicly in that thread. Was this issue resolved, and could you share the solution?


Josh

  • Support Staff

March 26, 2015 at 1:32 pm

No we never received credentials from Yolande Grill.

Since you’re issues are dealing with custom code, have you considered hiring a PHP developer to help you with them? Support staff will try to help out with customizations, but we’re limited to what we can do in short periods of time.

The support post ‘Registration confirmation using check/money order (2)’ 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