Manually confirm free bookings

This topic contains 6 replies, has 3 voices, and was last updated by  Stephen Harris 4 days, 19 hours ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17462

    Hi Stephen,

    Just bought the plugin and must say that I really like it! One thing I’m not able to figure out though, is how I can prevent the free (€0) bookings to automatically confirm. I want to be able to confirm that someone is allowed to attend.

    Is this a setting in the UI I overlooked? Or do you have any ideas on how this can be done using code?

    — Laurent

    Laurent van Dommelen
    #17477

    Hi Laurent,

    Glad you like the plug-in! There’s no UI setting you’ve over-looked, that’s just default behaviour.

    You can change that with the following snippet:

    add_action( 'eventorganiser_pre_gateway_booking', 'my_dont_autoconfirm_free_bookings', 9999 );
    function my_dont_autoconfirm_free_bookings( $booking_id ){
    
        $total_price = eo_get_booking_meta( $booking_id, 'booking_amount' );
        if ( 0 == $total_price ) {
    
            //Redirect to 'thank you page' - you can change $redirect_id as required here:
            $redirect_id = (int) eventorganiser_pro_get_option( 'booking_redirect' );
            $redirect = get_permalink( $redirect_id );
    
            wp_redirect( esc_url_raw( $redirect ) );
            exit();
        }
    
    }
    

    (that should go in a site utility plug-in: http://wp-event-organiser.com/blog/tutorial/where-should-i-put-code-from-the-tutorials/)

    Stephen Harris
    #17486

    Thank you sir, so quick, so accurate. Perfect! Keep up the good work.

    Laurent van Dommelen
    #28297

    Hi Stephen,

    the code snippet works not proper in my situation.
    It is placed in a site utility plugin and activated.
    After the activation i get a blank page after submitting a booking request.

    I would like to redircet the user to the event page.

    I hope you can help me! Thanks!

    Tobias
    #28321

    Hi Tobias,

    Sounds like there’s some sort of fatal error. What do your error logs say? (Or turn on WP_DEBUG, and it should print it to the screen).

    Stephen Harris
    #28347

    Hi Stephen,

    I enabled the WP_DEBUG, but no error log are created. I get an empty html responste with an emty body tag. Is there something I need to change for the redirect_id?

        $redirect_id = (int) eventorganiser_pro_get_option( 'booking_redirect' );
        $redirect = get_permalink( $redirect_id );
    
        wp_redirect( esc_url_raw( $redirect ) );
        exit();
    
    Tobias
    #28408

    Assuming $redirect_id is the ID of a page/post, then I don’t see anything wrong with that. What you’ve posted is fine, so I can’t really advise on why you’re getting a white screen.

    Stephen Harris
Viewing 7 posts - 1 through 7 (of 7 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.