Jump to content

Passing admin module data to Smarty


Recommended Posts

I would like to pass some data from an 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 the "AdminAreaPage" action hook. 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 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, (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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated