It is not always easy to determine which PHP variables are available and defined within a given WHMCS hook: the available documentation is often quite laconic and imprecise, and to discover them you sometimes have to resort to experience or proceed by random attempts.
However, a trick is available to determine all PHP variables defined and available: just insert the following code inside our hook:
echo "<pre>";
print_r(get_defined_vars());
echo "</pre>";
So, an example hook implementing this function could look like this:
<?php
add_hook('ClientAreaPageViewTicket', 1, function($vars) {
echo "<pre>";
print_r(get_defined_vars());
echo "</pre>";
});
This function will return the value of all PHP variables defined within the hook; the values will be shown on the screen, therefore it is recommended to use it only and exclusively in a test environment!!!
The output will be formatted and easily readable, but huge (hundreds of rows): so it is advisable to copy-paste it into your text editor to examine it and identify the elements of your interest.