+++ title = "Output" weight = 10
+++
The following hooks are provided for Output related events.
Runs on every admin area page load. All template variables defined at the time the hook is invoked are made available to this hook point. This can vary by page. The list below is not an exhaustive list.
| Variable | Type | Notes |
|---|---|---|
| charset | string | System charset setting eg. UTF-8 |
| template | string | The admin template being used |
| pagetemplate | string | The template for the current page (if applicable) |
| adminid | int | The currently logged in admin user ID |
| admin_username | string | The username of the current admin user |
| admin_notes | string | The private notes for the current admin user |
| admin_perms | array | The permissions of the current admin user |
| addon_modules | array | A list of add-on modules the current admin user has access to |
| filename | string | The name of the file being called |
| pagetitle | string | The title of the current page |
| helplink | string | The documentation url for the current page |
| sidebar | string | The sidebar output |
| minsidebar | bool | Returns true if the sidebar is minimised |
| jquerycode | string | jQuery code for the current page |
| jscode | string | Javascript code for the current page |
| datepickerformat | string | The format defined for dates in the admin area |
| adminsonline | string | A list of currently online admin users |
Accepts HTML to be output before the closing body tag of the admin area output
<?php
add_hook('AdminAreaFooterOutput', 1, function($vars) {
return <<<HTML
<b>This is a custom output on the footer</b>
<script type="text/javascript">
//custom javascript here
</script>
HTML;
});
Runs on every admin area page load. All template variables defined at the time the hook is invoked are made available to this hook point. This can vary by page. The list below is not an exhaustive list.
| Variable | Type | Notes |
|---|---|---|
| charset | string | System charset setting eg. UTF-8 |
| template | string | The admin template being used |
| pagetemplate | string | The template for the current page (if applicable) |
| adminid | int | The currently logged in admin user ID |
| admin_username | string | The username of the current admin user |
| admin_notes | string | The private notes for the current admin user |
| admin_perms | array | The permissions of the current admin user |
| addon_modules | array | A list of add-on modules the current admin user has access to |
| filename | string | The name of the file being called |
| pagetitle | string | The title of the current page |
| helplink | string | The documentation url for the current page |
| sidebar | string | The sidebar output |
| minsidebar | bool | Returns true if the sidebar is minimised |
| jquerycode | string | jQuery code for the current page |
| jscode | string | Javascript code for the current page |
| datepickerformat | string | The format defined for dates in the admin area |
| adminsonline | string | A list of currently online admin users |
Accepts HTML to be output within the head tag of the admin area output
<?php
add_hook('AdminAreaHeadOutput', 1, function($vars) {
return <<<HTML
<link href="path/to/custom/css/custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//custom javascript here
</script>
HTML;
});
Runs on every admin area page load. All template variables defined at the time the hook is invoked are made available to this hook point. This can vary by page. The list below is not an exhaustive list.
| Variable | Type | Notes |
|---|---|---|
| charset | string | System charset setting eg. UTF-8 |
| template | string | The admin template being used |
| pagetemplate | string | The template for the current page (if applicable) |
| adminid | int | The currently logged in admin user ID |
| admin_username | string | The username of the current admin user |
| admin_notes | string | The private notes for the current admin user |
| admin_perms | array | The permissions of the current admin user |
| addon_modules | array | A list of add-on modules the current admin user has access to |
| filename | string | The name of the file being called |
| pagetitle | string | The title of the current page |
| helplink | string | The documentation url for the current page |
| sidebar | string | The sidebar output |
| minsidebar | bool | Returns true if the sidebar is minimised |
| jquerycode | string | jQuery code for the current page |
| jscode | string | Javascript code for the current page |
| datepickerformat | string | The format defined for dates in the admin area |
| adminsonline | string | A list of currently online admin users |
Accepts HTML to be output within the body tag of the admin area output
<?php
add_hook('AdminAreaHeaderOutput', 1, function($vars) {
$return = '';
if (array_key_exists('project_management', $vars['addon_modules'])) {
$return = '<b>This is a custom output on the header when Project Management is enabled</b>';
}
return $return;
});
Allows returning of output for display on the invoice edit page
| Variable | Type | Notes |
|---|---|---|
| invoiceid | int | |
| userid | int | |
| subtotal | float | |
| tax | float | |
| tax2 | float | |
| credit | float | |
| total | float | |
| balance | float | |
| taxrate | float | |
| taxrate2 | float | |
| paymentmethod | string |
Return the HTML to be output on the page.
<?php
add_hook('AdminInvoicesControlsOutput', 1, function($vars) {
$return = '';
if ($vars['paymentmethod'] == 'mypaymentmethod') {
$return = "<br />Field 1 Value <input type=\"text\" name=\"myPaymentMethodName\" value=\"xyz\" class=\"form-control input-150\" />";
}
return $return;
});
Allows returning of output for display in the client area domain details page.
| Variable | Type | Notes |
|---|---|---|
| domain | \WHMCS\Domain\Domain | A domain object representing the domain being rendered. |
Return the HTML to be output on the page.
<?php
add_hook('ClientAreaDomainDetailsOutput', 1, function($domain) {
$domainName = $domain->domain;
$clientModel = $domain->client;
$domainStatus = $domain->status;
$clientName = $clientModel->firstName . ' ' . $clientModel->lastName;
return 'You can place any HTML here that will be output in the $hookOutput smarty variable array';
});
Executes when a client area page is being output. The following is a list of template variables common to all pages. Additional variables will vary depending upon the page being rendered.
| Variable | Type | Notes |
|---|---|---|
| companyname | string | |
| logo | string | |
| systemurl | string | |
| charset | string | |
| pagetitle | string | |
| filename | string | |
| template | string | |
| language | string | |
| LANG | array | Active language translation strings |
| todaysdate | string | Human friendly formatted version of todays date |
| date_day | string | Current day of the month |
| date_month | string | Current month |
| date_year | string | Current year |
| WEB_ROOT | string | The web path to the WHMCS doc root |
| BASE_PATH_CSS | string | |
| BASE_PATH_JS | string | |
| BASE_PATH_FONTS | string | |
| BASE_PATH_IMG | string | |
| token | string | CSRF token value |
| servedOverSsl | bool | True if page was loaded via https:// |
Return HTML to be output before the closing body tag of the page output.
<?php
add_hook('ClientAreaFooterOutput', 1, function($vars) {
$language = $vars['language'];
$sslPage = $vars['servedOverSsl'];
return '<b>This is a custom output on the footer</b>';
});
Executes when a client area page is being output. The following is a list of template variables common to all pages. Additional variables will vary depending upon the page being rendered.
| Variable | Type | Notes |
|---|---|---|
| companyname | string | |
| logo | string | |
| systemurl | string | |
| charset | string | |
| pagetitle | string | |
| filename | string | |
| template | string | |
| language | string | |
| LANG | array | Active language translation strings |
| todaysdate | string | Human friendly formatted version of todays date |
| date_day | string | Current day of the month |
| date_month | string | Current month |
| date_year | string | Current year |
| WEB_ROOT | string | The web path to the WHMCS doc root |
| BASE_PATH_CSS | string | |
| BASE_PATH_JS | string | |
| BASE_PATH_FONTS | string | |
| BASE_PATH_IMG | string | |
| token | string | CSRF token value |
| servedOverSsl | bool | True if page was loaded via https:// |
Return HTML to be output within the HEAD tags of the page output.
<?php
add_hook('ClientAreaHeadOutput', 1, function($vars) {
$template = $vars['template'];
return <<<HTML
<link href="path/to/custom/css/custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//custom javascript here
</script>
HTML;
});
Executes when a client area page is being output. The following is a list of template variables common to all pages. Additional variables will vary depending upon the page being rendered.
| Variable | Type | Notes |
|---|---|---|
| companyname | string | |
| logo | string | |
| systemurl | string | |
| charset | string | |
| pagetitle | string | |
| filename | string | |
| template | string | |
| language | string | |
| LANG | array | Active language translation strings |
| todaysdate | string | Human friendly formatted version of todays date |
| date_day | string | Current day of the month |
| date_month | string | Current month |
| date_year | string | Current year |
| WEB_ROOT | string | The web path to the WHMCS doc root |
| BASE_PATH_CSS | string | |
| BASE_PATH_JS | string | |
| BASE_PATH_FONTS | string | |
| BASE_PATH_IMG | string | |
| token | string | CSRF token value |
| servedOverSsl | bool | True if page was loaded via https:// |
Return HTML to be output at the top of the body tag of the page output.
<?php
add_hook('ClientAreaHeaderOutput', 1, function($vars) {
$return = '';
if (
$vars['filename'] == 'index.php'
&& isset($_REQUEST['m'])
&& $_REQUEST['m'] == 'project_management'
) {
$return = '<b>This is a custom output on the header when in the client area for Project Management</b>';
}
return $return;
});
Allows returning of output for display in the client area product details page.
| Variable | Type | Notes |
|---|---|---|
| service | \WHMCS\Service\Service | A service object representing the service being rendered. |
Return the HTML to be output on the page.
<?php
add_hook('ClientAreaProductDetailsOutput', 1, function($service) {
if (!is_null($service)) {
$orderID = $service['service']->orderId;
return 'OrderID: ' . $orderID;
}
return '';
});
Allows for transformation of a date prior to output within the Client Area.
| Variable | Type | Notes |
|---|---|---|
| date | \Carbon | A Carbon object representing the date/time. |
Return a string containing the formatted date to display.
<?php
add_hook('FormatDateForClientAreaOutput', 1, function ($vars) {
// Perform hook code here...
});
Allows for transformation of a date/time prior to output within the Client Area.
| Variable | Type | Notes |
|---|---|---|
| date | \Carbon | A Carbon object representing the date/time. |
Return a string containing the formatted date and time to display.
<?php
add_hook('FormatDateTimeForClientAreaOutput', 1, function ($vars) {
// Perform hook code here...
});
Executes as a report is being displayed, after the output occurs
| Variable | Type | Notes |
|---|---|---|
| report | string | |
| moduleType | string | |
| moduleName | string |
No response supported
<?php
add_hook('ReportViewPostOutput', 1, function($vars) {
// Perform hook code here...
});
Executes as a report is being displayed, before the output occurs
| Variable | Type | Notes |
|---|---|---|
| report | string | |
| moduleType | string | |
| moduleName | string |
No response supported
<?php
add_hook('ReportViewPreOutput', 1, function($vars) {
// Perform hook code here...
});
Allows returning of output for display on the Shopping Cart Checkout page.
| Variable | Type | Notes |
|---|---|---|
| cartData | array |
Return the HTML to be output on the page.
<?php
add_hook('ShoppingCartCheckoutOutput', 1, function($vars) {
// Perform hook code here...
});
| Variable | Type | Notes |
|---|---|---|
| billingCycle | ||
| selectedAddons |
No response supported
<?php
add_hook('ShoppingCartConfigureProductAddonsOutput', 1, function($vars) {
// Perform hook code here...
});
Allows returning of output for display on the Shopping Cart View Cart page.
| Variable | Type | Notes |
|---|---|---|
| cartData | array |
Return the HTML to be output on the page.
<?php
add_hook('ShoppingCartViewCartOutput', 1, function($vars) {
// Perform hook code here...
});