Creating an Online Newsletter with Drupal

By

This article was published by DeveloperTutorials.com, 2008-07-11, as a feature tutorial.

As part of the Information Revolution that is changing the way that the world works and plays, people are increasingly turning to the Internet for the information they use to make decisions — financial, professional, health, etc. Consequently, news publications that are printed and mailed through the post are being supplanted by portal news sites, blogs, and online newsletters (oftentimes referred to as "e-zines" — electronic magazines).

In the early stages of widespread Internet popularity, the majority of online newsletters were distributed through mass e-mailing to subscribers. But this approach has two significant downsides: Now that spam composes the bulk of e-mail messages, Internet users and ISPs are doing everything in their power to limit access to their e-mail inboxes. This naturally has made it much more difficult for legitimate newsletters to reach all of their paid subscribers (even though the typical newsletter publisher will repeatedly explain to recipients how to add the newsletter's address to an e-mail whitelist). Secondly, for paid publications that derive their revenues from subscription, and not advertising, e-mailed newsletters can simply be forwarded to multiple (nonpaying) recipients, who in turn can do the same, ad infinitum. This may lead to a popular newsletter, but certainly not a profitable one.

Fortunately, there is a much better approach, and that is the use of a website that houses the newsletter and also limits reader access to paying subscribers. The ideal tool for creating such a site, is a content management system (CMS), such as Drupal, which is what we will be using in this tutorial. Specifically, we will explore how to use a forum for organizing the newsletter contents and allowing subscriber feedback, and also how to use a Drupal module for controlling subscriber access.

Laying the Foundation

The first step in building a successful online newsletter site using Drupal, is to install Drupal and all of its needed components (PHP and either MySQL or PostgreSQL) on a Web server. DeveloperTutorials.com hosts articles that explain exactly how to do this in detail for PHP, MySQL, and Drupal itself.

Normally, it would be best to choose the most recent stable version of Drupal, which as of this writing is version 6.2. However, we will be making use of a module that does not yet have a 6.x version, and as a result we will be using Drupal 5.7, which is quite stable and well tested.

Assuming that you have a clean working installation of Drupal 5.7, create the administrator account — the first one — for the site. Login as the administrator, and set the basic configuration settings for your newsletter site, such as the site name, slogan, and mission statement. These settings can be found at Administer > Site configuration > Site information. Only the site name is essential, and for this tutorial we will be using the name "Ye Olde Newsletter".

Initial Theme

The default theme for Drupal version 5.7 is "garland", which has a clean and simple look, but tends to be overused by Drupal-based sites whose administrators have not bothered to change the default. So for the sake of variety, we will use another built-in theme, "bluemarine", which is equally straightforward.

In Administer > Site building > Themes, enable the bluemarine theme, set it to be the default, and click the "Save configuration" button (for this and all subsequent configuration changes). You can always choose a different built-in theme later, or install and use a third-party theme, or even create your own. But for now, this one will suffice.

Before leaving the Themes section, click the "configure" link for bluemarine. Disable the shortcut icon, since we do not have a favicon for this test newsletter. If you have an image that you would like to use as your site logo, upload the image now. For this tutorial, we will be using a very basic image of a scroll, to match the site's name.

If you now log out of your Drupal administrator account, your site should look similar to the screenshot below.

(By the way, to avoid having to log in and out of your administrator account to make changes and then see the results, it saves time to stay logged in using one Web browser, for doing your administrator tasks, and using a different browser for viewing the site as a visitor not logged in.)

The Homepage

The previous screenshot still shows, on the homepage, the initial welcome message after a fresh Drupal installation, because there is still no content for Drupal to publish on the homepage. The first content we will add is the homepage text.

While logged in as the administrator, go to Create content > Page, and set an appropriate title for the homepage text. In this example, we will simply be using dummy text for the page body. Under the "Publishing options" section, enable "Promoted to front page" so the text is displayed on the homepage, as seen below.

The text that you choose for your homepage should ideally explain why visitors to your site should become subscribers. In addition, if you plan on charging them a subscription fee to read your newsletter's material, then this page would be the logical place to put some sort of payment button. In this example, we added a linked button that takes the prospective subscriber to the PayPal Subscriptions page. (The details of setting up a PayPal account and creating a PayPal Buy Now button, are beyond the scope of this tutorial. All of that information can be easily obtained from the online PayPal documentation.)

The Newsletter

Now it is time to create the raison d'être of the framework we have built up so far — the newsletter itself. You have two options at this point: You can organize each issue of your newsletter as a separate page, or as a separate topic within a newsletter forum. In this tutorial, we will use the latter approach.

You also have the option of allowing subscribers to add comments to any of your newsletter contents. If you would rather not, then set the comment settings to "Read only". But in this age of social news sites, Internet users have become accustomed to being able to comment on just about anything posted. Also, allowing reader input will dramatically increase the odds of your being able to build an online community that is dynamic and interactive enough to keep readers coming back for more and paying a subscription fee to have that privilege.

To make use of Drupal's built-in forum capabilities, go to Administer > Site building > Modules, and enable the Forum module.

No forums exist at this point, so we need to create at least one to serve as a repository for the newsletter issues. Go to Administer > Content management > Forums, click the "Add forum" tab, and provide a name and (optionally) a description of the newsletter forum.

The other forum settings can be left as is.

In the "Create content" section, there is a new option, for creating a forum topic. Create a new forum topic for your newsletter's first issue, and assign it to the "Newsletter" forum.

Access Control

At this point, the forum has not been added to the site menu system seen by a visitor, whether authenticated (i.e., logged in) or not. Unfortunately, Drupal's native access control does not distinguish between forum and non-forum content. As a result, if you tried to prevent unauthenticated users from viewing forum content, then they would not even be able to see your homepage's text.

To solve this dilemma, we will use a third-party Drupal module. Download and install the Content Access module, specifically, version 5.x-1.3.

Go to Administer > Site building > Modules, and enable the Content Access module.

This module allows you to manage permissions for content types by role and author. Hence, we need to create a new subscriber role, in Administer > User management > Roles, as shown in the screenshot below.

Presumably, when you have verified that an authenticated user has paid for their subscription, you would assign that user to this new role. Edit the role's permissions so that users assigned to the role can read and post comments.

After you have saved the permissions changes for the new subscriber role, edit the permissions for the authenticated user role: For the comment module settings, disable their ability to access or post comments, since only subscribers should be allowed to do that.

Set the access control for this new subscriber role, so they can view and edit forum content: Go to Administer > Content management > Content types > Forum topic > edit > "Access control" to assign these settings. Change the settings so that only authors and subscribers can view and edit forum content,

Navigation

Subscribers will need a link in order to access the forum and read the newsletter issues. But casual visitors who are not subscribers, should not be able to access the newsletter forum at all, while authenticated users who have yet to subscribe, should not be able to access the newsletter issues.

First, let's make the "Forums" menu item more descriptive. Go to Administer > Site building > Menus, and in the Navigation menu, for the Forums menu item, click its "edit" link in the Operations column. Rename the menu to "Newsletter", and optionally add a description that appears when the user hovers their mouse pointer over its link.

The Newsletter menu item is contained in the Navigation block, so to control the visibility of the former, we modify the latter. Go to Administer > Site building > Blocks, and for the Navigation block, click the "configure" link. In the "Role specific visibility settings" section, set the block so that it only shows for authenticated users and subscribers.

When you have completed all of the aforementioned steps, an authenticated user who has not subscribed to the newsletter, will see zero issues in the newsletter forum:

But a subscriber will see all of the issues (in this case, the one sample issue we created). Clicking the Newsletter link in the left-hand column takes them to the forum:

Clicking the Newsletter link in the forum section takes them to the newsletter:

Clicking the link for a particular issue shows its contents:

There is much more that one can do for creating a compelling online newsletter. But this should be enough to get anyone started.

Copyright © 2008 Michael J. Ross. All rights reserved.