Adding Modules to Drupal

motherlamentationInternet and Web Development

Dec 7, 2013 (3 years and 8 months ago)

104 views

Adding Modules to Drupal

Modules are to Drupal what Plugins/Widgets are to Wordpress; they’re extensions to add additional
functionality to the Drupal content management system. One thing to watch out for with modules in
Drupal is be sure to only choose modules that are designed to work with your version of Drupal; it
seems that even more than the other content management systems we’ve worked with, Drupal changes
things between versions so much that modules that worked in one version may not work in the next.
This is something to be very aware of if you are thinking of updating an existing installation; I would
recommend doing a clean install of the new version of Drupal in another directory and making sure the
modules you use will work before actually doing the upgrade. In addition, it is imperative that you make
a backup of your whole site before doing an update, just in case things go wrong.
1. To find modules, go to the following site: http://drupal.org/project/Modules
. If you look at
the dropdown choices, you will see that you can locate modules by viewing an alphabetical list
of categories, filtering by compatibility, choosing a status, searching the modules, and/or
choosing a sort method. I would suggest filtering by compatibility and make sure you enter your
current version of Drupal the box (if you are not sure what version you have, log into your
drupal site, go to Reports, then status).
2. I am going to download and set up a weather module. The one I picked was U.S. national
Weather Service (NOAA NWS) U.S. Weather forecast block, which can be found at
http://drupal.org/project/nws_weather
.
3. Once there, scroll down the page and you will see where you can download the module.
Download the zip file for your Drupal version (you are probably running version 7, but check to
be sure). Be sure to remember where you saved it.
4. Go to your Drupal site and log in, and then on the administration bar at the top, choose the
Modules link. Once there, click the “Install new module” link. This will bring you to the following
page:


5. Use the browse button to browse and find the zipped file you downloaded, then click the Install
button.
6. IT MAY GIVE YOU ERRORS. If this happens, hit your back button on your browser, then click on
Modules again. It should still display the weather module down at the bottom of the page
under the heading “WEATHER”. If it does not, follow the alternate steps below. If it works, skip
to the instructions below “alternate steps”.

ALTERNATE STEPS
1. Unzip the file you downloaded.
2. Open your ftp program and connect to your site, then go into the folder where you installed
Drupal and find the “modules” folder. Double click on this to open it, and then upload the folder
you just unzipped to the module folder.

3. Now log into your Drupal site and click on Modules in the administrator bar. The weather
module should be displayed at the bottom of the page under the heading of “WEATHER”. You
can now continue as normal.



7. You should see a screen that looks like the following. Check the “enabled” checkbox next to
“NWS Weather”, then click the Save button.


8. Now scroll down to the bottom of the page to see the Weather module again. It should now be
enabled, and you should be able to click on the “permissions” link.

9. On the permissions page, scroll down to the bottom of the page and check the checkboxes next
to “Access nws_weather” so that anonymous users and authenticated users can both view the
display, then click “save permissions” (see screenshot)



10. Now click on “NWS Weather” up in the administration menu bar. This is where you configure
what city you would like to see the weather for. I chose to put the latitude and longitude for
Peoria, IL, which is Latitude 40.74 N and Longitude 89.61 W. For latitudes west of zero, the
module uses a negative, so I entered 40.74 for latitude and -89.61 for longitude. If you want a
different city, go to google and type “latitude and longitude for” and put whatever city and state
you are looking for; it should come up with an entry that has the coordinates. I also entered
“Peoria, IL” for the display name. This screen also lets you change display options for your
module (see screenshot). Once you have configured the module, be sure to scroll down to the
bottom and hit “Save configuration”.

11. Now click on “Structure” on the administration menu bar, and click on “Blocks”. Scroll down to
the “Disabled” blocks, and click on “configure” next to “Multi Day Forecast” (see screenshot)


12. You can leave the block title blank if you’d like (it will just use whatever the default is for the
module), and then under your default theme, choose where the block should be displayed. In
my case, I chose “second sidebar”. You also have the choice of setting who can see it by page
(setting that it is only available on the listed pages, or that it is available on all pages except
those listed. You can also set what roles (anonymous user, authenticated user, administrator)
can see the block, or leave it unrestricted, same way with content type (article or basic page). I
left mine all unrestricted (see screenshot) so that everyone can see it. Be sure to hit “save
Block” after changing your settings.


13. It will take you back to the modules page. You should now be able to scroll down to the region
of the page where you told it to display (in my case, second sidebar), and it should show
“Multiday Forecast” there.
14. Now click on the “home” button up in the top left of your screen so you can see your site. It
should be displaying the weather in the spot you selected.