How to include Mobile numbers to Attendees Report and Export?

Home Forums Ticket Products Event Tickets Plus How to include Mobile numbers to Attendees Report and Export?

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1153029
    Tac
    Participant

    Hi,

    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.

    #1153430
    Nico
    Member

    Hi 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,
    Nico

    #1153458
    Tac
    Participant

    Hi Nico,

    You are correct on both of your points.

    Thanks.

    #1154619
    Nico
    Member

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

    #1157324
    Tac
    Participant

    Apologies 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.
    #1158140
    Nico
    Member

    No 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,
    Nico

    #1161839
    Tac
    Participant

    Thanks 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.

    #1163151
    Nico
    Member

    Thanks 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,
    Nico

    #1168977
    Tac
    Participant

    Hi Nico,

    I will try it today and will get back to you.

    Thanks.

    #1168989
    Tac
    Participant

    Hi 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.

    #1169758
    Nico
    Member

    Thanks 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,
    Nico

    #1170237
    Tac
    Participant

    Hi 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.

    #1170625
    Nico
    Member

    Thanks 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,
    Nico

    #1180687
    Support Droid
    Keymaster

    Hey 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

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘How to include Mobile numbers to Attendees Report and Export?’ is closed to new replies.