Booking confirmation

This topic contains 5 replies, has 2 voices, and was last updated by  Charlotte Kitto 11 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9732

    Hi There,

    I need the venue name and address to be shown in the booking confirmation email for the site administrator.
    I can add it easily to the booking receipt for the purchaser, but it is not straight forward for the site admin.

    Thanks

    Charlotte Kitto
    #9733
    Charlotte Kitto
    #9737

    It would be very useful if the list of bookings in the backend referenced the venue also.

    Charlotte Kitto
    #9741

    I tried adding this to the functions – the $venue doesn’t seem to do anything and not even the word “at” shows up on the booking email. I even tried messing with bookings-action.php itself, but it doesn’t seem to effect the email at all. Where am I going wrong. This is fairly urgent because there are events on the same date at two different venues.

    add_filter( ‘eventorganiser_notify_confirmed_booking’, ‘ck_handle_confirmation_emails’, 10, 2 );
    function ck_handle_confirmation_emails( $bool, $booking_id ){

    $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    $post_id = (int) eo_get_booking_meta( $booking_id, 'event_id' );
    $occurrence_id = (int) eo_get_booking_meta( $booking_id, 'occurrence_id' );
    $event = get_the_title( $post_id );
        $venue = eo_get_venue_name ($booking_id);
    $user_id = (int) eo_get_booking_meta( $booking_id, 'bookee' );
    
    
    $hr= '<hr style="color:#E6E8E6;background-color:#E6E8E6;height:1px;border:0">';
    
    $title =
        '<h2 style="display:block;font-family:Arial;font-size:30px;font-weight:bold;line-height:120%;margin-right:0;margin-bottom:15px;margin-left:0;text-align:left;color:#333 !important">'
        .__( 'New event booking', 'eventorganiserp' ).'</h2>';
    
    $preamble = sprintf(
        '

    '.__( 'A new booking has been made on your site %s:', 'eventorganiserp' ).'

    ' .'<h3 style="color:black;"> Booking #%d for %s %s at %s</h3>', $blogname, $booking_id, $event, $venue, empty( $occurrence_id ) ? '' : eo_get_the_start( '(jS F Y)', $post_id, null, $occurrence_id ) ); $booking_table = _eventorganiser_get_booking_table_for_email( $booking_id ); $bookee_details =sprintf( '<h3 style="color:black;"> %s </h3>

    %s: %s

    %s: %s

    ', __( 'Bookee', 'eventorganiserp' ), __( 'Username', 'eventorganiserp' ), eo_get_booking_meta( $booking_id, 'bookee_display_name' ), __( 'Email', 'eventorganiserp' ), eo_get_booking_meta( $booking_id, 'bookee_email' ) ); $postamble = sprintf( '

    '.__( 'You can view the booking here', 'eventorganiserp' ). '

    ', eventorganiser_edit_booking_url( $booking_id ) ); $message = $title.$preamble.$booking_table.$hr.$bookee_details.$hr.$postamble; eventorganiser_mail( eo_get_booking_notification_email( $booking_id ), sprintf( __( '[%s] New Event Booking for %s', 'eventorganiserp' ), $blogname, $event ), $message, false, false, 'eo-email-template-event-organiser.php' );

    }

    Charlotte Kitto
    #9745

    Hi Charlotte,

    The eo_get_venue_name() function expects the venue ID, not the booking ID. You can get the venue ID from eo_get_venue() passing the event ID ($post_id in the code you posted above), which explains why the venue is not appearing.

    Also, the eventorganiser_notify_confirmed_booking hook is for confirmed bookings not for ‘new bookings’. The plug-in allows you to receive notifications when a booking is made and/or when its confirmed. I mention this because you could be receiving the ‘new booking’ e-mail, while trying to edit the confirmed booking email. The e-mails you are getting – are they for confirmed bookings?

    (On a side note: if you over-ride the email notification handling the bookee won’t receive an e-mail. A way round this is to return true; so that the function continues ‘as normal’ and e-mails the bookee, but then in your settings disable admin notifications for confirmed bookings so you don’t receive them twice.)

    The following adds the venue name to the ‘event booking confirmed’ email sent to the admin. You’ll want to disable the ‘notify me when a booking is confirmed’ option, otherwise you’ll be getting two e-mails everytime a booking is confirmed.

    add_filter( 'eventorganiser_notify_confirmed_booking', 'ck_notify_confirmed_booking', 10, 2 );
    function ck_notify_confirmed_booking( $bool, $booking_id ) {
    
        //Notify admin
        $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
        $post_id = (int) eo_get_booking_meta( $booking_id, 'event_id' );
        $venue_id = eo_get_venue( $post_id ); 
        $venue = eo_get_venue_name( $venue_id );
        $occurrence_id = (int) eo_get_booking_meta( $booking_id, 'occurrence_id' );
        $event = get_the_title( $post_id );
        $user_id = (int) eo_get_booking_meta( $booking_id, 'bookee' );
    
        $hr= '<hr style="color:#E6E8E6;background-color:#E6E8E6;height:1px;border:0">';
    
        $title =
            '<h2 style="display:block;font-family:Arial;font-size:30px;font-weight:bold;line-height:120%;margin-right:0;margin-bottom:15px;margin-left:0;text-align:left;color:#333 !important">'
            .__( 'Booking Confirmed', 'eventorganiserp' ).'</h2>';
    
        $preamble = sprintf(
            '<p>'.__( 'A new booking has been confirmed on your site %s:', 'eventorganiserp' ).'</p>'
            .'<h3 style="color:black;"> Booking #%d for %s %s at %s </h3>',
            $blogname,
            $booking_id,
            $event,
            empty( $occurrence_id ) ? '' : eo_get_the_start( '(jS F Y)', $post_id, null, $occurrence_id ),
            $venue
        );
    
        $booking_table = _eventorganiser_get_booking_table_for_email( $booking_id );
    
        $bookee = get_userdata( $user_id );
        $bookee_details =sprintf(
            '<h3 style="color:black;"> %s </h3>
            <p><strong>%s:</strong> %s </p>
            <p><strong>%s:</strong> %s </p>',
            __( 'Bookee', 'eventorganiserp' ),
            __( 'Username', 'eventorganiserp' ),
            eo_get_booking_meta( $booking_id, 'bookee_display_name' ),
            __( 'Email', 'eventorganiserp' ),
            eo_get_booking_meta( $booking_id, 'bookee_email' )
        );
    
        $postamble = sprintf(
            '<p>'.__( 'You can view the <a href="%s">booking here</a>', 'eventorganiserp' ). '</p>',
            eventorganiser_edit_booking_url( $booking_id )
        );
    
        $message = $title.$preamble.$booking_table.$hr.$bookee_details.$hr.$postamble;
    
        eventorganiser_mail( eo_get_booking_notification_email( $booking_id ), sprintf( __( '[%s] Confirmed Event Booking for %s', 'eventorganiserp' ), $blogname, $event ), $message, array(), array(), 'eo-email-template-event-organiser.php' );
    
        //Don't override default behaviour: return true
        return true;
    }
    Stephen Harris
    #9752

    Thank you, thank you, thank you.

    It would still be great if the venue were to show in the backend listing of bullets, but I can work around with the Ticket name for the time being.

    Charlotte Kitto
Viewing 6 posts - 1 through 6 (of 6 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.