Daniel Magin
February 5, 2013 at 3:30 am
[LISTATTENDEES ???ORDER BY DATE????]
hi to all,
is there a way to order the output by date?
regards
daniel
This topic was modified 11 years, 9 months ago by Daniel Magin .
Dean
February 5, 2013 at 3:36 am
Add New Note to this Reply
Hi,
I am assuming you want to know if the [LISTATTENDEES] shortcode has an order by date of registration attribute?
If so, unfortunately no it does not.
https://eventespresso.com/wiki/shortcodes-template-variables/#attendee-list
Daniel Magin
February 5, 2013 at 3:41 am
Add New Note to this Reply
hi dean,
yes i was see the documentation. but showing all the events without a order is like a random list.
would it not better to order by default the list by date?
daniel ๐
Dean
February 5, 2013 at 4:12 am
Add New Note to this Reply
I see what you are saying.
There is actually a default order to the LISTATTENDEES, alphabetical by surname.
I’ll add a feature request for being able to sort these by various options.
Daniel Magin
February 5, 2013 at 4:14 am
Add New Note to this Reply
hi dean,
this is not what i mean. i use the shortcode on one site to list all events with all attendees.
my question is about the order of the events, not inside the event attendees.
i like to order the events created by the short code by date.
daniel ๐
Dean
February 5, 2013 at 4:22 am
Add New Note to this Reply
Ahhh I see, well they are ordered in creation order so via event ID.
I will update the ticket accordingly, to see if we can add further sort orders in future revisions.
Daniel Magin
February 5, 2013 at 1:14 pm
Add New Note to this Reply
i just changed the source in the event-espresso/includes/shortcodes.php
so other can participate the workaround so long as the new update include the function. so you have here the source to change
LINE 129
if (!function_exists(‘event_espresso_attendee_list’)) {
function event_espresso_attendee_list($event_id='NULL', $event_identifier='NULL', $category_identifier='NULL', $show_gravatar='false', $show_expired='false', $show_secondary='false', $show_deleted='false', $show_recurrence='true', $limit='0', $paid_only='false', $sort_by='last name') {
global $this_event_id;
$show_expired = $show_expired == 'false' ? " AND e.start_date >= '" . date('Y-m-d') . "' " : '';
$show_secondary = $show_secondary == 'false' ? " AND e.event_status != 'S' " : '';
$show_deleted = $show_deleted == 'false' ? " AND e.event_status != 'D' " : '';
$show_recurrence = $show_recurrence == 'false' ? " AND e.recurrence_id = '0' " : '';
$sort = $sort_by == 'last name' ? " ORDER BY lname " : '';
$limit = $limit > 0 ? " LIMIT 0," . $limit . " " : '';
if ($event_identifier != 'NULL' || $event_id != 'NULL' || (isset($this_event_id) && !empty($this_event_id)) ) {
$type = 'event';
if (isset($this_event_id) && !empty($this_event_id)){
$event_id = $this_event_id;
}
} else if ($category_identifier != 'NULL') {
$type = 'category';
}
if (!empty($type) && $type == 'event') {
$sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . " e ";
$sql .= " WHERE e.is_active = 'Y' ";
if ($event_id != 'NULL'){
$sql .= " AND e.id = '" . $event_id . "' ";
}else{
$sql .= " AND e.event_identifier = '" . $event_identifier . "' ";
}
$sql .= $show_secondary;
$sql .= $show_expired;
$sql .= $show_deleted;
$sql .= $show_recurrence;
$sql .= $limit;
event_espresso_show_attendess($sql, $show_gravatar, $paid_only, $sort);
} else if (!empty($type) && $type == 'category') {
$sql = "SELECT e.* FROM " . EVENTS_CATEGORY_TABLE . " c ";
$sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.cat_id = c.id ";
$sql .= " JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id = r.event_id ";
$sql .= " WHERE c.category_identifier = '" . $category_identifier . "' ";
$sql .= " AND e.is_active = 'Y' ";
$sql .= $show_secondary;
$sql .= $show_expired;
$sql .= $show_deleted;
$sql .= $show_recurrence;
$sql .= $limit;
//UNOFFICAL FIX START
$sql .= ” ORDER BY e.start_date”;
//UNOFFICAL FIX END
event_espresso_show_attendess($sql, $show_gravatar, $paid_only, $sort);
} else {
$sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . " e ";
$sql .= " WHERE e.is_active='Y' ";
$sql .= $show_secondary;
$sql .= $show_expired;
$sql .= $show_deleted;
$sql .= $show_recurrence;
$sql .= $limit;
//UNOFFICAL FIX START
$sql .= ” ORDER BY e.start_date”;
//UNOFFICAL FIX END
event_espresso_show_attendess($sql, $show_gravatar, $paid_only, $sort);
}
}
}
Josh
February 11, 2013 at 8:52 am
Add New Note to this Reply
Hi Daniel,
I’m not sure whether this modification will make it into a future version, so I can recommend copying your modified event_espresso_attendee_list function into the custom_functions.php file that is included with the custom files add-on .
You’ll notice that on line 129 in includes/shortcodes.php it’s checking to see if that function is being loaded from there first.