Packt Publishing has kindly provided me Michael Peacock’s Drupal 6 Social Networking to review. They have asked that I publish an except from Chapter 6, “Communicating with Our Users” and I’m glad to do so.
From what I’ve read so far, it’s a well written book that is useful for learning Drupal as well as for understanding why things are done in a certain way. I find the why to be practical… but I’m getting ahead of myself. Still reading (and playing with Drupal — it’s awesome).
Enjoy the chapter excerpt, and look for my review within a week or so (I hope!).
Our users can communicate with one another, which is great, but quite often as an administrator the need may arise for us to communicate with a user or users on our site. It may be to remind them about the web site or to inform active users about new changes to the site. In this article, you will learn:
- About mailing lists, and how to use them with our Drupal social network
- How to use an offline approach for contacting our users
- How to use blocks of content to get a message across to your users
We are going to look at a few different modules, some of which we will use. These need to be installed first, so let’s do that now to save us time.
We need to download the following modules:
- Addresses module to enable the Addresses, Addresses — Phone/Fax and Addresses — Users components.
- Simplenews module
And extract them to our sites/all/modules folder, and enable them via the administration interface.
A Look Back
We have already looked at one very important aspect to communicate with our users — user e‑mail settings. Within the User settings page (Administer | User management | User settings), we have a group of settings under the heading User e‑mail settings. These are various email templates that are sent to our users upon certain events, such as registration, account activation, password reset, account being blocked or account being deleted. The content of these emails can be very important depending on the nature of the web site. In our Dino Space site, we may use a very informal, welcoming and fun tone for our automated emails. But for a business-oriented social network, we would want to use a much more formal tone.
Don’t forget, many modules also have their own email templates for sending emails to users, all of which can normally be changed easily from their respective sections in the administration area.
Communicating on an Individual Basis
As we have installed the contact form module on our site, we can also communicate with our users on an individual basis using the contact forms on their profiles. This is handy for those times when we do need to contact an individual user, maybe because of complaints against them by other members of the community, or perhaps to invite them to become a moderator or contributor to the site.
Alternatively, we can contact the user directly via their email addresses listed in their accounts, as this is viewable from the administration area.
We may wish to contact users who have not been active on the site for a long time, to remind them that the site is still there, and that they would be welcome to become active in the community once again. Drupal records the time a user was last active, which allows us to easily sort the list of users by their activity.
A module (Inactive user) is available for Drupal 5, which is intended to contact inactive users automatically, but (at the time of writing this) one is not available for Drupal 6. You may wish to keep watch on the modules list on the Drupal.org web site to see if anything comes up in future http://drupal.org/project/inactive_user
Communicating with Individuals Publicly
Don’t forget, we also have access to all of the communication methods available for our users to communicate with one another, such as replying to posts, commenting on content, or posting on their profiles. So if we need to contact a user, and we can contact them publicly, we can use these features.
Drupal has a number of modules available for sending emails to our users. Many of them are still currently under heavy development, or had their development stopped after the release of a previous version of Drupal. One of these modules is Simplenews, which is a native Drupal system for managing newsletters.
One limitation of the Simplenews module, and most of the modules available, is that it can’t send to all our users; it requires users to subscribe to the mailing list.
We can manage the Simplenews module via Administer | Newsletter. The features available to us are quite comprehensive. Let’s have a look at how the module works:
- Newsletters are created and managed from here
- Users subscribe to various Newsletters
- Users can be imported into Newsletters to become a subscriber
- A message is sent to a newsletter (this is referred to as an issue) by creating Newsletters content
- Issues which have been sent are saved within the module
- Issues which have not yet been sent are saved within the module as drafts
By default, we have a newsletter, which is generic to our site based on our site name.
From here we can also create new Newsletters should we wish so. The Subscriptions tab allows us to see and manage the subscriptions to our various newsletters, the Sent issues tab lists issues sent out to the newsletter lists, and the Drafts tab lists issues which are still being written. From within the Settings tab, we can set how new issues for newsletters are created, as well as the email address shown as the sender of issues.
Don’t forget to set the permissions; you want your users to be able to subscribe to newsletters.
Users can subscribe to newsletters from within their account, or we can enable blocks for the relevant newsletters we have on our site.
To send an “issue” to our newsletter list, we need to create the issue as a new content element via Create content | Newsletter issue.
We enter the subject of our email as the Title, select the newsletter to send the message to from the Newsletter drop-down list, and the message is entered into the Bodybox.
Beneath these options, we have some newsletter specific-options within the Newsletter sending options box. These options allow us to set the priority of the email message (this is often ignored by email clients), if we wish to request a receipt to see if a user has read the message (this is also often ignored by email clients) and finally, we can select a sending method.
There are three sending methods, which are:
- Don’t send now — this won’t send the message, and will save it as a draft.
- Send one test newsletter to the test address — this will send the email message to the test email addresses, which can be set in the administration area. This allows us to review the newsletter, as if we were a subscriber, make any final alterations and then send it to our list.
- Send newsletter — this sends the email to our newsletter list.
How to Send an Email to All our Users?
We can use the module to send an email to all of our users, by taking advantage of the subscriber import feature. Within Administer | Content management | Newsletters | Subscriptions, we have the ability to Import subscriptions, as shown in the following screenshot:
Importing subscribers consists of entering the E‑mail addresses (separated by a comma) and selecting the newsletter which we wish the user to subscribe to. To get all of our current members to subscribe to the mailing list, we could export all of our users’ email addresses directly from the Drupal database, using a tool such as phpMyAdmin. If we use the tool correctly, we can even get the data in a comma-separated list ready to be pasted into the form.
In order to send HTML (that is, nicely formatted) emails, and emails as attachments to our newsletters, we would need to install the Mime Mail module from http://drupal.org/project/mimemail.
Give it a try
We have covered module installation and configuration extensively; so why not try and install the module yourself and experiment with HTML newsletters.
There are legalities involved with sending bulk emails, and mailing lists, especially with regards to SPAM. Most countries have their own laws relating to this.
When web sites send out bulk email campaigns, it is important to be careful about their frequency of emails. If all emails in the campaign are sent at once, this could be seen as a sign of SPAM, leading to blacklisting on mail servers, and also penalties from many shared hosts. If emails are sent out slowly, it may take a long time for a campaign to be sent out to all recipients.
The Simplenews module allows us to configure the frequency of the emails sent. These settings can be accessed from Administer | Site configuration | Simplenews | Send mail. Here the cron box is checked, indicating that emails are sent each time the Drupal cron script is called. The Cron throttle defines how many newsletters are sent each time the Drupal cron script is called. By default, it is set to 20, which is very low. So this should be changed perhaps to 100 or 500. You may wish to contact your hosting company for advice on email limits imposed by them.
Third Party Services
Besides allowing us to run our own email newsletter service from within Drupal, a number of the available modules allow us to make use of third-party mailing list systems.
PHPList is a popular mailing list system written in PHP, if we were to use this system (particularly useful if our Drupal social network is part of a group of sites, or part of a larger site which does not use Drupal), we can use the PHPList integration module to:
- Synchronize users from Drupal to our PHPList system
- Send targeted mailings based on the values of a user’s profile
- Allow users to manage their PHPList subscriptions from within their account
- Bulk import into PHPLIst, if we already have a Drupal installation running with many users
PHPList involves some server configuration; so if PHPList is the solution for you, make sure you read the documentation thoroughly.
Constant contact is an online email marketing service, which manages newsletter subscriptions itself, with a particular focus on privacy and security for subscribers on mailing lists. Drupal 5 had a module to easily link into a constant contact account. This module, at the time of writing is not available for Drupal 6. But it is worth looking out for updates of this module or an alternative module to take its place if you wish to use constant contact to provide newsletters for your social network.
Google Groups are essentially mini social networks that operate in a way similar to groups in our network with the Organic Groups module. Many organizations and projects, such as open source software projects, make use of Google Groups to complement their communication and collaboration areas. If you wish to use Google Groups to complement your social network, then there is a module to allow users to subscribe to your group directly from the site. The module can be downloaded from http://drupal.org/project/google_groups. This module would probably be of little use if you used the organic groups module because the organic groups module provides very similar functionality. Problems with using a service such as Google Groups is that we are limited in terms of controlling the layout of our communications losing any branding associated with our site, and a potential loss of revenue when we may have used advertisements on our site or on our own newsletter.
If our social network is an extension of something else, for instance an online supplement to an organization dedicated to the promotion and support of keeping dinosaurs as pets, then we may wish to contact users of our social network using an offline method.
The Address module allows users to supply a physical address and a telephone number, which means we could post newsletters to our users. This would primarily be of use to organizations which are already producing paper mailers to a wide audience, where the online social network is used to complement the services provided by these organizations; otherwise offline contacting may not be cost effective.
The Address Module
Having installed the address module, and having given users permissions to create an address book, we can collect the addresses, telephone numbers, and fax numbers of our users.
From the user’s perspective, they can easily store and edit addresses and contact details from within their accounts, via the Address Book tab.
Unfortunately, this module was designed to complement other modules (for example, the e‑Commerce module) in providing a convenient location for users to store their address for later use (such as ordering products for delivery with the e‑Commerce module). There is no back-end interface to allow us, as administrators, to view the contact details of our users. We can, however, gain access to the information from the database directly, and can then maintain our own records from there, or from the $user array via custom PHP code. An alternative would be to create additional user profile fields, which can be read only by administrators.
Modules and themes often make use of blocks to display small blocks of content in specific areas of the web site, generally including the web sites header, the sidebars on the left and right-hand side of the screen, the footer, and the main content area, as well as dynamic functionality, such as group information in the Organic groups module. Blocks we have previously been using, such as with the Organic groups module, are dynamic and populated by the modules that created them. Blocks don’t have to be dynamic; we can create blocks of our own to display content that doesn’t change dynamically.
We can make use of these blocks to display information and messages to our users. For instance, if we wanted to communicate with guest users, we could create a content block with information on the benefits of joining the site.
Creating a Content Block for Anonymous Users
- Navigate to Administer | Site building | Blocks.
- Select the Add Block tab
- Enter a Description, Title and Body for the block, with the benefits of joining in the Block Body box.
- Under Role-specific visibility settings, select Show Blog for specific roles for anonymous users.
- Under Page-specific visibility settings, select the block to be visible on all pages.
- Save block.
Once created, the block is displayed on our site for users who are not logged in:
Theme Customizations for Communication
We could also user the look and feel of our site to communicate with users. The following are some examples of what we could do:
- A simple bar of information, perhaps relating to a specific feature
- CSS (cascading style sheets) pop ups with information
- A collapsable message, where the user can click an icon to expand an administrative message, which we can update periodically
These options require knowledge of HTML, CSS, and Drupal Themes.
In this article we looked at how we, as administrators, can communicate with our users using a variety of methods, including:
- Newsletters and mailing lists
- Third party mailing lists
- Content blocks
We now have a fully functional social network. Our users can contribute to the site, communicate with each other, and we can communicate with them.
About the Author
Michael Peacock is a web developer from Newcastle, UK and has a degree in Software Engineering from the University of Durham. After meeting his business partner at Durham, he co-founded Peacock Carter, a Newcastle based creative consultancy specializing in web design, web development and corporate identity.
Michael loves working on web related projects. When he is not working on client projects, he is often tinkering with a web app of his own.
He has been involved with a number of books, having written three books: Drupal Social Networks, Selling Online with Drupal e‑Commerce, Building Web Stes with TYPO3, and acted as technical reviewer for Mobile Web Development and Drupal Education & E‑Learning.
You can follow Michael on Twitter