Skip to Content

Drupal Modules 101: Introduction, installation, and removal

Or: The What, When, Where, Why, and especially How

Versions of this talk has been presented at:

What are modules?

Drupal is designed to be modular. Instead of always having every possible tool or feature in every site's code, you can just have those you're actually going to use.

Drupal core —what you get when you install Drupal— is like a very basic box of Lego™: a platform and some basic bricks (modules) to get you started. You can do a lot with just those basics, but usually you'll want more.

That's where contributed modules come in. Contributed modules are packages of code that extend or enhance Drupal core to add additional (or alternate) functionality and features. These modules have been "contributed" back to the Drupal community by their authors.

When should you use contributed modules?

"The Drupal Way" can be summed up as both "Don't re-invent the wheel" and "Share and share alike". Although you may be perfectly capable of writing your own custom module to add some feature/functionality to your Drupal site, you should always first check to see if there is an existing module that does (or nearly does) what you want.

Using contributed modules not only saves initial coding time, it also makes it significantly easier for you and, especially, others to maintain the site in the future. Contributed modules also benefit from multiple eyes and multiple users to find problems and improve code.

Where can you find contributed modules?

Contributed modules live on Drupal.org, specifically, at http://drupal.org/project/modules. You can search the module list and filter it by category, Drupal version, and status. You can also sort based on most installed, title, author, last release date, etc.

Why should you choose one module over another?

Choosing which contributed modules to use is an art. There isn't an easy list of objective criteria to be checked off. There are, however, various factors that should be weighed when evaluating modules:

  • Suitability for your purpose
  • Release status
  • Recommendations by experienced Drupallers
  • Usage statistics (http://drupal.org/project/usage/[module_name])
  • Issue queue (not just outstanding issues, but response time, etc.)
  • Development activity
  • Author & maintainers

For more about how to choose modules, see Karen Stevenson's excellent session at DrupalCon Munich 2012 There Might (Not) Be a Module for That.

How do you install modules (step-by-step)?

For both Drupal 6.x and Drupal 7.x, there are just four major steps to adding a contributed module to a Drupal site:

  1. Upload the module code
  2. Enable the module
  3. Set permissions for the module
  4. Configure the module

The four steps in detail

  1. Upload the module code
    • Upload (install) the module's file directory into the sites/all/modules/ directory
    • Preferably, upload as a compressed archive (.zip, .tar.gz) and expand the archive on the server (rather than expanding on your desktop and uploading as a folder with individual files). This is both quicker and avoids potential problems with file permissions or invisible files not making the transition.
  2. Enable the module
    1. Go to the Modules administration page:
      • Drupal 6: Administer->Site building->Modules (/admin/build/modules).
      • Drupal 7: Modules (/admin/modules).
    2. Enable (check) the relevant module and sub-module(s), if any.
    3. Scroll down to the very bottom of the page and click the Save configuration button.
  3. Set permissions for the module
    1. Go to:
      • Drupal 6: Administer->Site building->Modules, then click Administration by Module page in the third paragraph down (/admin/by-module).
      • Drupal 7: Modules (/admin/modules).
    2. Find the relevant module.
    3. If present for that module:
      • Drupal 6: Click Configure permissions
      • Drupal 7: Click Permissions
    4. Set permissions as appropriate.
    5. Scroll down to the bottom of the page and click the Save permissions button.
  4. Configure the module
    1. Go to:
      • Drupal 6: Administer->Site building->Modules, then click Administration by Module page in the third paragraph down (/admin/by-module).
      • Drupal 7: Modules (/admin/modules)
    2. Find the relevant module.
    3. If present for that module:
      • Drupal 6: Click [Module name] settings and, in turn, any other link(s) (besides Configure permissions or Get help)
      • Drupal 7: Click Configure
    4. Configure as appropriate.
    5. Don't forget to Save any configuration changes!

How do you uninstall modules (step-by-step)?

For both Drupal 6.x and Drupal 7.x, there are just three major steps to removing a contributed module from a Drupal site:

  1. Disable the module
  2. Uninstall the module
  3. Delete the module code

The three steps in detail

  1. Disable the module
    1. Go to the Modules administration page:
      • Drupal 6: Administer->Site building->Modules (/admin/build/modules).
      • Drupal 7: Modules (/admin/modules).
    2. Disable (uncheck) the relevant module and sub-module(s), if any.
    3. Scroll down to the very bottom of the page and click the Save configuration button.
  2. Uninstall the module
    1. Return to the Modules administration page:
      • Drupal 6: Administer->Site building->Modules (/admin/build/modules).
      • Drupal 7: Modules (/admin/modules).
    2. Click the Uninstall tab.
    3. Select (check) the relevant module.
    4. Click the Uninstall button. 
    5. When asked "Would you like to continue with uninstalling the above?", confirm by clicking the Uninstall button.
  3. Delete the module code
    • Remove the module's file directory from the sites/all/modules/ directory

 

Tagged in:

Comments

question - author/maintainers??

Question about "Why should you choose one module over another?" ... Author & maintainers:
Which factors about "Author & maintainers" are you checking when you evaluating some modules?

Author & maintainers

Whoops, meant to reply to this much sooner! Anyway…

As you get more involved with Drupal, you often become familiar with various contributors and their work. So when a module is contributed by or maintained by someone who you know does good work (both from coding and maintenance standpoint), that can be considered a Good Sign. It is just one factor among many, and if a module you're interested in is written/maintained by a contributor you know nothing about, that's just a factor you don't get to make use of, rather than something to count against using the module. (I do not recommend spending time trying to research the reputations of contributors you don't know —just evaluate based on the module, it's issue queue, module recommendations by experienced Drupallers, etc. in such cases.)