Moving the "You have xx ticket" block (for logged in user)

Home Forums Ticket Products Event Tickets Plus Moving the "You have xx ticket" block (for logged in user)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1215347
    Chris
    Participant

    On the Single Event page, if the user is logged in and has previously purchased one or more tickets for that event, a block appears at the bottom indicating “You have xx Ticket for this Event. View your tickets [link]”

    The article at https://theeventscalendar.com/knowledgebase/moving-rsvp-ticket-forms/ was very helpful in moving the ticket selection / order block to above the content.

    What would be a similar code snippet or the classes needed to move the above described block to the top of the page?

    Reason – serves as a reminder to the user that they already have tickets and do not need to register/purchase (unless they want more seats).

    #1215622
    Cliff
    Member

    Hi, Chris.

    Thanks for your detailed question.

    I expect the “You already have tickets” sort of message is right above the “Buy tickets” form for the reason you stated — so hopefully they see it when at the Tickets section of the single events page.

    You might simply add some more “vibrant” styling to make it stand out. For example:

    body.single-tribe_events .tribe-link-tickets-message {
    border: 5px solid red;
    }

    Looks like this: https://cl.ly/0x2l130H3k0T

    Please let me know what you think of this.

    #1216011
    Chris
    Participant

    Thank you for the response.

    I have already moved the RSVP and Tickets blocks to a position above the Event description/content (as per the above-linked instructions), however the “You already have tickets” message is still at the very end of the page, so it is apparently a separate code block and not a part of the RSVP/Tickets block.

    The red border is a great idea, but I still need to get the block to a more accessible/visible position.

    Some sort of page templating system that would allow a custom page layout to be built using shortcodes to place each element on the page where desired (or to leave it off) would be a great system. For now I’ve no problem using functions to accomplish the same thing, if I can find out the right classes/code to use.

    #1216905
    Cliff
    Member

    I dug in ET+’s code and found it hooks to tribe_events_single_event_after_the_meta on priority 4, from Line 36 of /wp-content/plugins/event-tickets-plus/src/Tribe/Attendees_List.php

    You could reference remove_action() and then hook it where you prefer it to be.

    Please let me know if you have any follow-up questions on this topic.

    #1217088
    Chris
    Participant

    Hmmm … I see that since I originally modified my functions.php code to implement moving the RSVP or Tickets block, that in v4.4 the ability to do that has been kindly provided for in the plugin Settings (Events –> Settings –> Tickets tab), however this does not include the “You have tickets” notice still located at the bottom of the page (for a logged-in user who has previously purchased tickets or RSVP’d for the single event being viewed).

    The reference to the “tribe_events_single_event_after_the_meta on priority 4” doesn’t fully provide the solution (at least for me without that level of coding knowledge or skill).

    I guess what I am looking for is a complete snippet that could be added to the functions to move that notice block to the top of the page, something like this (which was the code previously offered to move the RSVP/Tickets block before it was most recently added as a Setting):

    if ( class_exists( 'Tribe__Tickets__RSVP' ) ) {
    // Remove the form from its default location (after the meta).
    remove_action( 'tribe_events_single_event_after_the_meta', array( Tribe__Tickets__RSVP::get_instance(), 'front_end_tickets_form' ), 5 );
    }
    if ( class_exists( 'Tribe__Tickets__RSVP' ) ) {
    // Add the form to its new location (before the content).
    add_action( 'tribe_events_single_event_before_the_content', array( Tribe__Tickets__RSVP::get_instance(), 'front_end_tickets_form' ), 10 );
    }
    if ( class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
    // Remove the form from its default location (after the meta).
    remove_action( 'tribe_events_single_event_after_the_meta', array( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'front_end_tickets_form' ), 5 );
    }
    if ( class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) {
    // Place the form in the new location (before the content).
    add_action( 'tribe_events_single_event_before_the_content', array( Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(), 'front_end_tickets_form' ), 10 );
    }
    • This reply was modified 9 years, 4 months ago by Chris.
    #1218431
    Cliff
    Member

    Please let me know how this goes for you:

    https://gist.github.com/cliffordp/f95b520a71635fd4e9d73eb2af73bd5e

    #1218783
    Chris
    Participant

    Excellent! That code did the trick, moving the “You’ve got tickets” block to a position above the event description (and below the Buy Tickets block, which I’d already relocated via the configuration settings) – enabling a logged-in user to see whether they had already purchased a ticket/s for the event.

    Elegant solution!

    I was able to use the My Custom Functions plugin by Arthur Gareginyan to apply the function, to isolate it from theme updates.

    #1219096
    Cliff
    Member

    Very good to hear. Thanks for sharing your setup.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Moving the "You have xx ticket" block (for logged in user)’ is closed to new replies.