Jump to content

Activate/Deactivate My Module Hook


Ron Record

Recommended Posts

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.

Link to comment
Share on other sites

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 by Kian
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 9 months later...
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 by mustardman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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