PixelPaul Posted March 24, 2019 Share Posted March 24, 2019 (edited) is it possible to register/create a custom hook within my module for WHMCS. Not use one of the WHMCS hooks. So people could assign functions to the hook to manipulate some data and return it back to my module after it executes the hook? such as ... <?php add_hook('mymodule_myhook', 1, function($vars) { // Perform hook code here... }); Edited March 24, 2019 by PixelPaul 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted March 24, 2019 Share Posted March 24, 2019 Yes. WHMCS has nothing to do with it. Place hook points in your code and create a sort of autoloader that runs functions if they are in use by your customers. You can also define what parameters you want to push and return. The logic behind action hooks is not a proprietary thing of WHMCS. It can be applied to any scenario. 0 Quote Link to comment Share on other sites More sharing options...
PixelPaul Posted March 25, 2019 Author Share Posted March 25, 2019 yes i could write my own, but it would be best to use one already in place in the core software if available. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted March 25, 2019 Share Posted March 25, 2019 WHMCS loads its own hook points and as far as I know there's no way to include your ones. 0 Quote Link to comment Share on other sites More sharing options...
HostT Posted March 11, 2021 Share Posted March 11, 2021 Yes this is possible, just use the function `run_hook` ie: ``` run_hook('MyCustomHook', array()); ``` or ``` $return_value = run_hook('MyCustomHook', array()); ``` Hooks are loaded via `includes/hookfunctions.php` and basically the cache is stored in `global $hooks'`. Not sure why WHMCS doesn't document this at all .. but then again i'm not surprised at all. If i didn't have a decoded version of WHMCS i wouldn't be able to do 1/4 of the development work I do with WHMCS. 1 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.