How to display available spaces in current time slot

I have a 10 minutes time slot (capacity is set to 4 - 4 users can reserve visit in one slot). How can i display left space for each time slot?

  • Rupok
    • Support Ninja

    Hi Krzysztof Urbanowicz

    I hope you had a wonderful day.

    Yes, you can show scheduled user names for unavailable appointment schedule segments. For doing that, go to your WordPress "Dashboard > Appointments > Settings > Add-ons (Tab)" and activate "Show Scheduled Users" add-on. It will shows scheduled user names for unavailable appointment schedule segments.

    Have a nice day. Cheers!
    Rupok

  • Kasia Swiderska
    • Support nomad

    Hello Krzysztof,

    This would require custom coding, as this is not in option of the plugin to show on free slots names of users that made appointments.

    Add-on that Rupok showed is exactly this one that was described on features list

    Show Scheduled Users - Shows scheduled user names for unavailable appointment schedule segments.

    Please tell me what method for increasing capacity of slot are you using? Dummy provider or by function from the FAQ section?
    I'll will ask developer if writing that function for you is something we can do ( https://premium.wpmudev.org/manuals/using-wpmu-dev/support-vs-custom-development/ )

    kind regards,
    Kasia

  • Ash
    • WordPress Hacker

    Hello Krzysztof

    This is not possible without editing the plugin. You have to edit the plugin.

    Please go to /wp-content/plugins/appointments/appointments.php line no 1815 to 1818 and replace the following:

    $ret .= '<div class=&quot;app_timetable_cell app_timetable_cell-' . date( 'H-i', $row['ccs'] ) . '  '.$row['class'].'&quot; title=&quot;'.esc_attr($row['title']).'&quot;>'.
    			        $row['hours']. '<input type=&quot;hidden&quot; class=&quot;appointments_take_appointment&quot; value=&quot;' . $this->pack( $row['ccs'], $row['cce'] ) . '&quot; />';
    
    			$ret .= '</div>';

    with

    global $wpdb;
                            $app_date_user = date( 'Y-m-d H:i:s', $row['ccs'] );
                            $app_sql = $wpdb->prepare(
                                        &quot;SELECT * FROM {$wpdb->prefix}app_appointments where start='%s'&quot;,
                                        $app_date_user
                                    );
                            $app_query = $wpdb->get_results( $app_sql );
                            if( count( $app_query ) > 0 ) {
                                $app_cell_user = new WP_User( $app_query[0]->user );
                                $app_cell_data = $app_cell_user->user_login;
                            }else{
                                $app_cell_data = $row['hours'];
                            }
    
    			$ret .= '<div class=&quot;app_timetable_cell app_timetable_cell-' . date( 'H-i', $row['ccs'] ) . '  '.$row['class'].'&quot; title=&quot;'.esc_attr($row['title']).'&quot;>'.
    			        $app_cell_data. '<input type=&quot;hidden&quot; class=&quot;appointments_take_appointment&quot; value=&quot;' . $this->pack( $row['ccs'], $row['cce'] ) . '&quot; />';
    
    			$ret .= '</div>';

    It will look like the screenshot.

    Please note that, this changes will be lost in next update. So it's worth to note down this changes somewhere and apply again after your updates.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.