Jump to content

SethMcCauley

Member
  • Posts

    4
  • Joined

  • Last visited

About SethMcCauley

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SethMcCauley's Achievements

Junior Member

Junior Member (1/3)

1

Reputation

  1. The code Freshworks provides appears to be JavaScript that is intended to run client-side in the browser. It cannot be executed from the server using PHP in this way. To integrate this code with WHMCS you would need to either 1) use a different hook to insert JavaScript (as a text string) into the page header or 2) modify one or more client area templates to include the custom JavaScript. I think the second option will probably work best for you in this case. Here are a few of the Smarty templates that you might find useful for integrating CRM lead tracking: /templates/six/contact.tpl - contact form (six template) /templates/six/clientregister.tpl - direct client registration (six template) /templates/twenty-one/contact.tpl - contact form (twenty-one template) /templates/twenty-one/clientregister.tpl - direct client registration (twenty-one template) /templates/orderforms/standard_cart/checkout.tpl - client registration during order checkout Note: default template paths are frequently overwritten during WHMCS updates. A child theme should be created and used for any changes to template files such as those listed above.
  2. With a majority of the different module types in WHMCS (such as Provisioning or Registrar), every service, domain, etc. can only be tied to a single module. If that module is closed source / encrypted, an alternate solution is needed for adding custom content to the admin area. Addon modules can be used to change content on a variety of pages in both the admin area and client area. This includes pages with content normally handled by specific types of modules such as domains or services. By creating a custom addon module, you can utilize hooks for modifying the admin area such as the following: AdminAreaPage - Runs on every admin area page load. AdminClientDomainsTabFields - Executes when a domain is being viewed in the Admin area. AdminClientServicesTabFields - Executes when a service is being viewed in the Admin area. AdminClientDomainsTabFieldsSave - Executes when the Domains tab in the Admin area is being saved. AdminClientServicesTabFieldsSave - Executes when the Services tab in the Admin area is being saved. For example, the code below will add two custom buttons to each service. Some additional logic could be added to filter this to specific service types as well: /modules/addons/new_custom_addon/hooks.php <?php // Add some custom buttons in the admin area for all services add_hook('AdminClientServicesTabFields', 1, function($vars) { // Get current service ID from the vars passed to this function $serviceId = $vars['id']; // Build the HTML to be displayed on each service $customButtonHTML = '' . '<div id="customSectionId">' . "\n". ' <button type="button" class="btn btn-default" onclick="alert(\'Button 1 clicked on Service \' + ' . $serviceId . ')" id="customBtnId1">Button 1</button>' . "\n". ' <button type="button" class="btn btn-default" onclick="alert(\'Button 2 clicked on Service \' + ' . $serviceId . ')" id="customBtnId2">Button 2</button>' . "\n". '</div>' . "\n". ''; // Display the result return array( 'Custom Buttons' => $customButtonHTML ); });
  3. 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.
  4. 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.
×
×
  • 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