Home › Forums › Ticket Products › Event Tickets Plus › How to include Mobile numbers to Attendees Report and Export?
- This topic has 14 replies, 4 voices, and was last updated 9 years, 6 months ago by
Tac.
-
AuthorPosts
-
August 18, 2016 at 2:18 am #1153029
Tac
ParticipantHi,
I would like to add Mobile numbers to the attendees list and should also be export to CSV file. This mobile number is what we capture from Billing Page when a buyer buys ticket.
Event organisers are asking to have access to mobile numbers and they should be able to export from their front end.
Thanks.
August 18, 2016 at 4:03 pm #1153430Nico
MemberHi there Tac,
Thanks for getting in touch with us! I’ll help you here…
Can you please tell me a bit more about your site set-up?
Event organisers are asking to have access to mobile numbers and they should be able to export from their front end.
The above suggests you are using Community Tickets on the site is that correct?
This mobile number is what we capture from Billing Page when a buyer buys ticket.
You mean the Phone field under Billing in checkout, right?
Please let me know about it,
Best,
NicoAugust 18, 2016 at 5:19 pm #1153458Tac
ParticipantHi Nico,
You are correct on both of your points.
Thanks.
August 22, 2016 at 6:57 pm #1154619Nico
MemberHey Tac,
Thanks for the patience while I worked on this! I have an initial snippet I would like you to test:
/* Tribe, inject phone column header */
function tribe_inject_phone_column ( $columns ) {// bail if no tickets column present
if ( !array_key_exists('ticket', $columns) ) return $columns;return array_merge( $columns, array('phone' => 'Phone' ) );
}
add_filter( 'manage__columns', 'tribe_inject_phone_column' );/* Tribe, inject phone column value */
function tribe_inject_phone ( $value, $item, $column ) {if ('phone' == $column && 'woo' == $item['provider_slug'] ) {
if ( !class_exists( 'WC_Order' ) ) return '';
$order = new WC_Order( $item['order_id'] );
$billing = $order->get_address('billing');$value = $billing['phone'];
}
return $value;
}
add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_inject_phone', 10, 3);
This should add the phone column in the front-end and populate the correct value in the column. Paste the snippet in your theme’s (or child theme’s) functions.php file and navigate to a front-end attendees report page with tickets. Do you see the phone column with the correct number for each ticket? Once we are done with this first part I’ll work on getting this value exported if possible.
Best,
NicoAugust 29, 2016 at 3:50 pm #1157324Tac
ParticipantApologies about the delay Nico!
Yes, I can confirm that I can see the phone numbers in the Attendees list from Front End.
The only thing is the phone number is the last field whereas it should be next to purchaser’s email address.
Thanks.
-
This reply was modified 9 years, 7 months ago by
Tac.
August 31, 2016 at 8:16 am #1158140Nico
MemberNo worries on the delay Tac!
Just replace the tribe_inject_phone_column function for this new one:
function tribe_inject_phone_column ( $columns ) {// bail if no tickets column present
if ( !array_key_exists('ticket', $columns) ) return $columns;return array_merge( array_slice ( $columns , 0, 5 ), array('phone' => 'Purchaser Phone' ), array_slice ( $columns , 5 ) );
}
This should place ‘Purchaser Phone’ right after ‘Purchaser Email’ column. Give it a try and let me know,
Best,
NicoSeptember 8, 2016 at 6:28 pm #1161839Tac
ParticipantThanks Nico.
But how do we get to see the Phone number in WP ADMIN and also need to export the phone number as a part of csv from both front end and back end.
THanks.
September 12, 2016 at 6:53 pm #1163151Nico
MemberThanks for confirming Tac!
To show this column in the attendee report in the dashboard and also add the phone to the CSV export:
/* Tribe, inject phone column header */
function tribe_inject_phone_column ( $columns ) {// bail if no tickets column present
if ( !array_key_exists('ticket', $columns) ) return $columns;return array_merge( array_slice ( $columns , 0, 5 ), array('phone' => 'Purchaser Phone' ), array_slice ( $columns , 5 ) );
}
add_filter( 'manage__columns', 'tribe_inject_phone_column' );
add_filter( 'manage_tribe_events_page_tickets-attendees_columns', 'tribe_inject_phone_column' );/* Tribe, inject phone column value */
function tribe_inject_phone ( $value, $item, $column ) {if ('phone' == $column && 'woo' == $item['provider_slug'] ) {
if ( !class_exists( 'WC_Order' ) ) return '';
$order = new WC_Order( $item['order_id'] );
$billing = $order->get_address('billing');$value = $billing['phone'];
}
return $value;
}
add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_inject_phone', 10, 3);/* Tribe, add the phone to CSV export as well */
function tribe_csv_export_add_phone ( $post_id ) {add_filter( 'manage_' . get_current_screen()->id . '_columns', 'tribe_inject_phone_column', 20 );
add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_inject_phone', 10, 3);
}
add_action( 'tribe_events_tickets_generate_filtered_attendees_list', 'tribe_csv_export_add_phone' );
Give it a try and let me know,
Best,
NicoSeptember 26, 2016 at 6:03 pm #1168977Tac
ParticipantHi Nico,
I will try it today and will get back to you.
Thanks.
September 26, 2016 at 7:35 pm #1168989Tac
ParticipantHi Nico,
Just tried and I can see the Phone number from the Dashboard but it doesn’t come through in CSV file. Similar behaviour from the front end.
Thanks.
September 28, 2016 at 6:31 am #1169758Nico
MemberThanks for the heads-up Tac!
I just re-tested the code in my local test site and it’s working as expected (the phone is added to the CSV file as well). Anyway I did a small tweak so please give this updated version a try:
/* Tribe, inject phone column header */
function tribe_inject_phone_column ( $columns ) {// bail if no tickets column present
if ( !array_key_exists('ticket', $columns) ) return $columns;return array_merge( array_slice ( $columns , 0, 5 ), array('phone' => 'Purchaser Phone' ), array_slice ( $columns , 5 ) );
}
add_filter( 'manage__columns', 'tribe_inject_phone_column' );
add_filter( 'manage_tribe_events_page_tickets-attendees_columns', 'tribe_inject_phone_column' );/* Tribe, inject phone column value */
function tribe_inject_phone ( $value, $item, $column ) {if ('phone' == $column && 'woo' == $item['provider_slug'] ) {
if ( !class_exists( 'WC_Order' ) ) return '';
$order = new WC_Order( $item['order_id'] );
$billing = $order->get_address('billing');$value = $billing['phone'];
}
return $value;
}
add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_inject_phone', 10, 3);/* Tribe, add the phone to CSV export as well */
function tribe_csv_export_add_phone ( $post_id ) {add_filter( 'manage__columns', 'tribe_inject_phone_column', 20 );
add_filter( 'manage_tribe_events_page_tickets-attendees_columns', 'tribe_inject_phone_column', 20 );add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_inject_phone', 10, 3);
}
add_action( 'tribe_events_tickets_generate_filtered_attendees_list', 'tribe_csv_export_add_phone' );
Hope this time it works!
Best,
NicoSeptember 28, 2016 at 11:45 pm #1170237Tac
ParticipantHi Nico,
An update, once step closer. Now, if I login as an event organiser from front end, I can export phone number as well but if I login to the backend(wp-admin) as site admin, I am unable to export phone numbers in csv.
Thanks.
September 29, 2016 at 11:41 am #1170625Nico
MemberThanks for following Tac! Hopefully we are almost there 🙂
I just confirmed with a team mate that the code is working for both of us. So can you please test this with Tweenty Sixteeen theme and no other plugins active but ours?
Thanks,
NicoOctober 21, 2016 at 9:35 am #1180687Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
This reply was modified 9 years, 7 months ago by
-
AuthorPosts
- The topic ‘How to include Mobile numbers to Attendees Report and Export?’ is closed to new replies.
