Reputation: 1003
I would like to pass some data from a WHMCS admin module to the client summary admin template. In order to get the data from our admin module to the Smarty template, we have been attempting to use an action hook called "AdminAreaPage". This action hook is supposed to take an array of variables (returned in the action hook) and make them accessible as Smarty variables.
The issue I am having is that none of the variables we return in that action hook seem to be accessible to the template (clientssummary.tpl). I have tried listing all available Smarty variables with {debug} as well as several other methods, but none of our custom variables are displayed (the other template variables are successfully listed). The basis for our action hook is taken directly from the WHMCS documentation example: http://docs.whmcs.com/Hooks:AdminAreaPage
The action hook is running on each page load, as we are able to echo text directly to the page. We are not able to access any data passed to Smarty, however, or we are not passing it correctly. Here is some example code similar to what we are using in our action hook, (nearly unmodified from the WHMCS example code):
function module_hook_test($vars) {
$return = array();
$return = array("field1" => "value1", "field2" => "value2");
return $return;
}
add_hook("AdminAreaPage",1,"module_hook_test");
(with "module" being replaced with our actual module name)
Any assistance with this action hook, or an alternate recommended method of passing the data, would be greatly appreciated. Thank you.
Upvotes: 3
Views: 851
Reputation: 1003
I submitted a ticket to WHMCS support. They have believe the issue may be due to a bug in WHMCS and said that the developers will address the issue in a future release. In the mean time, they suggested querying the data directly from the template using {php}{/php} tags. This will work fine for us as a temporary workaround.
Upvotes: 2