Support » Plugin: Five Star Restaurant Reservations » Let the booking manager book more guests than configured

  • Resolved mumbomedia

    (@mumbomedia)


    Our client has ask if he could make bookings for more guests in the backend as configured.
    Actually the limit is 14 guests.
    But if there is a guest who wants to come with a party above this limit, the restaurant couldn’t book it.

    Is there a way to limit the party size only for frontend?

    I could alter your plugin directly, but that’s not the way I want to do it.

    Maybe I could do it via a filter.

    I have change the whole frontend using a self developed plugin.

    See https://wordpress.org/support/topic/change-date-and-timepicker-to-jquery-ui/

    Kind regards

    mumbomedia

Viewing 7 replies - 1 through 7 (of 7 total)
  • I figure it out by myself.

    I add an action to to the “rtb_validate_booking_submission”-action-hook.

    On this hook I check if the request is coming from the admin site and if so I’m searching for the field party. If I found it, I will unset it, because the validation error occurs as result of an wanted overbooking and therefore it isn’t an error which should prevent the booking from being saved.

    That the code I used to archieve it in my plugin:

    add_action( ‘rtb_validate_booking_submission’, ‘mjm_validate_admin_fields’, 100);
    function mjm_validate_admin_fields($booking){
    // Only validate in the admin
    if ( !$_POST[‘action’] || $_POST[‘action’] !== ‘admin_booking_request’ ) {
    return;
    }
    if(is_array($booking->validation_errors) && count($booking->validation_errors) > 0){
    for($i=0; $i < count($booking>validation_errors); $i++){
    if($booking->validation_errors[$i][‘field’] == ‘party’){
    unset($booking->validation_errors[$i]);
    }
    }
    }
    return;
    }

    The optional parameter $priority is set to 100, so other functions will be called first.

    @see https://developer.wordpress.org/reference/functions/add_action/

    Feel free to use it on your own without any guarantee.

    Kind regards

    mumbomedia

    Excellent! That’s how I’d recommend doing it. Thanks for reporting back.

    Wrap that up into a little plugin to make sure it will work whenever the client switches or updates their theme.

    @natewr

    You’re right.
    I’ve forgot to mentioned it.
    For me I have add this functionality to my existing plugin.

    Hello NateWr & mumbomedia,
    Glad I found this but I’m not really sure where to add it. Can you confirm if I need to add this on the AdminBookings.class file inside the public function validate_admin_fields( $booking ) {} function?
    Hoping to hear from any of the two of you soon.
    Thank you,
    Benessa

    • This reply was modified 2 years, 3 months ago by  benzdumol.

    Hi @benzdumol,

    I rolled this into a little snippet you can use a separate plugin:

    https://gist.github.com/NateWr/d24f690c90bc6468b3063bc26607ce4f

    To use it, click the Download button at the top, unpack the .zip, and upload the .php file to your /wp-content/plugins/ directory. You can then activate it from the Plugins list in your WordPress admin area.

    Hi @benzdumol,

    sorry for the late reply.
    I also would recommend using a plugin.
    You could install NateWr plugin from the post above simply by upload it via the WP Backend.
    @see http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/

    If you have any question feel free to ask.

    Kind regards

    mumbomedia

    Hi @mumbomedia,

    Thank you for your response. I already used @natewr‘s Allow Admin Override of Party Limits for Restaurant Reservations plugin so that the Admin user can book without party size limitation. However, I have another question and it’s about Max Capacity for for Every Location. I already started a thread here: https://wordpress.org/support/topic/max-capacity-for-restaurant-reservations-for-every-location/. It will be very helpful for me if you can check it and if you have an answer it will solve my problem.

    Thank you so much Mumbomedia,
    Benessa

    • This reply was modified 2 years, 3 months ago by  benzdumol.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Let the booking manager book more guests than configured’ is closed to new replies.