Home › Forums › Ticket Products › Event Tickets Plus › Need Methods for Tribe__Tickets__RSVP
- This topic has 5 replies, 2 voices, and was last updated 7 years, 8 months ago by
Lee.
-
AuthorPosts
-
July 31, 2018 at 5:52 am #1586570
Lee
ParticipantI’m trying to finish the request on this thread – https://theeventscalendar.com/support/forums/topic/cancel-rsvp/
I found the code here very helpful – https://theeventscalendar.com/support/forums/topic/get-ticket-ids/#post-1166179
I don’t want to get the ticket ids though, I would like to get either the ticket number or security code. Is there a list of methods (I think I’m using that term correctly) to produce that instead of “get_ticket_ids”?
Thanks for the help.
August 1, 2018 at 10:54 am #1587864Sky
KeymasterHi there,
Thanks for reaching out. I will try to help with this if I can. Keep in mind that we are a bit limited in how much support we can provide for customizations such as this.
To see what methods would be available within the Tribe__Tickets__RSVP object, you can take a look at the following source files:
event-tickets/src/Tribe/RSVP.php
and
event-tickets/src/Tribe/Tickets.php
Basically, any function inside those classes designated “public” would be able to be referenced from the object.
However, I don’t see anything that will return the security code, as it is something that is associated with the Attendee rather than the ticket itself.
You may be able to use the ticket id to get all of the attendees for the ticket, then loop through the attendees and grab the security code from the ones you need.
Let me know if that helps, or if you have additional questions.
Thanks,
SkyAugust 2, 2018 at 6:37 am #1588485Lee
ParticipantThanks Sky,
Real quick … are the ids referencing a post type? What resources do you have that show me how to pull information from an RSVP given the id?Thanks.
August 2, 2018 at 9:30 am #1588712Sky
KeymasterHi again,
Yes, the ids reference the post ID for the RSVP/Ticket post type.
I’m not aware of anything that breaks this down in our documentation, but you can look specifically at the “get_ticket” method in the RSVP.php file I referenced above.
public function get_ticket( $event_id, $ticket_id ) {
$product = get_post( $ticket_id );if ( ! $product ) {
return null;
}$return = new Tribe__Tickets__Ticket_Object();
$qty = (int) get_post_meta( $ticket_id, 'total_sales', true );
$global_stock_mode = get_post_meta( $ticket_id, Tribe__Tickets__Global_Stock::TICKET_STOCK_MODE, true );$return->description = $product->post_excerpt;
$return->ID = $ticket_id;
$return->name = $product->post_title;
$return->price = get_post_meta( $ticket_id, '_price', true );
$return->provider_class = get_class( $this );
$return->admin_link = '';
$return->report_link = '';
$return->show_description = $return->show_description();$start_date = get_post_meta( $ticket_id, '_ticket_start_date', true );
$end_date = get_post_meta( $ticket_id, '_ticket_end_date', true );if ( ! empty( $start_date ) ) {
$start_date_unix = strtotime( $start_date );
$return->start_date = Tribe__Date_Utils::date_only( $start_date_unix, true );
$return->start_time = Tribe__Date_Utils::time_only( $start_date_unix );
}if ( ! empty( $end_date ) ) {
$end_date_unix = strtotime( $end_date );
$return->end_date = Tribe__Date_Utils::date_only( $end_date_unix, true );
$return->end_time = Tribe__Date_Utils::time_only( $end_date_unix );
}$return->manage_stock( 'yes' === get_post_meta( $ticket_id, '_manage_stock', true ) );
$return->global_stock_mode = ( Tribe__Tickets__Global_Stock::OWN_STOCK_MODE === $global_stock_mode ) ? Tribe__Tickets__Global_Stock::OWN_STOCK_MODE : '';$return->stock( (int) get_post_meta( $ticket_id, '_stock', true ) );
$return->qty_sold( $qty );
$return->capacity = tribe_tickets_get_capacity( $ticket_id );return $return;
}
To explore what is available in this object further, you can print_r() the return from a particular ticket using Tribe__Tickets__RSVP::get_ticket().
Hope that helps!
Thanks,
SkyAugust 2, 2018 at 11:41 am #1588910Lee
ParticipantThanks for this! Hopefully that will be what I need. Otherwise, I may hit you up again. =)
Cheers
August 3, 2018 at 8:12 am #1589575Sky
KeymasterHello,
You’re very welcome!
Take care,
SkyAugust 25, 2018 at 9:35 am #1605759Support 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 -
AuthorPosts
- The topic ‘Need Methods for Tribe__Tickets__RSVP’ is closed to new replies.
