Drupal 7 modules

Notes on Drupal 7 modules.

Chances are that if I mention a module on this page without describing it in any way, then there’ll be mention of it in my notes on Drupal 6 modules. Many modules haven’t changed much between Drupal versions.

Check my Drupal 6 notes if you don’t find what you’re looking for here, as many of them are also applicable to Drupal 7, particularly the notes on Drupal 6 modules - I don’t add information to this page if my D6 notes already cover it.

Index

Essential modules

When I say “essential modules” I mean those modules that will be installed on most web sites.

Core modules

  • Contact. Grant anonymous and authenticated users permission.

Contrib modules

Other listed in more detail below…

EU Cookie Compliance creates a pop-up informing the user about the presence of cookies.

  1. Install as normal.
  2. Enable ‘Display EU Cookie Compliance popup’ for Anonymous and Authenticated users.
  3. Configure at Configuration -> EU Cookie Compliance. Tick ‘Enable Popup’ so that the cookie message starts appearing for visitors. The defaults are ok, though I like to tick ‘Place the pop-up at the top of the website’, untick ‘Enable thank you message’ and set a ‘Privacy policy link’. You’ll also have to change the text format of each message, to Full HTML or Filtered HTML depending on your setup, otherwise you’ll see the message HTML tags in the popup.

CKEditor Link allows you to easily link to nodes from within CKEditor. Alternatively use Linkit with Pathologic, though at the time of writing CKEditor Link has beetter multilingual support.

  1. Install as normal.
  2. Enable ‘Access CKEditor Link’ permission for whichever roles you’d like to use it.
  3. Configuration -> Wysiwyg profiles -> ‘edit’ link for a profile -> Buttons and plugins section. Enable ‘CKEditor Link’ button.
  4. Configuration -> Text formats -> ‘configure’ link for a format. Enable CKEditor Link Filter and ensure it comes after most other filters but before any other path converting filters such as Pathologic or Path Filter.

Linkit

Linkit allows you to easily link to nodes from within your WYSIWYG editor.

  1. Install as normal (note: ctools and entity required at the time of writing).
  2. Create a profile via Configuration -> Linkit Profiles. Remember to select which roles are allowed to use the profile.
  3. Add the linkit button to your editor via Configuration -> Wysiwyg profiles -> Edit (a text format) -> Buttons and Plugins section.

Pathologic

Pathologic automatically converts internal links to be the correct URL in your WYSIWYG editor.

  1. Install as normal.
  2. Enable the Pathologic filter via Configuration -> Text formats -> Configure (a text format) and ensure that it’s ordered to be the last filter processed. If you have any other path converting filters be sure to order them appropriately.

Provides media file types that allow you to upload and manage media (audio, images, video, including web content) on your site. It provides a “Multimedia asset” field type which allows you to associate the media with nodes.

  1. Install as ususal, enabling Media and Media Internet Source and others as appropriate.
  2. Make sure that ‘allow_url_fopen = On’ is set in the php.ini files, otherwise YouTube thumbnails won’t show and the videos won’t play.
  3. Configure the media file types at Configuration -> Media -> File types.
    1. ‘Manage file display’ tab allows you to create displays that use site’s image styles. These file displays show as view options when you manage the display of any ‘Multimedia asset’ fields set on a content type - see below). Note that the module will have created a ‘square_thumbnail’ image style that is used for the ‘preview’ file display.
    2. You can add fields to a type via the ‘Manage fields’ tab (e.g. add an “Alternative text” field to images) and manage their display via the ‘Manage display’ tab. Note that there is a bug that prevents users populating these fields when they upload/add media to a node.
  4. Add ‘Multimedia asset’ fields to a content type.
  5. Create a new node of that content type and ‘Select media’ to upload from your computer, link to web content (e.g. YouTube using the Media: YouTube module), or use media that’s already been uploaded.
  6. Manage the display of the content type to change the field format shown when viewed (he available views are the displays set at Configuration -> Media -> File types -> Manage file display).

You can edit (and delete) media from the library via Content -> Media.

Permissions

  • ‘View media’ required to view.
  • ‘Edit media’ required to add/remove from a node via ‘Multimedia asset’ field.
  • ‘Administer media’ for ‘Media’ tab on Content page that allows admin of all media.
  • ‘Import media files from the local filesystem’ for an ‘Add file’ link on media admin page at Content -> Media tab.

