Skip to content

Output

The following hooks are provided for Output related events.

AdminAreaFooterOutput

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.

Parameters

VariableTypeNotes
charsetstringSystem charset setting eg. UTF-8
templatestringThe admin template being used
pagetemplatestringThe template for the current page (if applicable)
adminidintThe currently logged in admin user ID
admin_usernamestringThe username of the current admin user
admin_notesstringThe private notes for the current admin user
admin_permsarrayThe permissions of the current admin user
addon_modulesarrayA list of add-on modules the current admin user has access to
filenamestringThe name of the file being called
pagetitlestringThe title of the current page
helplinkstringThe documentation url for the current page
sidebarstringThe sidebar output
minsidebarboolReturns true if the sidebar is minimised
jquerycodestringjQuery code for the current page
jscodestringJavascript code for the current page
datepickerformatstringThe format defined for dates in the admin area
adminsonlinestringA list of currently online admin users

Response

Accepts HTML to be output before the closing body tag of the admin area output

Example Code

<?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;
});

AdminAreaHeadOutput

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.

Parameters

VariableTypeNotes
charsetstringSystem charset setting eg. UTF-8
templatestringThe admin template being used
pagetemplatestringThe template for the current page (if applicable)
adminidintThe currently logged in admin user ID
admin_usernamestringThe username of the current admin user
admin_notesstringThe private notes for the current admin user
admin_permsarrayThe permissions of the current admin user
addon_modulesarrayA list of add-on modules the current admin user has access to
filenamestringThe name of the file being called
pagetitlestringThe title of the current page
helplinkstringThe documentation url for the current page
sidebarstringThe sidebar output
minsidebarboolReturns true if the sidebar is minimised
jquerycodestringjQuery code for the current page
jscodestringJavascript code for the current page
datepickerformatstringThe format defined for dates in the admin area
adminsonlinestringA list of currently online admin users

Response

Accepts HTML to be output within the head tag of the admin area output

Example Code

<?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;

});

AdminAreaHeaderOutput

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.

Parameters

VariableTypeNotes
charsetstringSystem charset setting eg. UTF-8
templatestringThe admin template being used
pagetemplatestringThe template for the current page (if applicable)
adminidintThe currently logged in admin user ID
admin_usernamestringThe username of the current admin user
admin_notesstringThe private notes for the current admin user
admin_permsarrayThe permissions of the current admin user
addon_modulesarrayA list of add-on modules the current admin user has access to
filenamestringThe name of the file being called
pagetitlestringThe title of the current page
helplinkstringThe documentation url for the current page
sidebarstringThe sidebar output
minsidebarboolReturns true if the sidebar is minimised
jquerycodestringjQuery code for the current page
jscodestringJavascript code for the current page
datepickerformatstringThe format defined for dates in the admin area
adminsonlinestringA list of currently online admin users

Response

Accepts HTML to be output within the body tag of the admin area output

Example Code

<?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;
});

AdminInvoicesControlsOutput

Allows returning of output for display on the invoice edit page

Parameters

VariableTypeNotes
invoiceidint
useridint
subtotalfloat
taxfloat
tax2float
creditfloat
totalfloat
balancefloat
taxratefloat
taxrate2float
paymentmethodstring

Response

Return the HTML to be output on the page.

Example Code

<?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;
});

ClientAreaDomainDetailsOutput

Allows returning of output for display in the client area domain details page.

Parameters

VariableTypeNotes
domain\WHMCS\Domain\DomainA domain object representing the domain being rendered.

Response

Return the HTML to be output on the page.

Example Code

<?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';
});

ClientAreaFooterOutput

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.

Parameters

VariableTypeNotes
companynamestring
logostring
systemurlstring
charsetstring
pagetitlestring
filenamestring
templatestring
languagestring
LANGarrayActive language translation strings
todaysdatestringHuman friendly formatted version of todays date
date_daystringCurrent day of the month
date_monthstringCurrent month
date_yearstringCurrent year
WEB_ROOTstringThe web path to the WHMCS doc root
BASE_PATH_CSSstring
BASE_PATH_JSstring
BASE_PATH_FONTSstring
BASE_PATH_IMGstring
tokenstringCSRF token value
servedOverSslboolTrue if page was loaded via https://

Response

Return HTML to be output before the closing body tag of the page output.

Example Code

<?php

