Support

Home Forums Event Espresso Premium Change out Tickets column for Event Date in My Events list

Change out Tickets column for Event Date in My Events list

Posted: June 13, 2018 at 6:44 pm

Viewing 6 reply threads


mdeyerinkc

June 13, 2018 at 6:44 pm

Hi,

I’m using ESPRESSO_MY_EVENTS template=simple_list_table on a page and I’d like to replace the Ticket column with the Event Start Date. I’ve got the loop-espresso_my_events-simple_list_table.template.php file set up in my theme’s child folder, and I can see the Ticket column <th>, but I can’t figure out how to change it so the event date displays. I tried just replacing the Ticket <th> section with this:

<th scope="col" class="espresso-my-events-ticket-th">
<?php echo apply_filters(
'FHEE__loop-espresso_my_events__table_header_ticket',
esc_html__( 'Ticket', 'event_espresso' ),
$object_type,
$objects,
$template_slug,
$att_id
); ?>
</th>

…but that didn’t work. Is it more complicated than that?


mdeyerinkc

June 13, 2018 at 6:46 pm

Ooops… actually I replaced that code with this…

<?php echo apply_filters(
'FHEE__loop-espresso_my_events__table_header_datetimes',
esc_html__( 'Dates & Times', 'event_espresso' ),
$object_type,
$objects,
$template_slug,
$att_id
); ?>
</th>


Tony

  • Support Staff

June 14, 2018 at 3:24 am

Hi there,

In short the above changes the ‘Ticket’ header, to ‘Dates & Times’.

I tested your code on a test site and it worked as it should – http://take.ms/JMBND

To edit the content of the column you need to edit the content-espresso_my_events-simple_list_table.template.php template.

Lines 14-16 will have:

<td>
    <?php echo $registration->ticket() instanceof EE_Ticket ? $registration->ticket()->name() : ''; ?>
</td>

You’ll need to change that to pull the datetime(s) linked to the ticket and output the date/time from that.

Are all of your tickets only assigned to a single datetime or can a single ticket be assigned to multiple datetimes?


mdeyerinkc

June 14, 2018 at 1:48 pm

Yes, for our setup, all tickets are assigned to a unique datetime. I just need to know what the variable is, and is it as simple as switching out “ticket” for “[variable]”? E.g. below…?

<td>
    <?php echo $registration->datetime() instanceof EE_Datetime ? $registration->datetime()->name() : ''; ?>
</td>


Tony

  • Support Staff

June 14, 2018 at 2:39 pm

Not really no.

There’s no datetime() method on an EE_Registration object so the above wouldn’t work. But you can do something like this:


    <td>
        <?php 
            $datetime = $registration->get_earliest_related_datetime();

            if( $datetime instanceof EE_Datetime ) {
                $datetime->e_start_date_and_time();
            }
        ?>
    </td>


mdeyerinkc

June 14, 2018 at 2:46 pm

That’s perfect. Thanks Tony!


Tony

  • Support Staff

June 15, 2018 at 3:31 am

You’re most welcome 🙂

Viewing 6 reply threads

The support post ‘Change out Tickets column for Event Date in My Events list’ 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