Hooks und Filter
Die Hooks des Plugins (baza_bc_* und bbc_*) funktionieren nur in den Tarifen, die in der Tariftabelle die Zeile PHP hooks haben. Im Tarif Free entfernt das Plugin den Code, den ein Theme oder ein anderes Plugin daran angehängt hat, deshalb tun Ihre Filter und Actions dort nichts.
E-Mail-Adresse des Administrators ändern
/**
* FILTER: baza_bc_admin_email
* Description: Sets the administrator email address that is shown on the payment result page. It is called once, in the code of that page, and does not change the address that notifications are sent to.
* Params: $mail string - empty by default
*/
add_filter( 'baza_bc_admin_email', function( $mail ) {
$mail = 'no-reply@bazadevelopers.com';
return $mail;
}, 15, 1 );Kontrollkästchen „Anzahlung leisten“
/**
* FILTER: baza_bc_set_partial_payment_checked
* Description: Controls whether the partial payment ("Make a deposit" / 50% vs 100% payment) checkbox is checked by default on the checkout form.
* Params: $state bool
* Default value: taken from the setting "partial_payment_checked_default" (off unless it is switched on); the filter overrides the setting.
*/
add_filter( 'baza_bc_set_partial_payment_checked', function( $state ) {
$state = true;
return $state;
} );Verschiebt den Zeitplan einer bestimmten Dienstleistung
/**
* FILTER: baza_bc_by_minutes_shift_in_service_schedule
* Description: Shifts the schedule of a specific service by a given number of minutes in the calendar. Works correctly with full-hour slots as well as split slots. Does not change the service schedule in the admin panel.
* Params: $minutes int - number of minutes, $service_id int - ID of the selected service
*/
add_filter( 'baza_bc_by_minutes_shift_in_service_schedule', 'shift_the_working_day', 99, 2 );
function shift_the_working_day( $minutes, $service_id ) {
if( 36 == $service_id ) {
$minutes = 15;
}
return $minutes;
}Legt das minimale Zeitintervall (in Sekunden) fest
/**
* FILTER: baza_bc_minimum_time_to_enable_slots
* Description: Sets the minimum time interval (in seconds) from "now" to the nearest available booking slot.
* Params: $seconds int - number of seconds
* Default value: the setting "minimum time before booking" (minutes) converted to seconds; 0 when the setting is empty. The filter overrides it.
*/
add_filter( 'baza_bc_minimum_time_to_enable_slots', function( $seconds ) {
$seconds = 1*60*60;
return $seconds;
}, 10, 1 );Kalender-Navigationsschaltflächen anpassen
Mit diesem Filter können Sie die Darstellung der Kalendernavigationsschaltflächen anpassen oder ändern. Verwenden Sie ihn, um benutzerdefinierte Rahmen, Kopfzeilen oder zusätzliche Inhalte um die Navigationsschaltflächen herum einzufügen. Funktioniert nahtlos mit AJAX-Kalenderaktualisierungen.
/**
* FILTER: baza_bc_calendar_navigate_buttons
*
* Warning: the value that first arrives in this filter is a Unix timestamp (int), not an array. The plugin's own handler
* (baza_bc_print_calendar_navigate_buttons, priority 10) turns it into the array of buttons. Use a priority
* higher than 10, as in the example below. With a lower priority your function receives the int.
* The Day picker module (priority 99) can remove the navigation completely.
*/
// Custom BBC header
add_filter( 'baza_bc_calendar_navigate_buttons', function( $html ) {
array_unshift( $html, [
'selector' => 'h3',
'classes' => [ 'calendar-header-title' => true ],
'content' => __( 'Select Your Time', 'bazadev' ) .
'<span>' . __( 'Discounts apply for bookings of 3 hours or more.', 'bazadev' ) . '</span>',
]);
return [
[
'selector' => 'div',
'classes' => [ 'calendar-buttons-wrapper' => true ],
'children' => $html,
]
];
}, 10, 1 );
// Custom BBC button text
add_filter( 'baza_bc_calendar_button_prev_text', function( $text ) {
return '<span class="button-text">' . __( 'Previous', 'bazadev' ) . '</span>';
});
// Custom BBC button text
add_filter( 'baza_bc_calendar_button_next_text', function( $text ) {
return '<span class="button-text">' . __( 'Next', 'bazadev' ) . '</span>';
});Filter zur Anpassung von Kalendern und Formularen
/**
* BBC Calendar and Form Filters Documentation
*/
// Add content before the entire form
add_filter( 'baza_bc_outside_before_form', function( $content ) {
// $content is an empty array by default, so assign a string here, do not append with .=
$content = '<div class="booking-promo-banner">
<h2>Special Offer: 20% Off This Week!</h2>
</div>';
return $content;
});
// Replace content after the entire form
add_filter( 'baza_bc_outside_after_form', function( $content ) {
// $content is an empty array by default, so return a string here
$content = '<div class="booking-promo-banner">
<h2>Special Offer: 20% Off This Week!</h2>
</div>';
return $content;
});
// Add content before the booking form block
add_filter( 'baza_bc_before_booking_form', function( $content ) {
// $content is an empty array by default, so assign a string here, do not append with .=
$content = '<p class="booking-note">Please fill in all required fields carefully.</p>';
return $content;
});
// Add content after the booking form block
add_filter( 'baza_bc_after_booking_form', function( $content ) {
// $content is an empty array by default, so assign a string here, do not append with .=
$content = '<p class="booking-note">Thank you for booking with us!</p>';
return $content;
});
// Add content before the submit button
add_filter( 'baza_bc_before_submit_button', function( $content ) {
$content .= '<p class="submit-note">Make sure all information is correct before submitting.</p>';
return $content;
});
// Add content after the submit button
add_filter( 'baza_bc_after_submit_button', function( $content ) {
$content .= '<p class="submit-note">You will receive a confirmation email shortly after submitting.</p>';
return $content;
});
// Add content inside the form, before main fields
add_filter( 'baza_bc_inside_before_form', function( $content ) {
// $content is an empty array by default, so assign a string here, do not append with .=
$content = '<div class="form-intro">
<p>Please select your preferred time slots below:</p>
</div>';
return $content;
});
// Add content inside the form, after main fields
add_filter( 'baza_bc_inside_after_form', function( $content ) {
// $content is an empty array by default, so assign a string here, do not append with .=
$content = '<div class="form-footer-note">
<p>Need help? Contact our support team for assistance.</p>
</div>';
return $content;
});
// Add content before additional services button
add_filter( 'baza_bc_before_additional_services_button', function( $content ) {
$content .= '<div class="bbc-before-additional-services-button">
<p>Before additional services button text.</p>
</div>';
return $content;
});
// Add content after additional services button
add_filter( 'baza_bc_after_additional_services_button', function( $content ) {
$content .= '<div class="bbc-after-additional-services-button">
<p>After additional services button text.</p>
</div>';
return $content;
});
// Change "Get payment link" text
add_filter( 'baza_bc_form_checkbox_get_payment_url_text', function( $text ) {
return __( 'Send payment link to email', 'your-theme' );
});
// Change "Request invoice" text
add_filter( 'baza_bc_form_checkbox_request_invoice_text', function( $text ) {
return __( 'I need an invoice', 'your-theme' );
});
// Change partial payment text
add_filter( 'baza_bc_form_checkbox_partial_payment_text', function( $text ) {
return __( 'Pay deposit only', 'your-theme' );
});
// Change submit button text
add_filter( 'baza_bc_form_submit_button_text', function( $text ) {
return __( 'Confirm booking', 'your-theme' );
});
// Change accept terms text
add_filter( 'baza_bc_form_accept_terms_text', function( $text ) {
return __( 'I confirm I have read the booking', 'your-theme' );
});
// Change accept terms link text
add_filter( 'baza_bc_form_accept_terms_link_text', function( $text ) {
return __( 'Rules', 'your-theme' );
});
// Change "Include in price" text for additional services
// The value that arrives is the ID of the additional service (int), not the text. Return the string to show.
add_filter( 'baza_bc_additional_service_include_in_price_text', function( $service_id ) {
return __( 'Included in total', 'your-theme' );
});
// Change currency symbol
add_filter( 'baza_bc_get_currency_symbol', function( $symbol ) {
$lang = pll_current_language();
$currencies = [
'af' => 'R',
'sq' => 'L',
'ar' => '﷼',
'hy' => '֏',
'az' => '₼',
'eu' => '€',
'be' => 'Br',
'bs' => 'KM',
'bg' => 'лв',
'ca' => '€',
'zh' => '¥',
'hr' => '€',
'cs' => 'Kč',
'da' => 'kr',
'nl' => '€',
'en' => '$',
'et' => '€',
'fi' => '€',
'fr' => '€',
'ka' => '₾',
'de' => '€',
'el' => '€',
'he' => '₪',
'hi' => '₹',
'hu' => 'Ft',
'is' => 'kr',
'id' => 'Rp',
'it' => '€',
'ja' => '¥',
'kk' => '₸',
'ko' => '₩',
'lv' => '€',
'lt' => '€',
'mk' => 'ден',
'ms' => 'RM',
'mt' => '€',
'nb' => 'kr',
'fa' => '﷼',
'pl' => 'zł',
'pt' => '€',
'ro' => 'lei',
'ru' => '₽',
'sr' => 'din',
'sk' => '€',
'sl' => '€',
'es' => '€',
'sv' => 'kr',
'th' => '฿',
'tr' => '₺',
'ua' => '₴',
'ur' => '₨',
'uz' => 'so\'m',
'vi' => '₫',
];
return $currencies[$lang] ?? $symbol;
});Buchungsfenster und Seitenskripte
Hooks des Buchungsfensters (der Buttons, die den Kalender öffnen) und der Skripte, die auf einer Seite geladen werden.
/**
* FILTER: baza_bc_triggers_position
* Description: Where the booking window opens.
* Params: $position string - 'center', 'left' or 'right'
* Default value: the "window position" setting; 'left' and 'right' are used only with the Weekio theme, otherwise 'center'
*/
add_filter( 'baza_bc_triggers_position', function( $position ) {
return 'right';
});
/**
* FILTER: baza_bc_triggers_close_style
* Description: Where the close button of the booking window is drawn.
* Params: $style string - 'inside' or 'outside'
* Default value: 'inside'
*/
add_filter( 'baza_bc_triggers_close_style', function( $style ) {
return 'outside';
});
/**
* FILTER: baza_bc_triggers_keep_handle
* Description: The booking window brings only its own scripts and styles and those of WordPress. Return true to keep the file of another plugin that the calendar needs.
* Params: $keep bool, $handle string - the handle of the script or style, $src string - its address
* Default value: true for the plugin's own files and for wp-includes, false for the others
*/
add_filter( 'baza_bc_triggers_keep_handle', function( $keep, $handle, $src ) {
return 'my-plugin-script' === $handle ? true : $keep;
}, 10, 3 );
/**
* FILTER: baza_bc_triggers_allow_origin
* Description: Allows another site to draw the booking window (the embed script). The plugin sends the Access-Control-Allow-Origin header with this address.
* Params: $origin string
* Default value: '' (no other site is allowed)
*/
add_filter( 'baza_bc_triggers_allow_origin', function( $origin ) {
return 'https://partner.example.com';
});
/**
* FILTER: baza_bc_page_has_shortcode
* Description: Tells whether the page carries the calendar. Return false for a page that holds the shortcode but shows the booking only in the window: then the calendar scripts are not loaded on the page, and the window brings them itself.
* Params: $has bool, $tags array - the shortcode names that are looked for
* Default value: true when the content of the page holds one of the shortcodes
*/
add_filter( 'baza_bc_page_has_shortcode', function( $has, $tags ) {
return is_page( 'demo' ) ? false : $has;
}, 10, 2 );Dienstleistungsliste und Dienstleistungsseiten
Hooks der Dienstleistungsliste und der Seite, auf die eine Dienstleistungskarte verweist.
/**
* FILTER: baza_bc_services_list_facts
* Description: The short lines (facts) under a service in the services list, such as the address. Add, remove or change lines.
* Params: $facts array of strings, $id int - the service ID, $data array - the data of the service
*/
add_filter( 'baza_bc_services_list_facts', function( $facts, $id, $data ) {
$facts[] = 'Free parking';
return $facts;
}, 10, 3 );
/**
* FILTER: baza_bc_service_page_types
* Description: The post types whose posts can be chosen as the page of a service.
* Params: $types array of post type names
* Default value: all public post types except attachment and elementor_library
*/
/**
* FILTER: baza_bc_service_page_limit
* Description: How many posts of each type are offered in the choice of the service page.
* Params: $limit int
* Default value: 200
*/
/**
* FILTER: baza_bc_service_page_id
* Description: The page that a service card links to. Translation plugins use it to swap the page for its translation.
* Params: $page_id int - the page chosen for the service, $service_id int
*/
add_filter( 'baza_bc_service_page_id', function( $page_id, $service_id ) {
return function_exists( 'pll_get_post' ) ? ( pll_get_post( $page_id ) ?: $page_id ) : $page_id;
}, 10, 2 );Themes
Die Liste der Kalender-Themes.
/**
* FILTER: baza_bc_themes
* Description: The list of the themes that can be chosen for the calendar. The array is keyed by the theme slug; each item has 'title', 'plan', 'css' (the file of the theme or null) and 'vars' (CSS variables).
* Params: $themes array
*/Währungen und Preise
Hooks der Währungsliste und des Preises eines Zeitfensters.
/**
* FILTER: baza_bc_allowed_currencies
* Description: The list of currencies that the plugin knows. The plugin calls it with true, and its own handler returns the array, so add your currency to the array that you get back with a priority higher than 10. Each item has 'code' and 'symbol'.
* Params: $currencies array (true before the plugin's own handler has run)
*/
/**
* FILTER: baza_bc_get_single_slot_price
* Description: The prices of one slot. The plugin reads the 'second_price' key of the result for the second price of the slot.
* Params: $service_data array - the data of the service, $params array - the day and the slot
*/Buchungsstatus und Benachrichtigungen
Actions, die laufen, wenn eine Buchung angelegt wird oder ihren Status ändert, und Filter der Benachrichtigungsmails.
/**
* ACTION: baza_bc_booking_created
* Description: A booking has been created from the booking form.
* Params: $post_id int - the booking, $order_data array
*/
add_action( 'baza_bc_booking_created', function( $post_id, $order_data ) {
// your code
}, 10, 2 );
/**
* ACTION: baza_bc_booking_status_changed
* Description: The status of a booking has changed. It runs after a payment, in the booking panel of the admin, from the client account and from the mobile app API.
* Params: $post_id int, $new_status string, $booking_meta array
*/
add_action( 'baza_bc_booking_status_changed', function( $post_id, $new_status, $booking_meta ) {
if ( 'booked' === $new_status ) {
// your code
}
}, 10, 3 );
/**
* FILTER: baza_bc_should_send_booking_notification
* Description: Return false to stop the notification letter that is sent after a payment changes the status.
* Params: $send bool, $post_id int, $new_status string
* Default value: true
*/
/**
* FILTER: baza_bc_silent_booking_statuses
* Description: The statuses that nobody is told about.
* Params: $statuses array of status names
* Default value: array( 'completed', 'expired' )
*/
/**
* FILTER: baza_bc_email_template_vars
* Description: The variables that are put into the letter template. Add your own.
* Params: $email_vars array, $template_config array, $letter_id string
*/
/**
* FILTER: baza_bc_email_body_html
* Description: The HTML of the body of the letter, before the block that is added for the administrator.
* Params: $html string, $order_status string, $options array, $subject_prefix bool
*/
/**
* FILTER: baza_bc_notification_extra_lines
* Description: Lets you add lines to the text of a notification (the letters, the messengers and the reminders use it).
* Params: $message string, $post_id int - the booking
*/
add_filter( 'baza_bc_notification_extra_lines', function( $message, $post_id ) {
return $message . "\nParking: yard 2";
}, 10, 2 );Kalenderstunden und Formate
Hooks der Arbeitsstunden im Kalender und der Ausgabe von Datum und Uhrzeit.
/**
* FILTER: baza_bc_working_hours
* Description: The hours of the working day of a service. The plugin's own handler (priority 10) returns an array like array( 9 => '9:0', 10 => '10:0' ), shifted by baza_bc_by_minutes_shift_in_service_schedule.
* Params: $start int - the first hour, $end int - the last hour, $service int|false - the service ID
*/
/**
* FILTER: baza_bc_month_range_initial_weeks
* Description: How many weeks the calendar with the month range slider shows when it opens.
* Params: $weeks int
* Default value: 2
*/
/**
* FILTER: baza_bc_date_format
* Description: The printed date.
* Params: $formatted string - the date in the format of the settings, $timestamp int
*/
add_filter( 'baza_bc_date_format', function( $formatted, $timestamp ) {
return date_i18n( 'j F Y', $timestamp );
}, 10, 2 );
/**
* FILTER: baza_bc_time_format
* Description: The printed time. The first parameter is the time that will be printed.
* Params: $time string
*/Kundenkonto
Hooks des Kundenkontos (Modul Auth): Tabs, die Buchungsliste und was ein Kunde ändern darf.
/**
* FILTER: baza_bc_dashboard_tabs
* Description: The tabs of the client account. Each item is keyed by an ID and has 'title', 'url' and 'order'; the tabs are sorted by 'order'. The default tabs are bookings (10), profile (30) and logout.
* Params: $tabs array, $current_tab string
*/
add_filter( 'baza_bc_dashboard_tabs', function( $tabs, $current_tab ) {
$tabs['help'] = array( 'title' => 'Help', 'url' => home_url( '/help/' ), 'order' => 25 );
return $tabs;
}, 10, 2 );
/**
* FILTER: baza_bc_account_bookings_per_page
* Description: How many bookings the list in the account shows on a page.
* Params: $per_page int
* Default value: 10
*/
/**
* FILTER: baza_bc_client_can_edit_booking
* Description: Whether the client may change a booking. By default only a pending or booked booking that is not locked by its date.
* Params: $can bool, $post_id int, $meta array - the booking data, $user_id int
*/
/**
* FILTER: baza_bc_client_can_change_service
* Description: Whether the client may switch a booking to another service.
* Params: $can bool, $post_id int, $user_id int
* Default value: true
*/
/**
* FILTER: baza_bc_client_can_edit_extras
* Description: Whether the client may change the additional services of a booking. By default true when the service has additional services.
* Params: $can bool, $post_id int, $meta array, $user_id int
*/Texte des Formulars und Beschriftungen
Filter, die einen Text ändern. Jeder bekommt den übersetzten Standardtext und gibt den Text zurück, der angezeigt wird.
/**
* FILTERS (string, the default text is passed in):
* baza_bc_form_additional_services_text - the button "Additional services"
* baza_bc_form_deposit_base_text - "Make a deposit"
* baza_bc_form_checkbox_pay_from_balance_text - "Pay from balance (%s)"; %s is the balance
* baza_bc_form_checkbox_split_pay_all_text - "Pay for all parts now"
* baza_bc_calendar_refresh_text - "Refresh calendar"
* baza_bc_booking_confirmed_text - the message after a successful payment
* baza_bc_invoice_pending_text - the message after a request for an invoice
* baza_bc_booking_failed_text - the message when the payment failed
* baza_bc_order_not_found_text - the message when the order is not found
*
* The labels in the booking record and on the payment result page work the same way:
* baza_bc_label_service, baza_bc_label_order_id, baza_bc_label_order_status, baza_bc_label_booking_dates,
* baza_bc_label_total_price, baza_bc_label_total_cost, baza_bc_label_paid, baza_bc_label_to_be_paid,
* baza_bc_label_full_name, baza_bc_label_email, baza_bc_label_phone, baza_bc_label_additional_services,
* baza_bc_label_payment_made, baza_bc_label_request_invoice, baza_bc_label_your_dates, baza_bc_label_order_details
*/
add_filter( 'baza_bc_label_service', function( $label ) {
return __( 'Room', 'your-theme' );
});WooCommerce
Hooks der WooCommerce-Integration.
/**
* FILTER: baza_bc_woocommerce_offline_methods
* Description: The payment gateways where the money is not there when the order is placed.
* Params: $ids array of gateway IDs
* Default value: array( 'bacs', 'cheque', 'cod' )
*/
/**
* FILTER: baza_bc_woocommerce_paid_on_completion
* Description: The gateways whose booking counts as paid only when the order is completed.
* Params: $ids array of gateway IDs
* Default value: array( 'cod' )
*/
/**
* FILTER: baza_bc_woocommerce_send_shop_emails
* Description: Whether the standard WooCommerce emails are sent for an order that holds a booking.
* Params: $send bool, $order WC_Order
* Default value: false
*/Zahlungen
Hooks der Zahlungsprüfungen und der Rückkehrseiten.
/**
* FILTER: baza_bc_payment_recheck_delays
* Description: When the plugin asks the payment gateway again about a payment that is not confirmed. Each item is the number of seconds to wait before that attempt; after the last one the booking is left to the expiry cron.
* Params: $delays array, attempt number => seconds
* Default value: array( 1 => 90, 2 => 300, 3 => 900, 4 => 3600 )
*/
/**
* FILTER: baza_bc_payment_request_cooldown
* Description: The pause, in seconds, before the administrator can send the next payment request for the same booking.
* Params: $seconds int
* Default value: 60
*/
/**
* FILTER: baza_bc_after_payment_pages
* Description: The pages where the client returns after a payment.
* Params: $pages array - 'success' and 'cancel', each an address or null when no page is chosen in the settings
*/
add_filter( 'baza_bc_after_payment_pages', function( $pages ) {
$pages['success'] = home_url( '/thank-you/' );
return $pages;
});Tabs im Adminbereich
Hooks, die Tabs zu den Einstellungen und zum Integrationsbildschirm im Adminbereich hinzufügen.
/**
* FILTER: baza_bc_settings_tabs
* Description: The tabs of the plugin settings page. Add your own tab to the array.
* Params: $tabs array
*/
/**
* FILTER: baza_bc_integration_tabs
* Description: The tabs of the integrations screen (Google Calendar and others). Each item has 'label', 'title', 'description', 'logo' and 'class' (the class that draws the settings).
* Params: $tabs array
*/