Access Value of a fieldsets

Home Forums Ticket Products Event Tickets Plus Access Value of a fieldsets

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1419872
    Uwe Matern
    Participant

    Hello from Germany,

    we use event tickets and event tickets plus.
    We also operate with fieldsets assigned to our tickets in order to access more detailed data of an attendee.

    So the question is: Is there an option to access/query a certail value of a fieldset via php, e.g. a field labeled “full name”.

    Best regards
    Uwe

    #1420999
    Crisoforo
    Keymaster

    Hey!

    Thanks for reaching out to our forusms, I’m not sure if you mean Custom Field when you say Fieldset, if so you can use the function called:

    tribe_get_custom_field

    Which accepts the label and the ID of the event you want to access a value, you can take another look at the documentation page of this function as well.

    Please let me know if you have any other questions about this issue or if there’s anything else I can do for you.

    Thanks,
    Crisoforo

    #1421065
    Uwe Matern
    Participant

    Good Morning Crisoforo,

    no, I don’t mean Custom field.
    I’m talking about additional information assigned to a ticket. In tribe ticket plus there is the option to gather additional attendee information via so called fieldsets, e.g. the full name of an attendee. So the request is to access the values of fieldset by using php or a tribe function.

    Best regards
    Uwe

    #1421401
    Crisoforo
    Keymaster

    Thanks for clarify this. Fieldsets are stored as a regular post types inside of WordPress so you can use native functions from WordPress to query on post types such as WP_Query or get_posts.  For example to get all the fieldsets you can use something like:

    $templates = get_posts( array(
     'post_type' => 'ticket-meta-fieldset',
     'orderby' => 'title',
     'order' => 'ASC',
     'posts_per_page' => -1,
     ) );

    You can use any of the functions mentioned above to have a more narrow search and filters as well, let me know if you have more questions about this or if there is anything else I can do for you.

    Thanks,
    Crisoforo

    #1421519
    Uwe Matern
    Participant

    This reply is private.

    #1421525
    Uwe Matern
    Participant

    This reply is private.

    • This reply was modified 6 years, 3 months ago by Uwe Matern.
    #1422594
    Crisoforo
    Keymaster

    This reply is private.

    #1429740
    Uwe Matern
    Participant

    This reply is private.

    #1435275
    Barry
    Member

    Hi Uwe,

    Sorry for the delay!

    In outline, an approach like this should work for you:

    $attendee_id = $ticket['qr_ticket_id'];
    $field_slug  = 'postal-code';
    
    $fields = (array) get_post_meta( $attendee_id, Tribe__Tickets_Plus__Meta::META_KEY, true );
    
    if ( isset( $fields[ $field_slug ] ) ) {
        echo $fields[ $field_slug ];
    }
    

    You might of course need to adjust various components to match your specific needs. Does that help at all?

    #1435685
    Uwe Matern
    Participant

    Hi Barry,

    this is absolutely great! It works perfect. Many thanks.

    Best regards
    Uwe

    #1455364
    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 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Access Value of a fieldsets’ is closed to new replies.