Add phone number to attendees report

Home Forums Calendar Products Community Events Add phone number to attendees report

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1342936
    Luke Kenny
    Participant

    Hi,

    I am able to add the attendees phone number to the attendees report for event calendar events using the code snippet:

    add_action( 'event_tickets_attendees_table_ticket_column', 'tribe_add_phone_to_attendee_ticket_details' );
    function tribe_add_phone_to_attendee_ticket_details( $item ) {
    	if ( ! isset( $item['order_id'] ) )
    		return;
    	$phone_number = get_post_meta( $item['order_id'], '_billing_phone', true );
    	if ( ! empty( $phone_number ) ) {
    		printf( '<div class="event-tickets-ticket-purchaser">Phone: %s</div>', sanitize_text_field( $phone_number ) );
    	}
    }

    How can I achieve the same effect for community RSVP attendees lists on the front end?

    #1343876
    Victor
    Member

    Hi Luke!

    Thanks for reaching out to us! Let me help you with that.

    The code you sent will fetch the phone number from a WooCommerce order. While an RSVP ticket does not have a Phone number by default.

    Do you want to also include a phone number for RSVP’s ? Where exactly do you want to include the phone number?

    Please let me know about it.

    Thanks,
    Victor

    #1344267
    Luke Kenny
    Participant

    Ah, I see.

    I have service providers creating events using Community Events with RSVP’s. We require end users be logged in to RSVP to an event – so the phone number is associated with their WordPress / WooCommerce user account.

    I would like this phone number to be displayed in the attendees report for community event organizers (from the front end report.)

    #1344441
    Victor
    Member

    Hi Luke!

    Thanks for clearing that out.

    Try using the following code instead:
    add_action( 'event_tickets_attendees_table_ticket_column', 'tribe_add_phone_to_attendee_ticket_details' );
    function tribe_add_phone_to_attendee_ticket_details( $item ) {
    if ( ! isset( $item['order_id'] ) ) return;
    $phone_number = get_post_meta( $item['order_id'], '_billing_phone', true );
    if ( ! empty( $phone_number ) ) {
    printf( '<div class="event-tickets-ticket-purchaser">Phone: %s</div>', sanitize_text_field( $phone_number ) );
    } else {
    if ( ! isset( $item['user_id'] ) ) return;
    $userinfo = get_userdata( $item['user_id'] );
    printf( '<div class="event-tickets-ticket-purchaser">Phone: %s</div>', sanitize_text_field( $userinfo->billing_phone ) );
    }
    }

    Bear in mind, the phone number will only print in case there is one available for the user.

    Let me know how that works for you.

    Best,
    Victor

    #1344817
    Luke Kenny
    Participant

    Thanks, that worked great!

    #1344844
    Victor
    Member

    Hi Luke!

    I’m glad it worked out for you! Thanks for following up to let us know about it.

    I’ll close this now, but feel free to open a new topic if anything comes up and we’d be happy to help! 🙂

    Cheers,
    Victor

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Add phone number to attendees report’ is closed to new replies.