• Resolved eclev91

    (@eclev91)


    Both tribe_tickets_commerce_tickets_form_hook and tribe_tickets_rsvp_tickets_form_hook seem to be fired too early to be filtered from a theme’s functions file.

    I could probably do it in a plugin, but because it relates to templating, it feels like it belongs in the theme.

    To reproduce:

    • Copy single-event.php to your theme for customization
    • Configure tickets for an event
    • View the event. Ticket should appear after meta (or wherever you have set it to appear)
    • Add do_action('foobar'); right after the_post() in the new single-event template
    • Add `add_filter( ‘tribe_tickets_rsvp_tickets_form_hook’, function ( $hook ) {
      die(‘filtered’);
      return ‘foobar’;
      });` to your functions.php file.
    • View event again

    Expected: “filtered” is printed and page dies where ticket form is to be expected.
    Actual: Ticket form is unaffected.

    Thoughts?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey there !

    Thanks for reaching out.

    Thanks for the note! We’re not sure we agree that it makes sense to be able to use this filter from a theme’s functions.php file, but we’d love to learn more about what you’re trying to do with it. Can you give a summary of the sort of change you are trying to make?

    Take care,
    Ed ??

    Hi Ed,
    For example if you want to move the tickets form out of the single post view it would be nice to do it properly by running the necessary action.

    Additionally this is the hook description in source code

    setting this filter allows developers to override the general setting in particular cases.

    Barry

    (@barryhughes-1)

    Gotcha!

    In that case, I think you’re looking at the wrong hooks (which is why we were curious about what you were trying to achieve).

    Please note that assistance with custom dev tasks is not generally something we can provide here in the free support forums – but it’s certainly possible to remove the RSVP ticket form from single posts and events and you can do so via your theme’s functions.php file.

    This snippet assumes a number of things that may not be true in the context of your own site – and so may need some adjustment – but gives the general idea. Hopefully that helps ??

    Thread Starter eclev91

    (@eclev91)

    That snippet would certainly work. My goal is to attach the ticket form to a different hook, so I’d then re-attach maybe_add_front_end_tickets_form to a different action. But it’s certainly more verbose. What’s the use case for the filter originally in question, then, if not to do this in one fell swoop?

    Barry

    (@barryhughes-1)

    It’s possible to set the location of the ticket form from our settings screen, the filters you originally referenced allow developers to override those settings.

    Hey there,

    Since this thread has been inactive for a while, I’m going to go ahead and mark it as resolved. Don’t hesitate to create a new thread any time you help again!

    Ed ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom ticket form hook fires too early’ is closed to new replies.