Questions

What is ‘Add media from remote services’ for? - At least with Media: YouTube installed a manager can use the ‘Web’ tab to reference YouTube vids from the web. Perhaps ‘Administer media’ overrides it, even though it’s provided by a different module (a submodule).

Gotchas

  • If image thumbnails don’t show, make sure that the permissions on the image style directories (e.g. sites/default/files/styles/square_thumbnail) and all subdirectories are set to 755 so that the web server can write to them.
  • Media can’t be deleted via the ‘Delete’ button when you’re editing the media, as you’ll receive an error message saying “The file [filename] is in use and can not be deleted”. To delete media, do it via the select boxes next to the files at Content -> Media.
  • The module enables you to add fields to media file types, but you can only set the value of these fields when editing the media via Content -> Media. You can’t set the fields when you upload or add media when editing a node.

Metatags Quick

Metatags Quick adds support for metatags.

  1. Install and enable only ‘Meta tags (quick)’.
  2. Configuration -> Meta tags (quick) settings. In the ‘Create and attach’ section, select description and keywords for nodes, click ‘attach’ button.
  3. The selected metatag fields should have been added to each content type’s fields and set to display in the page’s head. Check Structure -> Content types -> ‘manage fields’ for all relevant content types to make sure the ‘(Meta)Description’ and ‘(Meta)Keywords’ fields (and whatever else you chose) have been created and check ‘manage dislpay’ to make sure they’re visible.

XML Sitemap

XML sitemap provides an auto-generated site map, which is useful for search engines to find your content.

After installation (with the ‘XML sitemap node’ submodule enabled), be sure to edit every content type that you’d like to appear in the map and set them to ‘Included’ in the XML sitemap section.

You will also need to run cron.php to have the sitemap generated.

Block Class

Block Class

Assign classes to blocks, which makes targetting them in your CSS much easier.

Useful modules

Contrib modules

  • Panels. Requires CTools. Enable Panels and Panel Nodes. Remember to enable ‘Views content panes’ in CTools to allow views to be used in panels.
  • Role Delegation. Allows role to be selected when user created without requiring ‘Administer permissions’ permission.

Others listed in more detail below…

Empty Front Page

Empty Front Page only show blocks on front page.

Views Bulk Operations (VBO)

Views Bulk Operations (VBO) allows you to perform operations on the results of a view’s query, like unpublishing all queried nodes.

  1. Install and enable Views Bulk Operations as usual (and Entity if not already installed, enabling Entity API).
  2. You should now have a ‘Bulk operations: Content’ and ‘Bulk operations: Content revision’ fields. Add one of these to make content available for bulk operations.

Rules

Rules allows you to create automated actions based on user and site behaviour.

  1. Install Rules, enabling Rules and Rules UI as usual (and Entity if not already installed, enabling Entity API and Entity tokens).
  2. Configure via Configuration -> Rules.

Views Bulk Operations with Rules

Rules in combination with VBO allows you to automate actions on views results.

E.g. unpublish all of a user’s content they are removed from a ‘subscriber’ role:

  1. Install Views Bulk Operations, Rules and Rules UI submodule as usual.
  2. Add a new view via Structure -> Views, ‘Add new view’. The view doesn’t need a page nor block display. Configure it to return all published content, with the contextual filter ‘Author: uid’ to limit the content to that created by a user.
  3. Add ‘Bulk operations: Content’ as a new field. The default configuration is fine.
  4. Add the ‘Content: Author uid’ contextual filter. Configure to hide the view when the filter isn’t available.
  5. Change the view’s pager to display all items.
  6. Save the view.
  7. Create a new role called ‘subscriber’ via People -> Permissions tab -> Roles section.
  8. Add a new rule via Configuration -> Rules, ‘Add new rule’. Have the view react to the ‘After updating an existing user account’ event.
  9. Add condition ‘User has role(s)’, leave the data selector as ‘account’, select the ‘subscriber’ role created earlier and ‘Negate’ to have the rule react when the role is removed.
  10. Add the action ‘Load a list of entity objects from a VBO View’, selecting the view created earlier in the ‘Value’ dropdown, with ‘[account:uid]’ as the argument data selector (‘Switch to data selection’ for auto-complete).
  11. Add a loop with ‘[entity-list]’ as the list data selector.
  12. Add an ‘Unpublish content’ action to the loop, with ‘[list-item]’ as the content data selector.
  13. Add a ‘Show a message on the site’ action to the loop, with a value like “[list-item:title] has been unpublished.”.
  14. Now, when a user is removed from the ‘subscriber’ role, all of their published content will be unpublished.