add_hook('ClientAreaFooterOutput', 1, function($vars) {
    $language = $vars['language'];
    $sslPage = $vars['servedOverSsl'];
    return '<b>This is a custom output on the footer</b>';
});

ClientAreaHeadOutput

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.

Parameters

VariableTypeNotes
companynamestring
logostring
systemurlstring
charsetstring
pagetitlestring
filenamestring
templatestring
languagestring
LANGarrayActive language translation strings
todaysdatestringHuman friendly formatted version of todays date
date_daystringCurrent day of the month
date_monthstringCurrent month
date_yearstringCurrent year
WEB_ROOTstringThe web path to the WHMCS doc root
BASE_PATH_CSSstring
BASE_PATH_JSstring
BASE_PATH_FONTSstring
BASE_PATH_IMGstring
tokenstringCSRF token value
servedOverSslboolTrue if page was loaded via https://

Response

Return HTML to be output within the HEAD tags of the page output.

Example Code

<?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;

});

ClientAreaHeaderOutput

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.

Parameters

VariableTypeNotes
companynamestring
logostring
systemurlstring
charsetstring
pagetitlestring
filenamestring
templatestring
languagestring
LANGarrayActive language translation strings
todaysdatestringHuman friendly formatted version of todays date
date_daystringCurrent day of the month
date_monthstringCurrent month
date_yearstringCurrent year
WEB_ROOTstringThe web path to the WHMCS doc root
BASE_PATH_CSSstring
BASE_PATH_JSstring
BASE_PATH_FONTSstring
BASE_PATH_IMGstring
tokenstringCSRF token value
servedOverSslboolTrue if page was loaded via https://

Response

Return HTML to be output at the top of the body tag of the page output.

Example Code

<?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;
});

ClientAreaProductDetailsOutput

Allows returning of output for display in the client area product details page.

Parameters

VariableTypeNotes
service\WHMCS\Service\ServiceA service object representing the service being rendered.

Response

Return the HTML to be output on the page.

Example Code

<?php

add_hook('ClientAreaProductDetailsOutput', 1, function($service) {
    if (!is_null($service)) {
        $orderID = $service['service']->orderId;
        return 'OrderID: ' . $orderID;
    }
    return '';
});

FormatDateForClientAreaOutput

Allows for transformation of a date prior to output within the Client Area.

Parameters

VariableTypeNotes
date\CarbonA Carbon object representing the date/time.

Response

Return a string containing the formatted date to display.

Example Code

<?php

add_hook('FormatDateForClientAreaOutput', 1, function ($vars) {
    // Perform hook code here...
});

FormatDateTimeForClientAreaOutput

Allows for transformation of a date/time prior to output within the Client Area.

Parameters

VariableTypeNotes
date\CarbonA Carbon object representing the date/time.

Response

Return a string containing the formatted date and time to display.

Example Code

<?php

add_hook('FormatDateTimeForClientAreaOutput', 1, function ($vars) {
    // Perform hook code here...
});

ReportViewPostOutput

Executes as a report is being displayed, after the output occurs

Parameters

VariableTypeNotes
reportstring
moduleTypestring
moduleNamestring

Response

No response supported

Example Code

<?php
add_hook('ReportViewPostOutput', 1, function($vars) {
    // Perform hook code here...
});

ReportViewPreOutput

Executes as a report is being displayed, before the output occurs

Parameters

VariableTypeNotes
reportstring
moduleTypestring
moduleNamestring

Response

No response supported

Example Code

<?php
add_hook('ReportViewPreOutput', 1, function($vars) {
    // Perform hook code here...
});

ShoppingCartCheckoutOutput

Allows returning of output for display on the Shopping Cart Checkout page.

Parameters

VariableTypeNotes
cartDataarray

Response

Return the HTML to be output on the page.

Example Code

<?php
add_hook('ShoppingCartCheckoutOutput', 1, function($vars) {
    // Perform hook code here...
});

ShoppingCartConfigureProductAddonsOutput

Parameters

VariableTypeNotes
billingCycle
selectedAddons

Response

No response supported

Example Code

<?php
add_hook('ShoppingCartConfigureProductAddonsOutput', 1, function($vars) {
    // Perform hook code here...
});

ShoppingCartViewCartOutput

Allows returning of output for display on the Shopping Cart View Cart page.

Parameters

VariableTypeNotes
cartDataarray

Response

Return the HTML to be output on the page.

Example Code

<?php
add_hook('ShoppingCartViewCartOutput', 1, function($vars) {
    // Perform hook code here...
});