I want to execute some code in my custom module to display status reports even though my custom module is disabled.

hook_requirements() can be used to display status reports, but it only works when the module is enabled. I want this to work even when the module is disabled.

How can I achieve this?

1 Answer 1


That's not possible.

For hooks to be executed, your module must be enabled. From the docs:

To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it.

Emphasis mine.

Allowing modules to run code even when they're not enabled would be a massive security risk, and could cause all sorts of other unforeseen problems.

  • 3
    Hint for OP: You can always split your module, and keep the reporting part in the one you will keep enabled.
    – Mołot
    Feb 5, 2014 at 15:29
  • @molot thanks for your suggestion. Is it possible to auto enable the module which will display status reports when the site is moved from production to development server? Feb 6, 2014 at 4:46
  • @GanesanGopal it's possible to do pretty much anything in your migration scripts.
    – Mołot
    Feb 6, 2014 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.