Creating an Online Newsletter with Drupal
This article was published by DeveloperTutorials.com, , 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 emailing to subscribers. But this approach has two significant downsides: Now that spam composes the bulk of email messages, Internet users and ISPs are doing everything in their power to limit access to their email 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 email whitelist). Secondly, for paid publications that derive their revenues from subscription, and not advertising, emailed 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 I will be using in this tutorial. Specifically, I 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, I will be making use of a module that does not yet have a 6.x version, and as a result I 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 I will be using the name "Ye Olde Newsletter".
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, I 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, I click the "configure" link for bluemarine. I disable the shortcut icon, since I 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, I 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 Home Page
The previous screenshot still shows, on the home page, the initial welcome message after a fresh Drupal installation, because there is still no content for Drupal to publish on the home page. The first content I will add is the home page text.
While logged in as the administrator, go to Create content > Page, and set an appropriate title for the home page text. In this example, I 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 home page, as seen below.
The text that you choose for your home page 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, I 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.)
Now it is time to create the raison d'être of the framework I 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, I 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 I 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.
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 home page's text.
To solve this dilemma, I 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, I 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,
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, I 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 I 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.