Can booking notification emails go to various addresses depending on event

WordPress Event Management, Calendars & Registration Forums Pre Sales Questions Can booking notification emails go to various addresses depending on event

This topic contains 8 replies, has 3 voices, and was last updated by  Christian Willis 4 years ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #36550 Reply

    we manage a training calendar that advertises courses by different trainers in various locations. is it possible to have booking “notification” emails sent to trainers email addresses when users book their courses from our calendar. So, Trainer A gets an email to inform them when people are booking their course(s) ?
    Or do all bookings get email notifications to the same address (by default WP admin) ?

    Ian Clarke
    #36551 Reply
    Ian Clarke
    #36581 Reply

    Hi Ian,

    Yes, it is with a bit of custom code:

    function my_booking_notification_email( $emails, $booking_id ){
          $event_id = eo_get_booking_meta( $booking_id, 'event_id');
          $notification_email = get_post_meta($event_id, 'notification_email');
          if ($email) {
              $emails[] = $notification_email;
          }
          return $emails;        
    }
    add_filter( 'eventorganiser_booking_notification_email', 'my_booking_notification_email', 10, 2 );
    

    This code looks for a custom field on the event named notification_email and adds it the list of emails to be notified (by default it would be just the site admin).

    You could replace $emails[] = $notification_email; with $emails = [$notification_email] to just notify that email (and not the site admin).

    And you could also replace

    $notification_email = get_post_meta($event_id, 'notification_email');
    

    with some other way of getting an email (e.g. getting it from the email attached to the event organiser).

    Stephen Harris
    #37313 Reply

    Hi, I have followed the instructions and created this as a plugin as per your “Where should I put code from the tutorials?” but an email never gets sent to the notification_email address. Any ideas if I need to do anything else?

    Christian Willis
    #37389 Reply

    Hi Christian,

    I’d recommend putting in some error logging first to ensure your code is being executed. Or failing that, calling exit to halt the script which should end up in a white page (so don’t use that in production).

    Assuming it isn’t executed, make sure the plug-in (I’m assuming a simple php file here) you’ve created is in the root of wp-content/mu-plugins – i.e. so not a subfolder of mu-plugins.

    Stephen Harris
    #37390 Reply

    Hi Christian,

    I’d recommend putting in some error logging first to ensure your code is being executed. Or failing that, calling exit to halt the script which should end up in a white page (so don’t use that in production).

    Assuming it isn’t executed, make sure the plug-in (I’m assuming a simple php file here) you’ve created is in the root of wp-content/mu-plugins – i.e. so not a subfolder of mu-plugins.

    Stephen Harris
    #37403 Reply

    Thanks Stephen, I created the mu-plugins folder and moved the php file but still doesnt work. To be honest I am not skilled in this. Would you be willing to assist for a donation?

    Christian Willis
    #37431 Reply

    Hi Christian, I’ll be in touch via email to see if I can help.

    Stephen Harris
    #37562 Reply

    Hi Stephen, were you able to take a look at this?

    Christian Willis
Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Can booking notification emails go to various addresses depending on event
Your information:




To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax


<a href="" title="" rel=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width=""> <p style=""> <span style="">