Address Field

Address Field makes an address field available to content types.

  1. Install and enable as usual (it requires Chaos Tools).
  2. You should now have a field type called Postal Address

Geofield

Geofield makes a geo field available to content types, for storing geographic data.

  1. Install and enable as usual.
  2. You should now have a field type called Geofield.
  3. Used in combination with the Address Field and Geocoder modules, you can automatically store geographic data associated with a particular address - see the Geocoder notes below for more info.

Geocoder

Geocode (or geocode on D6) with the geoPHP library.

This module allows you to automatically create geographic data from the data in other fields.

  1. Download the geoPHP library geoPHP.tar.gz and extract it to make sites/all/libraries/geoPHP directory.
  2. Install and enable Geocoder API module as usual (required libraries module).
  3. With the Geofield module installed, you should now have a ‘Geocode from another field’ widget available with the Geofield field.
  4. With the Address Field also installed, you could add a new ‘Postal address’ field and a ‘Geofield’ field with the ‘Geocode from another field’ widget, selecting the Address as the ‘Geocode from field’ option in the widget settings, to have the geofield automatically calculated from the address.

OpenLayers (with Address Field, Geofield, Geocoder or Geocode)

OpenLayers can be used in combination with Address Field, Geo Field, Geocoder (or Geocode when it’s on 7) to show content on a map.

  1. Install OpenLayers, enabling OpenLayers, OpenLayers UI and OpenLayers Views (requires Views).
  2. Create a new content type, called e.g. Place, and give it an Address Field, with a Geofield coded from the address field (as described in the Geocoder notes above).
  3. Create a new view, set to show Content of type Place.
  4. Add the content’s Geofield field to the view, selecting the ‘Well Known Text (WKT)’ formatter.
  5. Add an ‘OpenLayers Data Overlay’ display, setting its format to ‘OpenLayers Data Overlay’, with WKT as the ‘Map Data Source’ and the Geofield field selected as the ‘WKT field’.
  6. Add a ‘Page’ display, settings its format to ‘OpenLayers Map’ (overriding the default display) and choosing a suitable map type.
  7. Save the view. This gives as a map overlay layer that we can show on maps.
  8. Add a new map to OpenLayers via Structure -> OpenLayers -> Maps tab, ‘Add’ button. In the ‘Layers and Styles’ -> ‘Overlay Layers’ section, make sure that the OpenLayers Data Overlay we just created is enabled and activated.
  9. You can change the initial position and zoom of the map via its ‘Center & Bounds’ section.
  10. For popup info on click of a mapped Place, choose ‘Pop Up for Features’, selecting the appropriate layer), in the ‘Behaviours’ section.
  11. Save the map.
  12. Go back to the view and edit the page display to set the OpenLayers Map settings to use the map we just created.
  13. Save the view. It should now show a map of all our Places.

You can speed up the map by downloading the OpenLayers source, extracting it to site/all/libries/OpenLayers directory and setting its location at Structure -> OpenLayers -> Settings tab.

Bugs

  • The ‘Tooltip for Features’ option in a map’s ‘Behaviours’ section, which should show the same popup info on hover, is buggy in Firefox 9 and prevents you being able to click on the Place’s title to get to its page.
  • The ‘Keyboard controls’ option in a map’s ‘Behaviours’ section is buggy and will scroll the page at the same time as scrolling the map. More seriously, it causes the map to change locations when you change to another browser tab and back. It is on by default so best to turn it off.

Campaign Monitor

