Ron Record Posted April 15, 2020 Share Posted April 15, 2020 I have written and deployed a provisioning module along with its module hook. The hook does not appear to be executing. I am investigating this and ran across the following in the Developer Documentation Module Hooks section: "Hook files are only detected at the time a module is activated and configured. If you add your hook file after the module has already been activated, you may need to deactivate and reactivate your module in order for WHMCS to recognise it." How do I deactivate and reactivate my module? Thanks for any pointers, I'm new to WHMCS. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted April 16, 2020 Share Posted April 16, 2020 (edited) 14 hours ago, Ron Record said: How do I deactivate and reactivate my module? Setup > Addon Modules. Here you'll find Deactivate button. Keep in mind that when you deactivate your module, WHMCS triggers the _deactivate() function where you probably drop your custom tables from database. If you don't want it to happen, there's an alernative. In tblconfiguration there's a setting named AddonModulesHooks that looks like follows: aModule,anotherModule Basically it's a comma-separated list of all Addon Modules wanting WHMCS to run hooks.php file. Now let's say that your module is named ronModule. You just need to add yourself to the list. This way WHMCS will run your modules/addons/ronModule/hooks.php file. aModule,anotherModule,ronModule Edited April 16, 2020 by Kian 1 Quote Link to comment Share on other sites More sharing options...
Ron Record Posted April 16, 2020 Author Share Posted April 16, 2020 Thanks @Kian, I added my module as a new Product/Service so it is not showing up in the Addon Modules list to activate/deactivate. I will retry by adding it as an Addon Module. 0 Quote Link to comment Share on other sites More sharing options...
Ron Record Posted April 17, 2020 Author Share Posted April 17, 2020 I resolved this issue of deactivating and reactivating my provisioning module. Along the way I noticed that variable passed into my hook as the unique identifier for the client is: params['userId'] if the hook is added on OrderPaid and params['userid'] if the hook is added on ClientAdd Notice the only difference is capitalization of the 'I" in 'userId' for OrderPaid. This tripped me up since the parameter variable names are case sensitive. So be sure to lean over real close to the screen, take off your glasses, and squint when coding these variable names in your hooks 🙂 Thanks again to @Kian for the prompt response and assistance. 0 Quote Link to comment Share on other sites More sharing options...
mustardman Posted January 26, 2021 Share Posted January 26, 2021 (edited) On 4/17/2020 at 7:24 AM, Ron Record said: I resolved this issue of deactivating and reactivating my provisioning module. Along the way I noticed that variable passed into my hook as the unique identifier for the client is: params['userId'] if the hook is added on OrderPaid and params['userid'] if the hook is added on ClientAdd Notice the only difference is capitalization of the 'I" in 'userId' for OrderPaid. This tripped me up since the parameter variable names are case sensitive. So be sure to lean over real close to the screen, take off your glasses, and squint when coding these variable names in your hooks 🙂 Thanks again to @Kian for the prompt response and assistance. So how exactly did you deactivate and reactivate your provisioning module? Edited January 26, 2021 by mustardman 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.