You can try to put this placeholder #_ATTENDEES in the single events page Settings > Events Format > Default single event format
. Is this the area that you want to use it?
I had done my personal view of the table (in a small variation soon, I need to make sure, that only Editors and admins get this table rendered)
I’d love if this table could be made configurable, column by column and view controlled globally for defaults but overridable for each event (there might be cases where you want to show all who is attending, not only editors/admins)
agelonwl,
Thanx for response. No, not quite, I would like to have just a standard WP-page called Attendess that lists who’s attending to the event.
Or the best would to have a widget that lists the attendees.
Something like [em-attendees id=<event id>]
?
I also like the widget idea as a widget would know if an event is displayed and then display attendees (you may choose if for specific events or on page scope)
Nice to have
you can use this:
[event event=id]#_ATTENDEES[/event]
and then modify the attendees template
I totally forgot that the scop of “#_” notation can be set using this encapsulation – good one!
actually, i need to update the docs, a recent-ish feature π
Yepp, seems to work even though I just get a bullet list and no names, at least not visible. I gather I have to do some modification in the css as well ??
Is there a way to get names in there instead of avatars? I tried editing the attendees.php file in the /templates/placeholders directory, but I have no clue how to edit it.
I tried changing “get_avatar” to “get_name” with no luck, and also trying to change/delete the parameters in the bracket. It just causes the event page to return a completely blank page.
Here’s the code in question:
<?php
/* @var $EM_Event EM_Event */
$people = array();
foreach($EM_Event->get_bookings() as $EM_Booking){
$people[$EM_Booking->person->ID] = $EM_Booking->person;
}
?>
<ul class="event-attendees">
<?php foreach($people as $EM_Person): ?>
<li><?php echo get_avatar($EM_Person->ID, 50); ?></li>
<?php endforeach; ?>
</ul>
Well, I think I figured some stuff out. Here’s my adjusted attendees.php
(forgive me for any formatting errors. I’m not a programmer at all)
<?php
/* @var $EM_Event EM_Event */
$people = array();
foreach($EM_Event->get_bookings() as $EM_Booking){
$people[$EM_Booking->person->ID] = $EM_Booking->person;
}
?>
<ul class="event-attendees">
<?php foreach($people as $EM_Person): ?>
<li>
<?php $user_info = get_userdata($EM_Person->ID);
echo $user_info->first_name . " " . $user_info->last_name . " - Spaces: " . $EM_Booking->get_spaces();
?></li>
<?php endforeach; ?>
</ul>
one suggestion, $EM_Person is actually a WP_User class extended, so instead of setting $user_info, you can directly use $EM_Person->first_name etc.
btw, just learnt this yesterday, you should start using ->user_firstname, ->user_lastname as the other two are depreciated.
I have no idea what that means, but I will give it a try. π thanks!
Slightly off topic, but the $EM_Booking->get_spaces() just returns a “1” no matter what. I want it to echo the number of spaces booked by the person, but I guess it’s grabbing the wrong number from somewhere. Do you have any hints on that?
that should be right, are you sure you don’t have the wrong booking object? you can access the property directly by ->spaces (but not recommended)
Sorry, as I said, I’m not a programmer so I don’t even understand your question. My code is exactly as I posted in the above message, and I have the #_ATTENDEES tag in the “Default single event format” area within the {has_bookings} tag.
It definitely returns all “1” for the spaces, even though some people signed up for 2 or 3 spots. If I change my booking to “2” spaces, it will show all “2” for everybody’s spaces. If I logout and login again, and keep my booking at “2”, it shows all “1” again. I’ve ctrl-refreshed many times and cleaned out my wp-cache each time I refreshed the page.