Suppress booking form user has made booking

WordPress Event Management, Calendars & Registration Forums General Question Suppress booking form user has made booking

This topic contains 3 replies, has 2 voices, and was last updated by  s2dd 10 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5911

    Thanks, Stephen.

    The next mini-challenge I face: my plugin lists a user’s bookings (per your suggestions in the source), and I’ve tweaked it so that it lists each event in a link so that you can click to go to the event page (to remind yourself where it’s taking place, for example).

    Of course, if you click on the link, you’re presented with the event, with the booking form below it, and an advisory saying “you have already made a booking for this event”. I’m looking for a way to suppress the whole booking form if a user has already booked for it. I’ve found eo_user_has_bookings in user-bookings.php, which I guess is the function I need to run to determine whether or not to switch off the booking form – but I can’t see how to turn off the booking form itself. Could you give me a clue, please?

    Thanks as always!

    John

    s2dd
    #5913

    I split this off from http://wp-event-organiser.com/forums/topic/pro-allow-bookees-to-see-their-bookings/ as its an interesting question in its own right.

    You can hook onto init, and conditionally call:

    add_filter( 'eventorganiser_pro_get_option_disable_automatic_form', '__return_true' );
    

    to remove the booking section.

    Stephen Harris
    #5914

    So, scrap that. That needs to be called much earlier than init

    Instead hook onto the template_redirect hook (this is late enough, but not too late). And using eo_user_has_bookings( $user_id, get_the_ID()) you can call

    remove_filter( 'the_content', 'eventorganiser_display_booking_table', 999 );
    

    In a 2.1.1 you can use the above method instead (which would be preferable).

    Stephen Harris
    #5916

    Brilliant – that works a treat. Thank you!

    s2dd
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.