Campaign Monitor is a module for linking your site with the Campaign Monitor email marketing service.

  1. Install and enable Campaign Monitor module and its requirement Libraries, extracting/cloning createandsend-php to [drupal]/sites/all/libraries/campaignmonitor.
  2. Configuration -> Web services -> Campaign Monitor.
  3. Edit account details. The API key is found when logged in to Campaign Monitor at Account Settings as ‘Your API key’ (‘Generate my API key’ if it’s not there) and client ID found on Client Settings page as the ‘API Client ID’.

Lists should be added automatically if you’ve set the API key and client ID properly. ‘Subscribe to [list]’ blocks should have been created.

List settings

  1. Lists tab -> Add list.
  2. Get the List name from Lists & Subscribers -> [list] -> ‘change name/type’ page as ‘API Subscribe List ID’, and tick ‘Confirmed Opt in’ if it’s set under ‘List Type’. See http://www.campaignmonitor.com/api/getting-started/
  3. The confirmation success page should be set to whatever’s set for ‘Redirect unsubscribers to your own confirmation page’ at Lists & Subscribers -> [list] -> ‘Unsubscribe settings’ and the unsubscribe page should be set to the unsubscribe form action.

Commerce

Commerce provides tools to build an online shop.

Requires at least Entity API and Rules modules.

  1. Install and enable the Entity API and Rules modules.
  2. Install and enable Commerce, Product, Product UI (for building products) and Product Reference (for viewing products). These will require Commerce UI, Price and Line Item modules to also be enabled.
  3. Create a new product type (e.g. T-Shirt) via Store -> Products, ‘Product types’ tab, ‘Add product type’ link and add fields (e.g. colour, size) via the ‘manage fields’ link.
  4. For display, you need to create a content type for the product (E.g. T-Shirt display) via Structure -> Content types, ‘Add content type’ link. Give it a ‘Product reference’ field of the ‘Autocomplete text field’ type via the ‘Manage fields’ tab, selecting the product types you’d like to reference (e.g. T-Shirt).
  5. You can add products via Store -> Products, ‘Add a product’ link.
  6. To take payment from the site, enable the Cart module and its requirements.
  7. Add an ‘add to cart’ button to a product display via its ‘Manage Display’ tab, by choosing the ‘Add to Cart form’ as the product reference field’s formatter.
  8. Allow people to buy stuff by granting roles the ‘Access checkout’ permission at People -> Permissions -> Permissions tab -> Checkout section.
  9. Enable the ‘Payment UI’ module for Store -> Configuration -> ‘Payment methods’ page that allows you to create/enable payment method rules. E.g. with the Commerce PayPal module installed and Commerce PayPal WPS enabled, you’ll have a ‘PayPal WPS’ rule available, which when enabled will give the user a choice of PayPal when they checkout.
  10. Edit the rule’s action to change payment settings.
  11. To get rid of the billing information (name and address) form on checkout, go to Store -> Configuration -> ‘Checkout settings’ and disable the ‘Billing information’ pane.

References

Commerce Subscription

Commerce Subscription allows subscription payments via PayPal Website Payments Standard. A subscription will grant a role.

  1. Install module and its requirements (which include Commerce, Commerce PayPal, Role Reference, Date and others).
  2. You should now have a new ‘Subscription’ product type at Store -> Product Types tab.
  3. Create a new product via Store -> Products -> ‘Add a product’ -> ‘Create product’.

Whoops!.. Forgot to finish these notes on Commerce Subscription. I’ll update them when I next have to set it up. Sorry!

Media Gallery

Contrib module dependencies:

Contrib library dependencies (optional):

  • ColorBox. Optional but necessary for lightbox display to work (though gallery gracefully degrades).

Permissions

  • Grant ‘View media’ and ‘Edit media’ to editors, to allow them to view and upload images.
  • ‘Administer media’ required to allow editors to view media from the Content section.

Bugs

