I have the User IP Log that displays the logged data using a default view defined in the module; when the module is disabled, the view page becomes broken, throwing PHP warnings and notices.

I would like to disable the default view when the module defining it is disabled, to fix the PHP warnings I get. Is it the right way of handling this? If it is so, what API could be used for disabling the default view defined by a module?


1 Answer 1


hook_disable() is what you are looking for:

Perform necessary actions before module is disabled.

The hook is called every time the module is disabled

Remember to do inverse actions with hook_enable(), which is used when a modules is enabled, install hooks don't fire when a module is re enabled.

Also if you need to track enable/disabling of another module you can use hook_modules_disabled() and hook_modules_enabled()

(it looks like you found it, but adding an answer for others is always good).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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