English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Site Pages  >  Service Details  >  Build Employees Query

apply_filters_ref_array( 'vikappointments_build_service_search_employees_query', bool $status, mixed &$queryobject $servicearray $options )

Fires while loading the employees assigned to the service to display.


Description

Trigger hook to manipulate at runtime the query used to load the employees available for the service to display under the Service Details page in the front-end.

Third party plugins can extend the query by applying further conditions or selecting additional data.


Parameters

$status

(bool)  True on success, false otherwise.

&$query

(mixed)  Either a query builder object or a plain string.

$service

(object)  The object holding the details of the service to display.

$options

(array)  An array of options.

  • id_service - the ID of the service to load;
  • id_employee - the ID of the employee assigned to the specified service.

Example

The example below always excludes the employee with ID #5.

/**
 * Trigger hook to manipulate the query at runtime. Third party plugins
 * can extend the query by applying further conditions or selecting
 * additional data.
 *
 * @param  bool    $status   True on success, false otherwise.
 * @param  mixed   &$query   Either a query builder or a query string.
 * @param  object  $service  The service details.
 * @param  array   $options  An array of options.
 */
add_filter('vikappointments_build_service_search_employees_query', function($status, &$query, $service, $options)
{
    $query->where("`e`.`id` <> 5");

    return true;
}, 10, 4);

Changelog

Version Description
1.2.12 Introduced.
Last Update: 2024-05-14
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information