Support

Home Forums Event Espresso Premium How to Add Event Start Time to Attendee Listing?

How to Add Event Start Time to Attendee Listing?

Posted: December 6, 2014 at 5:14 pm


Greg Davis

December 6, 2014 at 5:14 pm

I am using EE3 and creating a custom attendee listing template. The current version can be seen here: http://kennettdesign.staging.wpengine.com/attendee-listing/

I am trying to display the event starting date & time just below the event name and above the list of attendees. I have successfully added the date, but the time is always showing 7:00 pm even though that is not the correct time. The code I’m using in this section is:

<h4 class="event_title ui-widget-header ui-corner-top">
		<?php echo $event_name . ' - ' . $event_meta['start_date']?></h4>
		<?php echo event_date_display($start_date, get_option('date_format')) . " at " . date('g:i a', strtotime($start_time)); ?>

Can you tell me what I’m missing or doing wrong? Thanks.


Dean

December 8, 2014 at 1:55 am

Hi Greg,

Oddly enough, the event start and end time are not held with the rest of the event data. I assume this is because it is needed in a variety of areas.

Anyway, you can obtain that data by using

echo event_espresso_get_time($event->id, ‘start_time’);

this will output it in 08:00 am format by default.


Greg Davis

December 9, 2014 at 6:49 pm

Great thank Dean that worked!

Is it also possible to control the order in which the events are displayed? You’ll see on that page http://kennettdesign.staging.wpengine.com/attendee-listing/
the events are in a rather random order. We want them to be in order of the event start date. I tried using the following shortcode parameters but it doesn’t seem to recognize the order by one:

[LISTATTENDEES order_by=date(start_date),id show_expired=”false” show_deleted=”false” show_recurrence=”false” paid_only=”true”]


Greg Davis

December 9, 2014 at 7:09 pm

Also… to show the event location, I am trying to use the following:

$event_location = get_post_meta($post->id, 'event_location', true);

Followed by an echo statement but so far no luck. Is there something I’m missing?


Greg Davis

December 9, 2014 at 7:22 pm

Sorry… for so many questions, but just one more! While showing the list of attendees is normally also the number of guests, sometimes we have a situation like this one where 1 person paid for a group of 12.

https://dl.dropboxusercontent.com/u/4138085/ee-attendee-qty.jpg

Is it possible to show the “quantity” number in addition to the attendee name?

Thanks!


Dean

December 10, 2014 at 12:49 am

Hi,

1) The shortcode doesn’t have any active sorting feature. There is one that is in the code but is not active, but it only sorts the attendees not the events.

Currently there is no sorting order for the events, they will be shown in ID order by default.

The only way to force a sort order would be to amend the shortcode found in /wp-content/plugins/event-espresso/includes/shortcodes.php

The function is pluggable so can be copied to a site specific plugin and modified there rather than editing the core files.

EDIT: in the attendee_list.php you could sort the events array.
I used this http://stackoverflow.com/questions/4282413/sort-array-of-objects-by-object-fields and added the function into the template and the usort to below where the $events array is created. The main difference I did was to add a strtolower as I tested it with event names. https://monosnap.com/image/udgVk3DJCc3XM32k6KTBpJxf1Q9sBK

2) This depends on how you have set up the location. If it is via the location fields in the event, then you can use $event->venue_title (venue_title, venue_url, venue_image, venue_phone). If it is via the venue manager then it will be quite different. That data isn’t provided in this template so you would need to do a database call to grab it.

3) $attendee->quantity will output the number of tickets purchased. That would need to be echoed in the foreach that is outputting the attendees in the attendee_list.php file (approx line 99)

Hopefully some of that makes sense, but let me know if you have any questions.


Greg Davis

December 10, 2014 at 7:59 pm

Thanks Dean!

1. I’m trying to digest this fully. I understand the idea of sorting the array in the template just not that experienced with it so may come back with follow-up question(s) on that.

2. We are using the Venue Manager. We would like to show just the name of the venue for the event. Does that make it any easier?

3. This worked great – thanks!


Dean

December 11, 2014 at 12:18 am

Hi,

1) Yeah sorry, I couldn’t simplify it further. The shortcode basically doesn’t have sorting functions so they would need to be done either by modifying the shortcode code or as mentioned, sorting the event array.

2) Not really, the problem is that the venue data is not already requested at this point as the attendee list was designed to only show a list of attendees. As such the only way I can currently see to get the venue data would be to query the database and get the table events_venue_rel and events_venue in arrays and then match up the venue to the event.

3) No problem!

The support post ‘How to Add Event Start Time to Attendee Listing?’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Dean 4 years, 11 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.