Third-Party Modules

One of the greatest things about Drupal is that it adheres to the open-source paradigm. This fosters community development, which in turn promotes and increases the diversity of any given project. One of the spin-offs from this is that community members who overcome certain obstacles or create something new and useful can, and often do, take the time to share it with everyone else. This is an exceptionally valuable property of most, if not all, open-source projects.

What this means for us is that we can take a leisurely scroll over a variety of modules that have been made by someone, improved on by someone else, or changed into something else, and pick and choose what we like the most. The converse of this is, of course, that you can make any of your own developments available for everyone else to use when the time comes.

For now, there are certain issues associated with using contributed modules such as the one we are going to incorporate into our site here. It is important to understand that people are providing useful software without enforcing payment. Hopefully, you will take it upon yourself to drop the developers a line every now and then to thank them for any functionality they have spent time and effort on that you may benefit from.

Secondly, because more often then not there is only one developer or a small group of developers, you need to understand that there is no huge budget, with lots of computer geeks tapping away day and night. This means that contributions, like any software, are subject to bugs or errors, and you should always make sure that your site, including the database, are protected by making backups before implementing any changes. (For more information on properly backing up your site, see Chapter 10) This is in line with best practices when it comes to dealing with software—if something breaks your code, then it is your responsibility, and not the contributor's.

With those two rather serious points out of the way, let's begin.

Downloading Modules

The Drupal website houses a list of contributions that are available for you to add under the Modules tab of the Downloads page (http://drupal.org/project/modules). At the top of the Modules page there is a selection of Drupal versions from which you can choose the appropriate one, and then browse the modules by name, category, or date, as shown here:

Downloading Modules

As we saw in Chapter 1, obtaining the correct version is very important because you cannot assume that a module developed for the 4.6.x family will work with the latest 4.7.x family. In fact, it is probably a bigger issue now than it will be in a year or so, since Drupal has only just reached the 4.7.x family. Unfortunately, the upgrading of contributions is not necessarily done at the same time as the core development; so it may be that there are some modules you can only implement in older versions of Drupal—hopefully by the time you read this, most modules, if not all, will have been made compatible with 4.7.x.

For the purpose of the demo site, one contribution that we will need fairly soon is Taxonomy Access Control, which can be found under the Categories section, assuming you are searching by category. Navigate there, click Download, and save the zipped file to your machine. You might find it more expedient to create a directory, say drupal_downloads, to save these files to. Of course, once the module is installed you no longer need the zip file. It may be useful to maintain a copy just in case, but if you are certain you won't need it again, remove it once everything is up and running.

That's all there is to downloading modules. Before we move on, it's a good idea to take a look over the list of all modules available to see what you can actually achieve with Drupal. For example, did you know that you can use Drupal as an e-commerce website, complete with products or services and a shopping cart? You can implement all types of payment facilities such as PayPal, or credit cards and pretty much anything else that a fully-fledged online store would need—or will be able to once the E-Commerce module has been upgraded to work with 4.7.

Learning just what you can easily achieve with Drupal modules now can really cut down the amount of time you spend developing or looking for solutions to problems later on.

Installing Modules

Each module download can be different depending on how it needs to alter the system in order to function. The best way to learn about how to install modules is simply to go ahead and do it. Since we have already downloaded one, let's continue on and install it.

Open up the .gz file that you saved on your machine (refer to the previous section). Depending on the module in question you will have anywhere from one file to tens of files. As many will have license information in them, ensure that you take the time to read over these before you go ahead and use them. Apart from that, the first thing you need to do is open up the readme file as this will, more than likely, have some detailed information on what you can expect from the module, and how it functions.

Assuming you are happy you have the right module for the job, the next file to open up is the install file, usually something like INSTALL.txt. This will give you a list of instructions to follow in order to set things up properly. More often than not, this involves making some sort of adjustment to your database as well as adding the relevant .module file to your modules folder under the Drupal home directory.

Sometimes the developer of the module will add notes to guide your usage of the contribution. For example, in the case of the Taxonomy Access Control module, we are advised not to use it in conjunction with other access-related modules such as OG or node_privacy_by_role. That doesn't mean you can not—just that you should ensure you know exactly what you are doing before going against suggestions like the one provided with this module.

Another bit of advice that might save you a lot of trouble at some stage in the future is to make a backup of your database, or any important files, before making use of a module. The reason being is that Drupal is moving to a more user-friendly, plug-n-play type of setup where all that you need to do extract the module file to the modules folder and away you go. The module itself takes care of any changes required to be made to the database automatically. This makes it easier to install it because you no longer have to issue commands like:

$ mysql u<username> p drupal <C:apache2triadhtdocsdrupalmodules	axonomy_access	axonomy_access.mysql>

in order to get things working. Of course, not all modules work like this, so use the command shown here to execute whatever scripts are necessary for any other modules you install. Remember to change the username, as well as the file path, to reflect the specifics of your system and the module being installed.

With some contributions performing their own database modifications automatically, it is now easier to install a module, but it is also easier to shoot yourself in the foot. This is because the changes take place behind the scenes without you having direct control over them. Admittedly, these changes, more often than not, are fairly harmless, but you never know.

To get things moving, we simply extract the contents of the download to the modules folder. Once that is done, there is now a folder called taxonomy_access in the modules directory.

Note

It is good practice to maintain separate folders for each additional contributed module in the modules folder. Doing this allows you to keep track of which module files have been added, and which are the core files.

That's pretty much all there is to do behind the scenes, but we still need to ensure that we can make use of this module from the administrator's point of view.

Log in to your site as the administrator and head on over to the modules section under the administer menu item. Scroll down the list of available modules and you should come across your new taxonomy_access module, like so:

Installing Modules

Enable the module and click Save configuration. That's it, all done!

Naturally, we still need to test out the module and put it to work. It is used in the following chapter however, so we won't discuss it any further here. You should be confident that you can now select, download, and install any module you like. Let's move on and look at how to configure the standard modules that we enabled earlier.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.227.69