Home › Forums › Ticket Products › Event Tickets Plus › Name Next To Avatar
- This topic has 4 replies, 2 voices, and was last updated 8 years ago by George.
-
AuthorPosts
-
April 1, 2016 at 8:09 am #1096958Simon GrovesParticipant
Hi
I’d like to add the name next to/underneath the AvatarI can edit the template within my theme and I can see you’re using the foreach looop
However, I can’t work out is how to retrieve the name?
Any help is appreciated!
April 1, 2016 at 8:52 am #1096990GeorgeParticipantHey Simon,
Thanks for reaching out.
We unfortunately cannot help with code customization hereโcheck out this page for more information: https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/
However, I wanted to let you know that I took the time to put together a version of the custom attendees-list.php template that does, in fact, add the attendee name beneath the attendee image. ๐
To see the version of the file that does this, check out this Gist โ https://git.io/vVCML
Now, there is no styling of the names here, so to take this further and make it all look exactly how you want on your site and such, you will have to take the reins on that and on any further refinement of things.
But I hope this example version of the attendees-list.php template file helps!
Cheers,
GeorgeApril 4, 2016 at 12:40 am #1097700Simon GrovesParticipantThanks George,
Will need to alter this as it doesn’t show the Guest details, only the purchaser details – somewhat defeats the object of showing who’s attending ๐
April 4, 2016 at 1:41 am #1097707Simon GrovesParticipantOk, I’ve recoded the your-theme/tribe-events/attendees-list.php template to show the guest names not just who purchased the ticket. Here’s my code:
<div class='tribe-attendees-list-container'> <h2 class="tribe-attendees-list-title"><?php esc_html_e( 'Who\'s Attending', 'event-tickets-plus' ) ?></h2> <p><?php echo esc_html( sprintf( _n( 'One person is attending %2$s', '%d people are attending %s', $attendees_total, 'event-tickets-plus' ), $attendees_total, get_the_title( $event->ID ) ) ); ?></p> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th> </th> <th>Member</th> <th>Company</th> <th>Guest</th> </tr> </thead> <tfoot> <tr> <th> </th> <th>Member</th> <th>Company</th> <th>Guest</th> </tr> </tfoot> <tbody> <?php foreach ( $attendees_list as $attendee_id => $avatar_html ) { ?> <tr> <?php $attendee_name = ''; foreach ( $attendees as $key => $attendee_obj ) { if ( isset( $attendees[ $key ]['attendee_id'] ) && $attendee_id == $attendees[ $key ]['attendee_id'] ) { $attendee_name = $attendees[ $key ]['purchaser_name']; } } ?> <td><?php echo $avatar_html; ?></td> <?php if ( ! empty( $attendee_name ) ) : ?> <td><?php echo $attendee_name; ?></td> <?php endif ?> <?php $meta = get_post_meta($attendee_id); $tribe_tickets_meta = $meta['_tribe_tickets_meta']; $get_tribe_meta = unserialize($tribe_tickets_meta[0]); if ( isset($get_tribe_meta['company']) ): echo '<td>'.$get_tribe_meta['company'].'</td>'; else: echo '<td> </td>'; endif; if ( isset($get_tribe_meta['name']) ): echo '<td>'.$get_tribe_meta['name'].'</td>'; else: echo '<td> </td>'; endif; ?> </tr> <?php } ?> <tbody> </table> </div>
I’ve included a jquery datatable as some events may have over a 100 people going, so this keeps the page nice and clean, plus allows people to search/filter those attending
For my own needs, I’ve setup some fields via the Ticket Fieldset now available, like so:
– Name
– Email Address
– Company
– TelephoneI only want to include particular fields, so made use of the custom field ‘_tribe_tickets_meta’ that stores the info. You could use:
echo 'Tribe Meta: ' . $tribe_tickets_meta[0] . '<br/>';
This will show the fields you’ve created so you can update the above as you need to. You then need to include the necessary CDN calls for the data table as per the above linkI hope this will help others
April 4, 2016 at 4:09 am #1097731GeorgeParticipantThanks for sharing! Best of luck with your project. ๐
-
AuthorPosts
- The topic ‘Name Next To Avatar’ is closed to new replies.