On testing, all works ok except for the following problems:

  • ‘Undefined index’ errors on enabling module, resulting in no descernable problems.
  • Incorrect permissions on sites/default/files/styles/* directories, resulting in broken images in gallery. Easy to fix by changing permissions on the directories created (go+rw).
  • Lightbox won’t work unless Colourbox library is installed into sites/all/libraries/colorbox.
  • Lightbox has scrollbars and doesn’t centre images. I’ve corrected this styling with our f3_media_gallery_customisations module.

Gotchas

The Media Gallery will create a taxonomy vocabulary called ‘Gallery collections’ with term ‘Galleries’. These will be hidden from the normal taxonomies page at Structure -> Taxonomy. The Galleries page that is created by the module is actually showing nodes associated with the ‘Galleries’ term and is identical to /taxonomy/term/[tid] (where [tid] is the id of ‘Galleries’).

Simplenews

Simplenews for mailing lists.

  1. Install as normal, enabling ‘Simplenews’.
  2. It will have created a new content type called “Simplenews newsletter” (though you can configure it to use your own content type).
  3. It will have created a new tax vocab called ‘Newsletter’ (though you can configure it to use your own vocab).
  4. Edit permissions to allow creation/editing of ‘Simplenews newsletter’ content, as appropriate.
  5. Grant ‘Administer newsletters’ for the ‘Newsletters’ tab on the Content admin page for newsletter management (note: ‘Access the content overview page’ permission needed to view the Content page).
  6. Grant ‘Administer simplenews subscriptions’ for the ‘Newsletter subscriptions’ tab on the People page for subscriber management (note: ‘Administer users’ permission needed to view People page).
  7. To allow visitors to subscribe, grant ‘subscribe to newsletter’ to anonymous users via Administer -> User management -> Roles.
  8. Configure via Administer -> Site configuration -> Simplenews.
  9. Enable ‘Newsletter: drupal newsletter’ block via Administer -> Site building -> Blocks.
  10. On subscription, a registered user will have an option to select their newsletters via My account -> Edit -> My newsletters tab.
  11. Create newsletter issues (in a newsletter category aka vocab) via Create content -> Newsletter issue.
  12. Manage subscriptions and send newsletters via Administration -> Content management -> Newsletters.
  13. Change ‘Default send action’ in Configuration -> Simplenews when testing is finished and you’d like to send newsletters properly rather than just sending to the test email.
  14. After creating a new newsletter, edit it then click its ‘Newsletter’ tab to send it, or alternatively send via the Content -> Newsletters tab. Cron is used to send newsletters by default.
  15. Resend newsletters via Content -> Newsletters tab.

Note that the ‘Synchronize with account’ option (in Administer -> Site configuration -> Simplenews ‘Subscription’ section) will assume that if there’s an existing user account with the same email as a new subscription request, the user account is owned by the person requesting the subscription, hence will associate the account with the subscription.

There are associated modules to add things like stats.

Bugs

Dev version 7.x-1.0-dev (01/05/2011 release): The update options (Send and Resend) in Content -> Newsletters do not work. If you want to send a newsletter you have to do it via newsletter edit -> Newsletter tab.

Dev version 7.x-1.0-dev (01/05/2011 release): Though sending a test email works, the newsletter won’t be sent out to subscribers if the config (Configuration -> Send mail) is set to send mails immediates rather than using cron.

Dev version 7.x-1.0-dev (01/05/2011 release): When sending plain text emails, you can either have the correct line breaks in the email or in the rendered node on the web site, but not both! Because of a bug in Drupal core, whereby the drupal_html_to_text() function is broken, newsletters created using any of the text filters (Full HTML, Filtered HTML, Plain Text) do not have their line breaks converted properly, resulting in an email with a single line of content. You can edit the body field of the newsletter content type to make the body use plain text (not to be confused with the Plain Text filtered text option!), which will result in an email with line breaks, but because no text filter is used the newletter will not have line breaks when rendered as a page on the web site. Patch simplenews_html_to_text.inc for a fix. You’ll find the patch here: Improve drupal_html_to_text().

Imagecache Actions

Imagecache Actions allows you to manipulate imagecache images, e.g. add a watermark.

  1. Install and enable Imagecache Action. Imagecache Canvas Actions is required for watermarking.
  2. Edit imagecache styles at Administer -> Configuration -> Media -> Image Styles.
  3. Click ‘Override defaults’ to add your actions.
  4. For watermarking, a semi-transparent PNG watermark image should be added to sites/default/files/watermark.png

Gotchas

Watermarking doesn’t seem to work with GIF images, perhaps because they’re indexed not RGB.

Potential modules

Last modified: 28/04/2014 Tags: ,

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top