Is there any way to prevent Admins from disabling a module. Is there anything that can be done via code?


If you're looking for a per-module solution, add the required property to its .info file.

As of version 7.x, modules and themes may specify that they are absolutely required and should never be disabled by adding required = TRUE. These modules will be enabled automatically during install. In most cases it should only be used with the Drupal core required modules (e.g. Node, User, etc.).


No code is necessary to do this. You can setup appropriate permissions for your "admins". Create a new role for these individuals that gives them all the rights they need minus the "Administer modules" under "System".

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.