How to add name to attendee list table for Wootickets.

I’ve got to say, WooTickets is a pretty terrible plugin for being a paid (and expensive) plugin. I was hoping for more functionality but the description was very vague and I thought it would just have more to it. It’s still new(ish) and I’m hopeful that they will add better features in the future.

When you view the attendees list, you can find ticket holders by order id, ticket id, or security code. What about people that show up without a printed ticket? Are they suppose to have these obscure numbers memorized? I know I wouldn’t! So I added the ticket buyer’s full name to the attendees table.

This still isn’t the best solution, but it works. It is possible for one person to buy 20 tickets for other people. With my following workaround, if one of those 20 people shows up without a ticket, you can at least look them up if they know the name of the ticket buyer.

Name in WooTickets Table

Step 1: Add name to table

Edit file wp-content\plugins\the-events-calendar\lib\tickets\tribe-tickets-attendees.php

Add line 25 to function get_columns()

20
21
22
23
24
25
26
27
28
29
30
function get_columns() {
$columns = array( 'cb'            =&gt; '<input type="checkbox" />',
      'order_id'      =&gt; __( 'Order #', 'tribe-events-calendar' ),
      'order_status'  =&gt; __( 'Order Status', 'tribe-events-calendar' ),
      'ticket'        =&gt; __( 'Ticket', 'tribe-events-calendar' ),
      'name'          =&gt; __( 'Name', 'tribe-events-calendar' ),      'attendee_id'   =&gt; __( 'Ticket #', 'tribe-events-calendar' ),
      'security'      =&gt; __( 'Security Code', 'tribe-events-calendar' ),
      'check_in'      =&gt; __( 'Check in', 'tribe-events-calendar' ) );
return $columns;
}

Step 2: Add column method to lookup name

Same file

Add this method anywhere. It looks up the buyer’s full name from the WooCommerce order id.

	function column_name( $item ) {
		$order = new WC_Order( $item['order_id'] );
		$items = $order-&gt;billing_first_name . " " . $order-&gt;billing_last_name;
		return $items;
	}

Step 3: Make it searchable

Edit file wp-content\plugins\the-events-calendar\resources\tickets-attendees.js
Line 12 grabs the full name from the column. Notice at the end of line 14, I’ve added “fullname.indexOf( search) != -1″. This allows the search to match and letters in the full name. This allows last names to be found as well as first names.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
jQuery( document ).ready( function ( $ ) {
 
	$( '#filter_attendee' ).on( 'keyup paste', function () {
 
		var search = jQuery( this ).val().toLowerCase();
 
		$( 'td.column-security' ).each( function ( i, e ) {
			var attendeeobj = jQuery( e );
			var attendee = attendeeobj.text().toLowerCase();
			var orderid = attendeeobj.prev( 'td' ).prev( 'td' ).prev( 'td' ).prev( 'td' ).prev( 'td' ).children( 'a' ).text();			var ticketid = attendeeobj.prev( 'td' ).text();
			var fullname = attendeeobj.prev( 'td' ).prev( 'td' ).text().toLowerCase(); 
			if ( attendee.indexOf( search ) === 0 || orderid.indexOf( search ) === 0 || ticketid.indexOf( search ) === 0 || fullname.indexOf( search) != -1) {				attendeeobj.parent( 'tr' ).show();
			} else {
				attendeeobj.parent( 'tr' ).hide();
			}
		} );
 
	} );

There ya go. Leave suggestions in comments. Of course, don’t attempt this if you haven’t backed up your wordpress site. I’m not liable for damage or data loss to your site if you edit source files.