Home › Forums › Calendar Products › Community Events › Add phone number to attendees report
- This topic has 6 replies, 2 voices, and was last updated 8 years, 7 months ago by
Luke Kenny.
-
AuthorPosts
-
August 31, 2017 at 1:03 am #1342936
Luke Kenny
ParticipantHi,
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?
September 1, 2017 at 12:05 pm #1343876Victor
MemberHi 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,
VictorSeptember 3, 2017 at 5:34 am #1344267Luke Kenny
ParticipantAh, 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.)
September 4, 2017 at 6:31 am #1344441Victor
MemberHi 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,
VictorSeptember 5, 2017 at 7:02 am #1344817Luke Kenny
ParticipantThanks, that worked great!
September 5, 2017 at 8:00 am #1344844Victor
MemberHi 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 -
AuthorPosts
- The topic ‘Add phone number to attendees report’ is closed to new replies.
