# booktics/1.0.28/core/appointment/appointment-hooks.php

Booktics – Appointment Booking Calendar for Service Businesses, version 1.0.28. 52 lines.

- Page: https://pluginprobe.com/plugins/booktics/1.0.28/code/core/appointment/appointment-hooks.php
- Raw: https://pluginprobe.com/plugins/booktics/1.0.28/raw/core/appointment/appointment-hooks.php
- Modified: 2026-10-05T09:02:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/booktics/1.0.28/code/core/appointment/appointment-hooks.php#L10-L20`.

```php
<?php

namespace Booktics\Appointment;

if ( ! defined( 'ABSPATH' ) ) exit;

use Booktics\Contracts\Hookable_Service_Contract;

class Appointment_Hooks implements Hookable_Service_Contract {

    /**
     * Register the appointment hooks.
     *
     * @return void
     */
    public function register() {
        add_filter( 'booktics_appointment_args', array(
            $this,
            'booktics_appointment_args'
        ) );
    }

    /**
     * Filter appointment arguments based on the current user's role.
     *
     * @param array $args The appointment arguments.
     *
     * @return array The filtered appointment arguments.
     */
    public function booktics_appointment_args( $args ) {
        $current_user = wp_get_current_user();
        $roles        = $current_user->roles;

        if ( in_array( 'administrator', $roles, true ) ) {
            return $args;
        }

        if ( in_array( 'booktics_team_member', $roles, true ) ) {
            if ( ! isset( $args['meta_query'] ) ) {
                // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering team members by meta fields
                $args['meta_query'] = [];
            }
            $args['meta_query'][] = array(
                'key'     => 'team_member_id',
                'value'   => $current_user->ID,
                'compare' => '=',
            );
        }

        return $args;
    }
}
```
