• Resolved noorapp

    (@noorapp)


    Hello.

    We are having a problem with warning messages showing up on the site when the editing link for the appointment in the email is clicked. The message is repeated multiple times and it reads:

    “Warning: count(): Parameter must be an array or an object that implements Countable” The file it’s referring to is: \plugins\booking.bs.8.1\inc\_ps\personal.php on line 607.

    We are using the latest version of XAMPP with PHP 7.2.1.

    Hopefully you can help to solve this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    Please make this fix.
    Please open this file ../booking.bs.8.1/booking/inc/_ps/personal.php

    ( you can check how to edit files in WordPress menu in this article https://wpbookingcalendar.com/faq/how-edit-file-in-wp-menu/ )

    then find this code:

    
                    if (isset($res))
                        if( (count($res>0)) && (isset($res[0]->id)) && (isset($res[0]->type)) ){
                            return array($res[0]->id, $res[0]->type);
                        }
                }
                return false;
    

    and replace it to this code:

    
                    //FixIn: 8.2.13
                    if ( ( ! empty( $res ) ) &&  ( is_array($res) ) && ( isset( $res[0]->id ) ) && ( isset( $res[0]->type ) ) ){
    					return array($res[0]->id, $res[0]->type);
    				}
    
    

    This fix will be exist in the next update of Booking Calendar.
    Kind Regards.

    Thread Starter noorapp

    (@noorapp)

    Thank you very much!

    Thread Starter noorapp

    (@noorapp)

    We are having an another issue, changing the code gives an error like this and will not show the page at all:

    Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST)

    In the same file at \plugins\booking.bs.8.1\inc\_ps\personal.php on line 2521.

    Should we just wait for the update or is there something we can do?

    Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    Sorry, my mistake. I was provided not full code to replace in previous comment.
    I have missed this

    
                }
                return false;
    

    Here is full NEW code for previous comment to replace:

    
                    //FixIn: 8.2.13
                    if ( ( ! empty( $res ) ) &&  ( is_array($res) ) && ( isset( $res[0]->id ) ) && ( isset( $res[0]->type ) ) ){
    					return array($res[0]->id, $res[0]->type);
    				}
                }
                return false;
    

    so function have too look like this:

    
        // Get booking ID and type by booking HASH    // Edit exist booking - get ID of this booking
        function get_hash_to_id($blank, $booking_hash){
    
                if ($booking_hash != '') {
                    global $wpdb;
                    $sql = $wpdb->prepare( "SELECT booking_id as id, booking_type as type FROM {$wpdb->prefix}booking as bk  WHERE  bk.hash = %s", $booking_hash );
                    $res = $wpdb->get_results( $sql );
                    //FixIn: 8.2.13
                    if ( ( ! empty( $res ) ) &&  ( is_array($res) ) && ( isset( $res[0]->id ) ) && ( isset( $res[0]->type ) ) ){
    					return array($res[0]->id, $res[0]->type);
    				}
                }
                return false;
        }
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Editing appointment via email gives a warning’ is closed to new replies.