Help Desk

Add event time and date to attendees list email

  • Posts: 52 Topics: 26
    | Permalink

    Hi,

    if I manually email the attendees list to a specific email address, then there is the title of the event within the email, but no time and date of the event, which is somehow incomprehensible.

    Is there a hook to fix this?

    Thank you!

    Posts: 2358
    | Permalink

    Hello Hannes,

    There is a template for this email that can be copied into your theme and customized. The template is located in the Events Tickets plugin in src/views/tickets/attendees-email.php. You would copy this into [your-theme]/tribe-events/tickets/attendees-email.php and make your modifications.

    To get you pointed in the right direction, in this template you can use the $event variable, which stores the event as a WordPress post object. So, to get the event id, use $event->ID. You can then pass this into any tribe functions to get details of the event. For example, you might use tribe_get_start_date to get the event date and time like so:

    echo tribe_get_start_date( $event->ID, true );
    

    Let me know if that helps, or if you have any other questions.

    Thanks,
    Sky

    Posts: 52 Topics: 26
    | Permalink

    Help Sky,
    thank you for your hint, it did the trick!
    Is it possible to add two new fields to the list:
    • Phone number of attendee
    • Payment method of attendee
    I hope it is that easy too.
    Thank you!

    Posts: 2358
    | Permalink

    Hannes,

    I just found this extension that looks like it may enable the attendee fields to appear in the emails for tickets?

    Can you give that a look and see if it meets your needs?

    Thanks,
    Sky

    Posts: 52 Topics: 26
    | Permalink

    Thanks ou, but this extension is for the WooCommerce email, not for the attendees list email

    Posts: 2358
    | Permalink

    Hannes,

    Yes, you are correct. I misinterpreted the description for that extension.

    I’ve been looking through the code trying to find all the pieces that you would need to access that information, but I’m not coming up with everything.

    Here is an example of extracting the attendee data:

    // TEC ticket meta fields - get data
        $fieldset_meta = get_post_meta( $order->id, Tribe__Tickets_Plus__Meta::META_KEY, true );
         
        //If No fields set, do not process
        if (! $fieldset_meta ) return;
         
        //If fields set, loop and display each tickets data
        for($i = 0; $i < count($fieldset_meta); $i++) {         
            $att_ticket_title = get_the_title($keys[$i]);
            echo '<h4>'. $att_ticket_title .'</h4>';         
            foreach( $fieldset_meta[$keys[$i]] AS $key =&gt; $value ) {                 
                $att_fname         = (isset( $value['first-name'] )) ? $value['first-name'] : '';
                $att_lname         = (isset( $value['last-name'] )) ? $value['last-name'] : '';
                $att_email         = (isset( $value['email'] )) ? $value['email'] : 'this';
                $att_phone         = (isset( $value['phone'] )) ? $value['phone'] : '';
                $att_profession = (isset( $value['profession'] )) ? $value['profession'] : '';
                $att_license     = (isset( $value['license'] )) ? $value['license'] : '';
                echo '<p>';
                echo '<strong>Attendee - '. ($key + 1) .'</strong>&lt;br /&gt;';
                echo 'Name: '. $att_fname .' '. $att_lname .'&lt;br /&gt;';
                echo 'Email: '. $att_email .'&lt;br /&gt;';
                echo 'Phone: '. $att_phone .'&lt;br /&gt;';
                echo 'Profession: '. $att_profession .'&lt;br /&gt;';
                echo 'License #: '. $att_license .'&lt;br /&gt;';
                echo '</p>';
            } //end foreach         
        } //end for
    

    What I’m not sure about in the above example is how to access the order id which in there is “$order->id”;

    You can look at event-tickets/src/Tribe/Attendees.php at the generate_filtered_list() function. This is what defines the $items that are being looped through in the attendees-email.php file. There are some filters inside that function that could possibly be manipulated to add the data, and there may also be a way to get the id of the ticket for using in the above example.

    I’m sorry I don’t have a more complete answer for you. If you are unable to figure it out from the information I have provided, but still want to pursue this, I can add this ticket to our “customization request queue” and someone may be able to help. However, no guarantees if or when that would happen. Let me know if you’d like to go this route.

    Let me know if that helps!

    Thanks,
    Sky

    Posts: 52 Topics: 26
    | Permalink

    Thank you Sky.
    Outputting the payment method seems to be difficult without order id.
    Is there a way to output it not inly on the attendee list but also on the ticket email (email.php)?
    Greetings,
    Hannes

    Posts: 2358
    | Permalink

    Hannes,

    I have asked around about how to do this, but have not heard anything back yet.

    I will follow up on this next monday, and let you know if I’m able to find anything that may be helpful to you.

    Thanks for your patience, and have a good weekend!

    Sky

    Posts: 52 Topics: 26
    | Permalink

    Meanwhile I have made to output the payment method on the ticket email.
    My solution:
    // get order and payment method
    $ticket_order = wc_get_order( $ticket[‘order_id’] );
    $ticket_payment_method = $ticket_order->payment_method_title;
    Because order_id is there, it is easy.

    Now my only challenge is to output the payment method on the attendee list email (attendees-email.php).
    It would be cool if you could give me the information where it is called and the $items array is built.

    Thank you and have a nice weekend!
    Hannes

    Posts: 2358
    | Permalink

    Hannes,

    I’m glad you made some progress! I asked around, and was only told that it may be in stored in $item[6]? I have not confirmed this however.

    To pursue this any further, we will need to move this ticket to the “customization request queue” where someone may be able to help you find what you need. This level of customization is a bit beyond our scope of support, but someone may be able to assist if possible.

    Let me know if you’d like to go this route, or if the information I provided above helped answer your question.

    Thanks,
    Sky

    Posts: 52 Topics: 26
    | Permalink

    Hello Sky,
    yes please move this ticket to the “customization request queue”.
    Thank you and greetings!
    Hannes

    Posts: 52 Topics: 26
    | Permalink

    Hello Sky,
    I checked the generate_filtered_list() function and found that the items array has a field with order id.
    Now everything is easy.
    You can take my request back from customization queue.
    Thank you!
    Awesome support!

    Posts: 52 Topics: 26
    | Permalink

    Resolved! 🙂

    Posts: 2358
    | Permalink

    Hannes,

    Awesome! I’m glad you figured it out.

    Please let us know if you have any questions or issues in the future.

    Take care,
    Sky

    Posts: 65
    | Permalink

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

    | Permalink