sotto Posted February 18, 2017 Share Posted February 18, 2017 I have a `hooks.php` inside a otherwise working Server/Provisioning Module and none of the added hooks are working. I added this simple hook to verify it: ```php add_hook('ClientLogin', 1, function($vars) { logModuleCall('server module', 'testhook'); }); ``` ...nothing's logged. I was beginning to think, that Module Hooks are not allowed in Server Modules but the [sample Provisioning Module]{https://github.com/WHMCS/sample-provisioning-module/blob/master/modules/servers/provisioningmodule/hooks.php) suggests they are. What am I missing? 0 Quote Link to comment Share on other sites More sharing options...
high Posted March 1, 2017 Share Posted March 1, 2017 we got the same issue after we upgrade from 6.3.2 to 7.1.2 0 Quote Link to comment Share on other sites More sharing options...
phpd Posted March 28, 2017 Share Posted March 28, 2017 are you guys able to use the ClientLogin hook in includes/hooks/ directory? I can't seem to make it work, seem like it's not firing. I'm also using 7.1.2. 0 Quote Link to comment Share on other sites More sharing options...
PV-Patrick Posted July 12, 2017 Share Posted July 12, 2017 Fresh install of 7.2.2 and none of my hooks on my server provisioning module are working. 0 Quote Link to comment Share on other sites More sharing options...
dylanhansch Posted July 12, 2017 Share Posted July 12, 2017 Fresh install of 7.2.2 and none of my hooks on my server provisioning module are working. Oddly enough I'm running into the exact same issue as this thread now. I updated my dev whmcs install to 7.2.2 this morning.. 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted July 13, 2017 Share Posted July 13, 2017 Have you updated the hooks to work with WHMCS 7.2.2? There were some major changes with the introduction of 7.x 0 Quote Link to comment Share on other sites More sharing options...
dylanhansch Posted July 13, 2017 Share Posted July 13, 2017 Have you updated the hooks to work with WHMCS 7.2.2? There were some major changes with the introduction of 7.x This is the only code in the hook file. Can't imagine it's outdated. Nothing get's logged in the module log. I should add that I tried adding that hook to the "includes/hooks/example.php" file and it worked. I also have an addon module on the WHMCS installation, and it's hooks are working fine too. Seems to be just the provisioning module. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); add_hook('EmailTplMergeFields', 1, function ($params) { return array( 'multicraft_server_id'=>'Multicraft Server ID', ); logModuleCall('server module', 'testhook'); }); 0 Quote Link to comment Share on other sites More sharing options...
PV-Patrick Posted July 14, 2017 Share Posted July 14, 2017 I experience the same as you dylanhansch. I tested it in "includes/hooks/example.php" and the code worked as expected. However, it does not work when inside my hooks.php for provisioning module. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); add_hook('ClientAreaPrimarySidebar', 1, function($primarySidebar) { //$primarySidebar->getChild("Service Details Overview")->getChild("Information")->setLabel("Hello"); $primarySidebar->getChild("Service Details Overview")->addChild('World', array('uri' => '#', 'order' => 15)); }); Submitted a support ticket with WHMCS. 0 Quote Link to comment Share on other sites More sharing options...
imaticon Posted July 18, 2017 Share Posted July 18, 2017 Just to mention that addons, registrar modules and server modules hooks are cached. This said, if you have a module active and then you add hooks.php to the module folder, then the hookpoints from the hooks.php file wont be loaded. It is compulsory to do a save changes action on any of the products setup using the module for which you have added the hooks.php file Hope this helps. 0 Quote Link to comment Share on other sites More sharing options...
dylanhansch Posted July 18, 2017 Share Posted July 18, 2017 Just to mention that addons, registrar modules and server modules hooks are cached. This said, if you have a module active and then you add hooks.php to the module folder, then the hookpoints from the hooks.php file wont be loaded. It is compulsory to do a save changes action on any of the products setup using the module for which you have added the hooks.php file Hope this helps. Thank you - that's very helpful to know. Annoying to work with though *sigh*. Is that even mentioned anywhere in the docs, or am I missing something? 0 Quote Link to comment Share on other sites More sharing options...
imaticon Posted July 18, 2017 Share Posted July 18, 2017 Yes, it is: https://developers.whmcs.com/hooks/module-hooks/ 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.