Booking form error

This topic contains 5 replies, has 2 voices, and was last updated by  Stephen Harris 8 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #25367

    Hi
    I am getting a PHP warning if the “Terms and Conditions” checkbox is not selected when making a booking. It is set to required.
    The warning is “Warning: trim() expects parameter 1 to be string, array given in /home/pivotnetballcom/public_html/wp-includes/query.php on line 1609”.
    The booking is not completed and you are returned to a blank booking form page.
    Regards
    Daniel

    Daniel Cooksey
    #25374

    What version of WordPress are you using? Are you able to link to the form in question?

    Stephen Harris
    #25379
    Daniel Cooksey
    #25382

    Hi Daniel,

    The booking form uses the 'name' query variable to store the bookee’s name. The values entered will populate $_POST['name']. The error you see refers to this line: https://github.com/WordPress/WordPress/blob/4.6/wp-includes/query.php#L1609 – WordPress is trying to trim the 'name' query variable – which it expects to be string, but isn’t.

    My guess is that it’s an array, and that $_POST['name'], populated by the booking form, is being passed to a WP_Query instance. This doesn’t happen by default, so you presumably have a plug-in that’s causing this.

    If you can identify that plug-in then it maybe possible to workaround the issue. I suspect it’s a bug in another plugin, because I can’t see a reason why you would want to blindly pass $_POST to WP_Query instance.

    It doesn’t seem that the terms and conditions element has any bearing on the bug. I suspect, if the booking is successful then the user is redirect to PayPal before the bug is reached – and not checking the terms and conditions was just one way of preventing the booking from being successful.

    Stephen Harris
    #25411

    Thanks, it seems to have something to do with the fact I have the booking form on a separate page.

    I tried disabling plugins one at a time, no result.

    Switching from the Sports theme I am using to 2016 fixed the problem

    But , while using the Sports theme the error no longer appears if I disable the extra code to move the booking form to a separate page.

    I followed the instructions in this post to use a separate booking page –

    https://wp-event-organiser.com/forums/topic/separate-booking-page/.

    I made one change though. In event-meta-event-single.php<br />
    [page-url]/?event_id[event-ID]
    didn’t work so I changed it to [page-url]/?event_id=<php echo (get_the_ID))?>

    So the Sports theme obviously has something to do with it but do you think there is a workaround to get the booking form on a separate page without causing the error?

    Daniel Cooksey
    #25429

    Can you provide a link to the theme’s source code? If not, could you get in touch via this contact form and I’ll have you e-mail it over.

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