This page is for developers. The plugin fires WordPress actions and filters, all prefixed
plugixa_boatrental_, that you can use from a theme’s functions.php or a small plugin of your
own. Hooks marked PRO fire only when the Pro app that owns them is installed and
switched on.
The plugin also has many hooks its own modules use to talk to each other. Only the ones below
are meant for site developers. Others may change between versions.
Reacting to events
Bookings
| Action |
Arguments |
When it fires |
plugixa_boatrental_booking_created |
$booking (array) |
After a booking is created, from the site, the office or the API. |
plugixa_boatrental_booking_cancelled |
$booking (array) |
When a customer cancels their own booking from their account. |
plugixa_boatrental_booking_repriced |
$booking_id, $previous_total |
After a booking’s total has been worked out again, for example when it moved to other dates. |
plugixa_boatrental_booking_imported |
$booking, $import_id |
After a booking is brought in by a CSV import. No email is sent for it, and booking_created does not fire. |
plugixa_boatrental_request_approved PRO |
$booking |
A request to book was accepted. The booking now waits for payment. |
plugixa_boatrental_request_closed PRO |
$booking_id, $state |
A request ended without being accepted: declined, lapsed or withdrawn. |
plugixa_boatrental_skipper_lost PRO |
$booking_id, $skipper_id |
A booking lost its skipper and nobody could take over. |
plugixa_boatrental_review_created PRO |
$review_id, $booking |
A guest wrote a review. |
add_action( 'plugixa_boatrental_booking_created', function ( array $booking ) {
error_log( 'New booking ' . $booking['booking_ref'] . ' for ' . $booking['customer_email'] );
} );
Payments
| Action |
Arguments |
When it fires |
plugixa_boatrental_payment_recorded |
$booking, $paid, $new_money |
After a payment or refund, once the booking’s paid state is worked out again. $paid is what it has been paid in total; $new_money is false when a failed refund was taken back and no payment came. |
plugixa_boatrental_owner_payout_paid PRO |
$payout |
An owner’s payout was marked paid. |
plugixa_boatrental_agent_statement_paid PRO |
$statement |
An agent’s statement was settled. |
At the dock PRO
| Action |
Arguments |
When it fires |
plugixa_boatrental_dock_checkout_completed |
$report, $booking |
A boat has been handed over in the dock app. |
plugixa_boatrental_dock_checkin_completed |
$report, $booking |
A boat is back. |
plugixa_boatrental_access_code_released |
$booking, $code |
A booking’s self check-in code was released, once. Program a smart lock here. |
plugixa_boatrental_access_code_cleared |
$booking_id, $reason |
A booking’s code no longer stands. Forget it on the smart lock here. |
Any record
These fire for every kind of record: bookings, boats, marinas, payments and the rest. The
first argument is the record type, such as booking or boat.
| Action |
Arguments |
When it fires |
plugixa_boatrental_entity_created |
$entity, $id, $data |
After a record is created. |
plugixa_boatrental_entity_updated |
$entity, $id, $data, $old |
After a record is changed. |
plugixa_boatrental_entity_field_changed |
$entity, $id, $field, $new_value, $old_value |
Once for each field that changed. Useful to catch a booking’s status changing. |
plugixa_boatrental_entity_deleted |
$entity, $id |
After a record is moved to the trash. It can still be restored. |
plugixa_boatrental_entity_restored |
$entity, $id |
After a record is restored from the trash. |
plugixa_boatrental_entity_purged |
$entity, $id |
After a record is deleted for good. |
add_action( 'plugixa_boatrental_entity_field_changed', function ( $entity, $id, $field, $new, $old ) {
if ( 'booking' === $entity && 'status' === $field && 'cancelled' === $new ) {
// The office cancelled booking $id.
}
}, 10, 5 );
The plugin itself
| Action |
Arguments |
When it fires |
plugixa_boatrental_loaded |
$container |
Once the plugin is fully started. |
plugixa_boatrental_activated |
|
After activation, once its tables exist. |
plugixa_boatrental_deactivated |
|
On deactivation. |
plugixa_boatrental_settings_saved |
$settings |
After the settings are saved. |
plugixa_boatrental_app_toggled |
$app_id, $enabled |
After an app is switched on or off in the App manager. |
plugixa_boatrental_uninstalled |
$outcome |
When an uninstall has decided whether to keep or erase the data. |
Emails and messages
| Filter |
Arguments |
What it changes |
plugixa_boatrental_email_template |
$template, $event, $booking |
The customer email’s subject and body, as array( $subject, $body ). An empty subject sends nothing. $event is booking_created, payment_received or an event of a Pro app. |
plugixa_boatrental_admin_email_template |
$template, $event, $booking |
The same for the email to the site’s administrator. |
plugixa_boatrental_email_context |
$context, $booking |
The placeholder values, '{token}' => value. Add your own here. |
plugixa_boatrental_email_placeholders |
$list |
The placeholders offered in the template editors, '{token}' => description. Name your own tokens here too. |
plugixa_boatrental_email_attachments |
$paths, $booking, $event |
Absolute paths of files to attach to the customer’s email. A file in the system’s temporary folder is deleted once the mail is sent. |
plugixa_boatrental_map_url |
$url, $query, $location |
The map link for a marina’s meeting point. The default opens a map search. |
plugixa_boatrental_calendar_prodid |
$prodid |
Who the calendar files sent with emails say made them. |
A custom placeholder needs both filters:
add_filter( 'plugixa_boatrental_email_context', function ( array $context, array $booking ) {
$context['{harbour_phone}'] = '+34 600 000 000';
return $context;
}, 10, 2 );
add_filter( 'plugixa_boatrental_email_placeholders', function ( array $list ) {
$list['{harbour_phone}'] = 'The harbour office phone number';
return $list;
} );
The plugixa_boatrental_booking_notify action ($booking, $context, $event, $log) fires
for every booking event after the emails, to deliver it some other way. The message templates
are described in Emails and alerts.
Prices
| Filter |
Arguments |
What it changes |
plugixa_boatrental_base_charge |
$base, $context |
The rate per unit and the booking fee, before anything else is added. Name each change in $base['adjustments'], an array of array( 'target' => 'unit_price' or 'initial_fee', 'label' => ..., 'amount' => ... ), so the customer sees it on its own line. |
plugixa_boatrental_quote_discounts |
$items, $subtotal, $request, $context |
Reductions of the subtotal, each a priced line. Together they never take off more than the subtotal. |
plugixa_boatrental_quote_due_now |
$due_now, $total, $settings, $request |
The part of the total to take now. Zero means the whole amount is due. |
plugixa_boatrental_quote |
$quote, $request |
The finished quote. |
plugixa_boatrental_new_booking_state |
$state, $request, $input |
The status a new booking starts in, and hold_expires_at, how long a pending booking holds its boat. |
plugixa_boatrental_user_customer_groups PRO |
$groups, $user_id |
The customer group ids a user belongs to, for pricing rules. |
// 10% off the rental for anybody signed in with the "member" role.
add_filter( 'plugixa_boatrental_base_charge', function ( array $base, array $context ) {
if ( current_user_can( 'member' ) ) {
$cut = round( $base['unit_price'] * 0.10, 2 );
$base['unit_price'] -= $cut;
$base['adjustments'][] = array(
'target' => 'unit_price',
'label' => 'Members: 10% off',
'amount' => -$cut,
);
}
return $base;
}, 10, 2 );
How a price is built is described in Payments.
Availability
| Filter |
Arguments |
What it changes |
plugixa_boatrental_unavailable_units |
$unit_ids, $location_id, $from_utc, $until_utc |
Units that cannot be sold in a stretch of time for a reason other than a booking. Every count of free boats asks it: the form, timetables, bookings and moves. |
plugixa_boatrental_availability_refusal |
$refused, $context |
Refuse a window for a reason other than the boat. Return a WP_Error with the message the customer reads, or null. |
Public pages
| Filter |
Arguments |
What it changes |
plugixa_boatrental_boat_page_content |
$content, $boat_id |
What surrounds a boat’s description on its own page, above the booking form. |
plugixa_boatrental_boat_page_after |
$html, $boat_id, $context |
Markup under the booking form, on the boat’s page (page) and under the Single Boat block (block). |
plugixa_boatrental_boat_card_after |
$html, $boat |
Markup on a boat’s card in a grid, under its price. |
plugixa_boatrental_similar_boats_count |
$count, $boat_id |
How many similar boats a boat’s page shows. 3 by default, 0 shows none, at most 12. |
plugixa_boatrental_boat_amenities |
$list |
The amenities a boat can be ticked for, slug => name. Add your own. Keep a slug once boats use it. |
plugixa_boatrental_status_labels |
$labels, $kind |
The words public pages show for booking or payment statuses ($kind is booking or payment). |
plugixa_boatrental_account_booking |
$row, $booking |
Add to what the customer’s account shows about a booking. Nothing from the booking reaches the customer unless you add it. |
plugixa_boatrental_summary_actions |
$actions, $ref |
More links beside the print button on a booking’s summary page, each array( 'url' => ..., 'label' => ... ). |
plugixa_boatrental_summary_pay_note |
$note, $booking |
A plain text line above the ways to pay on a booking’s summary page. |
plugixa_boatrental_invoice_total_rows |
$rows, $booking, $invoice |
Extra rows in the invoice totals, between the discount and the total, each array( 'label' => ..., 'amount' => ... ). |
plugixa_boatrental_allowed_html |
$allowed, $context |
The HTML the public pages may print. |
add_filter( 'plugixa_boatrental_boat_amenities', function ( array $list ) {
$list['snorkel_gear'] = __( 'Snorkelling gear', 'my-theme' );
return $list;
} );
The shortcodes and blocks themselves are described in
Shortcodes and blocks.
Payments
| Filter |
Arguments |
What it changes |
plugixa_boatrental_available_gateways |
$available |
The ways to pay a customer is offered, once each method has said whether it is on. |
plugixa_boatrental_payment_landing_url |
$url, $booking, $status |
The page a customer lands on when they come back from a payment provider’s page. |
plugixa_boatrental_non_revenue_gateways |
$gateways |
Payment methods whose payments are not new income, left out of the dashboard and reports. |
plugixa_boatrental_stripe_checkout_params PRO |
$params, $booking |
The Stripe Checkout Session before it is created: a customer, a locale, a statement descriptor. The mode, metadata and amounts are put back as they were. |
Access and protection
| Filter |
Arguments |
What it changes |
plugixa_boatrental_user_can |
$allowed, $action, $entity_type, $record, $user_id |
Whether a user may read, create, edit, delete or export a kind of record, or one record. |
plugixa_boatrental_rate_limits |
$limits |
The rate limits of the public routes, action => array( requests, seconds ). The actions are availability, quote, booking, payment_start, account_lookup, account_list, account_change and invoice. |
plugixa_boatrental_public_request_captcha |
$verdict, $request, $action |
Check a public request with a CAPTCHA service such as Turnstile or hCaptcha. Return false or a WP_Error to refuse. Nothing checks by default. |
plugixa_boatrental_client_ip |
$ip |
The address a public request is counted against, for example behind a proxy you trust. |
plugixa_boatrental_privacy_keep_booking |
$keep, $booking |
Keep a booking’s customer details through a personal data erasure, because something else still needs them. |
plugixa_boatrental_api_keys_rate_limit PRO |
$limit, $key_id |
Requests one API key may make in a minute. 120 by default. |
plugixa_boatrental_api_keys_allow_request PRO |
$allowed, $host |
Whether an API key is accepted on this request, for example over http on a development server. |
plugixa_boatrental_whatsapp_consent PRO |
$consented, $booking, $phone |
Whether a customer agreed to WhatsApp messages. Return true only for consent you hold yourself. |
// Count public requests against the visitor's address behind Cloudflare.
add_filter( 'plugixa_boatrental_client_ip', function ( string $ip ) {
$forwarded = $_SERVER['HTTP_CF_CONNECTING_IP'] ?? '';
return filter_var( $forwarded, FILTER_VALIDATE_IP ) ? $forwarded : $ip;
} );
Only trust a forwarded header your own proxy sets.
Admin, files and limits
| Filter |
Arguments |
What it changes |
plugixa_boatrental_admin_menu |
$menu |
The admin menu item’s page_title, menu_title and icon. The page address never changes. |
plugixa_boatrental_white_label PRO |
$brand |
The admin’s branding after the White label settings: name, menu, icon, logo, hide_vendor, footer. See White label and multisite. |
plugixa_boatrental_booking_export_columns |
$columns |
The columns of the bookings CSV export, field => heading, in order. |
plugixa_boatrental_import_max_bytes |
$bytes |
The largest CSV an import reads. 2 MB by default, and never more than the server’s upload limit. |
plugixa_boatrental_document_max_bytes PRO |
$bytes |
The largest identity document a customer can upload. 8 MB by default. |
plugixa_boatrental_private_dir PRO |
$path |
The folder waivers and identity documents are kept in, as an absolute path. Choose one outside the web root. |
plugixa_boatrental_dock_path PRO |
$path |
The address of the dock app under your site, dock by default. |
plugixa_boatrental_network_sites |
$ids |
The sites a network-wide step visits, such as network activation. |
Adding REST routes
The plugixa_boatrental_register_rest_routes action ($namespace, $container) lets you add
routes under the plugin’s own namespace. See
REST API and API keys.