You are here

Drupal’s admin interface: Modules section

The Beginner's Drupal Administration Series

ContentStructureAppearance •  People • → Modules ← • Configuration • Reports


There are four pages you can get to within the Modules admin section to

  • enable & disable modules,
  • install new modules,
  • update modules and
  • uninstall modules you've already disabled.

Enabling and disabling existing modules

If you just click on the top-level 'Modules' menu item directly, you'll get a list of all the modules that are currently available for your Drupal site.  This will list all modules that are either in

  1. the /sites/all/modules/ directory
  2. this specific site's /sites/<my site>/modules/ directory

It will list all modules, whether they are enabled or not, grouped by the 'package' in which they appear according to their .info file.  Every Drupal site will have the 'Core' section at the top, which includes all the modules that come with Drupal core.  That is the only section that will appear in a clean Drupal install.  The remainder of the sections just depend on which modules you have on your particular site.

Modules page in Drupal

To enable or disable a module that is already available on/for your site, simply check or uncheck the little checkbox next to it, and hit the 'Save configuration' button at the bottom of the page. 

If the checkbox is grayed out when you're trying to enable a module, that means one of the modules it *requires* is not on your site.  Read through the list of 'Requires' modules to see what may be missing and add any pre-requisite modules on your site before you can enable that one.

If the checkbox is grayed out when you're trying to disable a module, that means there is another module you need to disable *before* you can disable this one.  This happens frequently for modules that come together in a package.  Frequently they have to be enabled and disabled in a certain order, so simply try to disable its 'package' peers first and the box should become active.

Installing new modules

The above (enabling/disabling) can only be done for modules that are already on your site.  But what if you're trying to add a module to your Drupal site that isn't on that list yet?  Fear not!  There are two ways you can do it:

Adding a module through the file structure

Adding a module through your site's folder structure gives you the most control.  This is the method I always use!

  1. First, I download the module's .zip file (just in the Downloads section of the module's Drupal project page)
  2. I unpack it into my customized version of the /sites/all/modules/ folder
    • I have /contrib and /custom sub-folders in there to separate my custom modules from the contrib modules I get online, so by unpacking the module folder myself, I can choose exactly where it should go.
  3. Go to or refresh the /admin/modules page on your site, and you should see the new module on there!
  4. I then push any new modules to my production environment through git commands, but you could also do this by dragging the new module folders through a file client like FileZilla or WinSCP.

Using the above method, though slightly more involved that using the UI (below) gives you the most control because you can choose to have a customized modules/ folder (like I do) and you can choose whether you want the module placed in your /sites/all/modules/ folder or in a specific site's modules/ folder, if you're dealing with a multi-site installation!

Adding a module through the UI

If you click on the Modules --> Install new module link from the main menu or go to /admin/modules/install, you can add a module to your site with the simple form presented.

Simply copy the tar.gz download link from your module's Drupal project page and paste it into the "Install from a URL" form option:

This puts the module directly in the /sites/all/modules/ folder (you don't get to decide that you want to place it in a /contrib folder under that).  It does not automatically enable the module, so if you want to use it, you still need to go to the modules listing page and enable it.

Updating modules

The Modules --> Update page lists all modules that you have currently enabled (it does not check disabled modules) that have posted patches/updates.  It's best practice to keep your Drupal core and modules patched and up-to-date to make sure that you not only have the latest bug fixes and cool, new functionality, but also to make sure that you have all the latest security fixes too!

The update page lists all your modules that need to be updated along with the module version you're currently using and the latest module version that is stable and recommended.

Here are the steps to updating your modules (I'm not going to go into updating Drupal core here, which is equally important, though cannot be done through the UI as modules are in Drupal 7).

  1. Back up your database before any module updates so you can revert back to that state if any of the updates introduce bugs or do not go through cleanly.  This happens!!  I've reverted updates on more than one occasion, so don't think "Oh, that won't happen to me..."
  2. Check the checkbox next to the module(s) you want to update and hit the 'Download these updates' button
    • Click on the 'Release notes' link next to each module to see what's new or updated with these modules' new releases
  3. First, Drupal will download the updates, and it will ask you whether you want to continue, reminding you that you should back up your database first!  How thoughtful!  Just press 'Continue' on the next screen if you've already backed up.
  4. Next, Drupal will run the module updates and remind you that you should run the database updates next!  What it's done so far is update the module files, which means it has added to, subtracted from or modified the module's code/functions.  This new functionality, however, sometimes comes with the need for a modified database structure.  Some module updates will require a new table column to be utilized or may even remove a column that is no longer used or update the schema in some other way.  That does not happen with every module update, but when it does, it's a separate action from the module's files being updated.  Soooo, go ahead and click on this next step to run the database updates.  You don't want your db tables not matching your module's expectations:
  5. Sometimes, after running the database updates, Drupal simply returns a screen that says "No pending updates." which means there are no necessary db changes with these module updates.  If there are any, it will print out the resulting messages, and just make sure that there are no errors printed out.  If there are, I would revert the site back and start searching the issue queue!
  6. That's it!  This newly updated module should no longer pop up in your 'Update' queue!

Uninstalling modules

The Uninstall modules page contains a list of all the modules on your site that have been disabled, but not yet uninstalled.  This requires some explanation!  When you disable a module through the /admin/modules pages, the module no longer runs on your site (none of its hooks are called, etc), however, the data it had in the site's database is not yet discarded.

So, if you decide to enable the module again tomorrow (or even in a month), it'll resume working just like it was when you disabled it - all its data will be available.  So if this was a module that allowed folks to bookmark pages on your site - all the bookmarks will still be there.  If this was a module that added special new fields to your nodes, those will still be populated.

Once you uninstall a disabled module from the uninstall screen - that's when the module's database data - all its tables or table columns and system variables are deleted.

After an uninstall, if you enable a module, it will act as if it's freshly downloaded from the internet.  None of your data or configurations will be there.

That doesn't mean that you shouldn't uninstall your modules, of course.  If you are no longer going to use a module, and certainly if you're deleting the module folder - uninstall it!  You should keep your database nice and clean.  If you just disable a module and then delete the folder, you won't be able to uninstall it (how will Drupal know which system variables and tables to delete without the module's .install file?), and your database will have that data in there forever, so make sure to uninstall before deleting a module folder. 

Hopefully this sheds some light on administering Drupal modules.  Let me know if you have any questions!

Share

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.