Name Next To Avatar

Home Forums Ticket Products Event Tickets Plus Name Next To Avatar

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1096958
    Simon Groves
    Participant

    Hi
    I’d like to add the name next to/underneath the Avatar

    I 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!

    #1096990
    George
    Participant

    Hey 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,
    George

    #1097700
    Simon Groves
    Participant

    Thanks 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 ๐Ÿ™

    #1097707
    Simon Groves
    Participant

    Ok, 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>&nbsp;</th>
    			<th>Member</th>
    			<th>Company</th>			
    			<th>Guest</th>
    		</tr>
    	</thead>
    	<tfoot>
    		<tr>
    			<th>&nbsp;</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>&nbsp;</td>';
    			endif;
    			
    			if ( isset($get_tribe_meta['name']) ):
    				echo '<td>'.$get_tribe_meta['name'].'</td>';
    			else:
    				echo '<td>&nbsp;</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
    – Telephone

    I 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 link

    I hope this will help others

    #1097731
    George
    Participant

    Thanks for sharing! Best of luck with your project. ๐Ÿ™‚

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Name Next To Avatar’ is closed to new replies.