Drupal site in a day

What is Drupal good for? Drupal is often used for creating complex organizational websites that might take weeks or months to develop from initial plans to launch. But what if you need a site, like, tomorrow?

Rob Wipond, a journalist friend of mine, came to me recently with just such a request. Municipal elections were two weeks away and he needed to get a website up immediately where candidates and citizens could sign onto an alternative economic statement ahead of the elections. He was familiar with Wordpress and had tried to get it to do what he needed, but no dice. His needs weren't overly complex, but they were specific and, at least with his skill level, Wordpress wasn't doing it for him.

Build a site in a day? Rosemary Mann and I at Chocolate Lily like a challenge, so we signed on. Was Drupal up for the task? You bet.

Building an instant but customized site is a good test case for what Drupal can do, and also a good entry point to understanding the basics of site building with Drupal.

So here's how our day went.

Defining the specs

Sometimes we'll allocate weeks for a "discovery" phase of a project, carefully working through with a client just what their needs are on a site. Here we had maybe an hour.

Luckily, Rob had a pretty clear idea in his head of what he wanted and - just as important - was great at describing that picture. He wanted:

  • A home page that would present a "consensus statement" on community economies with the names of initial signatories, maybe in two columns, and, below that, in three columns, a list of groups, citizens, and political candidates who had signed on. If a list of signatories got too long, it should be cut off with a link to a separate page where the full list could be browsed.
  • An easy form where anyone could sign on, anonymously, adding some information about themselves and an optional comment. Some of this information was for public display, but some - e.g., email addresses - was private and should be accessible only to the site administrator.
  • A separate page where just the comments would be browsable in a pagable list.
  • A contact form.
  • Some measure against spam.

Okay, sounds straightforward at least. Let's get to work.

Building the site

To get this done pronto, we had to rely on the simplest and most proven Drupal solutions that fit the spec.

Quick, download and install Drupal 7.

Content type and fields

Okay, so let's start with the basics. One of the key bases of Drupal's flexibility and power is its ability to produce highly customized content types.

Here, we have only one custom content type to build: a signatory. This content type will produce the form site visitors fill in to sign onto the statement and also the information about signatories we display on the site. A content type is built of fields, defined by the particular attributes that need to be captured and displayed. Here that includes things like the signatory's name and website address.

According to Rob's spec signatories needed to be classified by type - organization, citizen, electoral candidate - so we used Drupal's built in taxonomy system for this, adding a vocabulary and terms.

While Drupal core comes with basic functionality, a wealth of modules can be used to add particular pieces of functionality. Determining which modules are available and best suited for a particular purpose takes some learning. For additional fields on the content type we used some of the many Drupal modules that provide specialized fields: Email field for capturing signatories emails and Link for website addresses.

To ensure private information wasn't publicly exposed, we configured the display for each field in the "signatory" content type. And we configured permissions so that anonymous site visitors could post new "signatory" content.

Great, got our content ready. Now to work up some displays.

Lists of content: Views

Recall that a key requirement for Rob was that we display signatory information in very particular ways. On the home page we needed three different lists of signatories, each filtered by type (organization, citizen, candidate). Only certain fields should show in these lists.

Did someone say lists? Enter the most-used Drupal module: Views. Views makes it easy and quick to produce customized lists--of comments, site users or, as in this case, content. While building views takes a bit of learning, there's great inline help available - just install the Advanced help module - as well as dozens of online tutorials and resources.

We configured a quick view with multiple displays (variations), including one using a contextual filter to allow filtering by different types of signatories. We used a special kind of views display, a "content pane"--more on content panes and filtering below.

What's next?

Putting it all together: Panels

With our content type and views in place, we needed a quick and easy way to arrange them on a page, producing the custom home page layout Rob was picturing.

Here the Panels module was just the ticket. Panels makes it quick and easy to produce customized layouts and add to them anything you want--like views displays. You can also create custom content to add to panels, which is what we did for the "consensus statement" as well as the list of original statement signatories.

Panels comes with several different page layouts and also allows you to create your own. We started with a simple mini-panel, where we displayed the original signatories in two columns. Then we added this mini-panel to a page layout where we also put the consensus statement. Below that, in three columns, we added the signatory lists.

