Remitur Posted November 28, 2022 Share Posted November 28, 2022 Inside a Registrar module, you have the AdminCustomButtonArray() function that allows to define custom buttons in admin area for custom domain functions... but what if I need to define a button of the very same kind, but outside of a registrar module? (The issue is that the registrar module is encrypted, so I have no way to use AdminCustomButtonArray() function...) 0 Quote Link to comment Share on other sites More sharing options...
SethMcCauley Posted November 28, 2022 Share Posted November 28, 2022 (edited) 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 ); }); Edited November 28, 2022 by SethMcCauley Code formatting cleanup 1 Quote Link to comment Share on other sites More sharing options...
Waqas Wiqi Posted Tuesday at 08:06 AM Share Posted Tuesday at 08:06 AM Can we add a button in whmcs admin area product page which sends an email like "Resend Product Welcome Email" button send template number 1. Is there a way to create a button which sends a template id 5 for example ? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.