Jump to content

Custom Addon Hooks not working

Recommended Posts

We had a similar issue once. A hook for one of our modules wouldn't work on one WHMCS installation but worked fine on the rest of our installations. It was a problem for weeks. At the end, I just left it. It wasn't something critical.

While we had the issues, I started developing another module which also used hooks. For some weird reason, this solved our issues with the first module's hooks - despite no changes being made to that module. The two modules didn't even use the same hook events. I still don't know what went wrong.


Make sure that the addon is enabled (try disabling and enabling again). Try disabling most of your code in that hook except something line "logActivity('test');".

Link to comment
Share on other sites

@Waiting for Approval



Please note that hook files are detected at the time a provisioning, registrar, or addon module is activated. If a hook file is added after the module has already been activated, some additional steps may need to be performed for WHMCS to recognize it. For provisioning modules, this can be accomplished by accessing the Module Settings tab of an applicable product under Setup > Products/Services > Products/Services and clicking Save Changes. For a registrar module, re-saving the settings for it under Setup > Products/Services > Domain Registrars would be sufficient. Finally, for addon modules, re-saving the settings under Setup > Addon Modules will address this.

Also be sure that your filename is hooks.php. I wasted lot of time trying to understand why the file myhook.php was working at includes/hooks/ and not at modules/addons/..... I forgot to rename the file to hooks.php

As advice: Let your hooks at includes/hooks/. You can change them as many times as you want. The only problem is that if you upload the hook before activating your module, in most cases you'll get database error in public area (if your hook have queries).


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.

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