English (United Kingdom)
1.8.21

Every PMS reservation, either manually generated or placed by guests (OTA bookings excluded), gets a secret and unique value called SID. Along with the booking creation timestamp (an integer value), it allows to access the front-end booking details page, where a summary of the reservation is displayed with all guest details. By visiting the back-end booking details page and by clicking the button "View in front-site", you will be able to see the front-end booking details page URL structure, where sid=... lives.

The SID value is a unique string per reservation, and its format can be, at least, of four different types:

  • UUID ("uuid" enum, default format): a 16-octet (128-bit) number, represented by 32 hexadecimal digits, displayed in five groups separated by hyphens (in the form 8-4-4-4-12), for a total of 36 characters.
  • Random Bytes ("random_bytes" enum): 8 random bytes converted into a 16 hexadecimal characters long string.
  • Alphanumeric ("alnum" enum): random serial alphanumeric (a-z1-9) string of 12 characters.
  • Integer ("int" enum): legacy format for a random string made of only digits through mt_rand().

An additional type is actually supported, and its enumeration value is rotation. As the name suggests, if this type is adopted, the unique SID generated for a booking will be in one of the above four mentioned formats, randomly picked, which may change from one booking to another. This is where the apposite hook comes handy.

Please note:

  • The SID value format will also affect the name of bookings related media files, such as PDF invoices.
  • Changes to the SID format are not retroactive.
  • Booking links with "longer" SID values will not risk to break email messages thanks to the Shorten URL framework.

You can choose/overwrite the preferred/default SID value format through the apposite hook.

do_action( 'vikbooking_detect_booking_sid_format', string &$defaultFormat, array $knownFormats )

Fires during the detection of the booking SID format to use for its generation.


Description

Plugins can use this hook to overwrite the SID format by setting a known and supported enumeration value.


Parameters

$defaultFormat

(string)  The current/default SID format to use.

$knownFormats

(array)  The list of known and supported SID format enumerations.

This is how the hook will fire. Simply overwrite the $defaultFormat string to adopt a custom format type.


/**
 * Triggers an action to let plugins overwrite the SID format type.
 * 
 * @param   string  &$defaultFormat  The current/default SID format enumeration type.
 * @param   array   $knownFormats    List of known and supported SID format type enumerations.
 */
add_action('vikbooking_detect_booking_sid_format', function(string &$defaultFormat, array $knownFormats)
{
    // adopt a random format type among the supported ones
    $defaultFormat = 'rotation';
}, 10, 2);
Last Update: 1 week ago
Helpful?