Here we could take advantage of the views "contextual filters" we set up before. What we wanted were really the same list three times, only with different filtering. Panels configuration allows just that. We could add the same view display three times, each time specifying a different signatory type. As a bonus, Panels used the correct signatory type in the title for each of our lists. Nice!

Picking a theme

A theme defines the look and feel of a Drupal site. Often an organizational website will feature a custom theme, specially produced and tweaked to present the image a particular groups wants to present to the world.

But for a one-day site? Forget it. What we needed was something that worked for Drupal 7, fit the general focus of the site, and was simple enough to work with our minimal design.

Finding a ready made Drupal 7 theme isn't as easy as it could be. When you browse the list of most used themes filtered by version, what you get mostly isn't ready to use themes at all. Instead, the list is mostly filled with what are called base themes--starter kits that make it easier to design your own Drupal theme.

Great no doubt if you're a designer, but useless for our purposes today. We dug a bit deeper and came up with Tarski, one of several themes that have been ported to Drupal from other content management systems. Simple, clean, and it installed with no obvious errors.

Just one detail to fix. The theme had built in advertising for the company that had ported it to Drupal. Ugly--but easy to fix. Themes are built using fairly simple template files. I did a quick text search and edited out the ad.

So far so good, but most of our day's up. What's left?

Finishing touches

Enable and configure the contact module so there's a contact form people can use.

Add a couple of blocks to display on the contact page and at the bottom of the site.

Add a top of page menu with links to the main pages we've created.

With our site roughed in, it's time for some quality assurance. Quick, throw the site up on Rob's web host and give him the login details.

What, no spam prevention? Oh, right. Download and install Captcha and configure it to apply to the form for signing on to the statement. Now we'll get those annoying but, yes, effective tests that supposedly sort humans from machines. (Why do I always seem to fail?)

It's great that emails are hidden, Rob notes, but what if I need to see them, like to generate a mailing list? Good point. Talk through Views with Rob over the phone. Lead him through the steps to create a new view listing all signatories with emails, and then restrict access to the new view. Wow, Rob says, this is cool, I'm starting to get a feel for this!

Hey, you know, Rob says, it'd be great to see the number of signatories displayed, so that people have an immediate sense of how this is catching on.

Uh oh, scope creep. But what the heck. I resort for the first time all day to coding up a PHP snippet, albeit only a line or two, and add the result to the front page panel.

And, Rob adds, I'd like some emails to go out when someone signs on, one to them to thank them for signing on and one to me so I know to review their post.

That's kind of specialized functionality, but luckily the Rules module makes it quick. Rules are actions that are taken when certain events occur and given conditions are met. I ran Rob through the process of creating an configuring a rule to send out the emails (action) when new signatories were added (action) by other than a site admin (condition).

And, Rob adds, I had this cool idea that if.... Okay, okay, I get it Nedjo! I'll add this to the follow up wish list!

And we're ready to launch. Rob had already registered a domain, so the site was now live at http://communityeconomy.ca. Rob and his colleagues blitzed their email contact lists and crossed their fingers. With only two weeks before the elections, was there still time to make a difference?

Celebration time

Absolutely.

Sign-ons started coming in from the day the site went public. By the end of the campaign nearly 150 people had signed the ambitious and progressive community economy statement, among them many electoral candidates. And nine of the signatories were subsequently elected: seven counsellors, a mayor, and a school board trustee.

With their one-day Drupal site, the Metro Victoria Community Economy Group had opened an important space for public engagement. They also came out of it with a ready made outreach list as well as a site ready to expand in new directions as their public engagement grew.

For us at Chocolate Lily, building a site in a day was intense and demanding but also tremendously rewarding. It reminded us of why we chose Drupal in the first place--to be able to put powerful and fitting tools in the hands of community activists and grassroots leaders.

As a test case, this site build affirmed Drupal's power and flexibility. Building on Drupal takes some knowledge, but it doesn't have to be expensive or painful. Fitting the right tools to the task, Drupal can get you just the particular, customized solution you need when you need it.

In a single day if need be.