How I Got Involved: Social Networking in Drupal

Tue, Jun 29, 2010 - 7:05am -- Isaac Sukin

This blog post was originally posted to my blog at Mediacurrent. It appeared on Drupal Planet.

I got involved with Drupal in 2007 when I decided I wanted to build an online community of young people interested in politics in order to encourage their interest and activism. I was in way over my head; I had dabbled with a number of desktop programming languages, but I had never built a website. I got my first hosting account on my dad's recommendation, and it came with an installer for a large number of open-source software in a variety of categories. I researched each one, and it ultimately came down to Drupal or Joomla! as the only options that could potentially fulfill my vision of vibrant forums, in-depth blogs, stunning image galleries, relevant news, timely events, thorough user profiles, and close-knit groups. I ended up choosing Drupal 5 mainly because, as someone who had no idea what a CMS was, Drupal.org actually explained what Drupal was supposed to do for me. I was also put off by the number of paid add-ons for Joomla!, as my budget was zero.

Too many features

What I wanted to do was build another Facebook. I wanted to attract young people, to draw them in through the social aspect and then interest them in the content. I instinctively gravitated toward social networking because I knew from experience that it works. (The average Facebook user spends 15 minutes every day on Facebook – by far the most among the top websites in the world.) And I wanted to build a site that was fun, engaging, and ridiculously full-featured.

After several months of struggling and countless moments of enlightenment (for example, I realized that having 200 items in your primary menu is not a good site structure) I got pretty close in the feature department. I had built a website with most of the major features I'd wanted, albeit with a tasteless theme and a terribly clunky UI. And then, like millions of other hapless webdevs before me, I waited, and wondered why people weren't flocking to my site.

The end of this story is that after a lot of work the site hit a peak around the 2008 elections (some 20 active users, 400 page views/day) and then died off a few months later when I stopped having the time to take care of it. But I learned that a site doesn't need all of the zillions of things I wanted to add in order to be awesome. At one point I was running about 80 modules with no end to memory issues and extraordinary amounts of time spent updating them. In the end I cut the site down to a few essential features and only 4 menu items and it did much better.

The Facebook-style Statuses module

Out of that project grew what is today the Facebook-style Statuses module for Drupal. In the course of working on my social networking site I realized that users were shying away from blog posts (with their massive, gaping textareas begging for lengthy opinions) and forum posts (because of the intimidating nature of asking questions and writing opinions) and events (because nobody needed them) and groups (because the community was neither large enough nor cohesive enough). I decided the solution was (again) to imitate Facebook by creating status updates. Status updates, it seemed, were neither long, nor intimidating, nor irrelevant; and they were one way to ease in new users and build community. Status updates are so inviting, in fact, that almost everyone who sees a status update box will write something in it just to test it out, and they are often delighted by the result. That's certainly not the case with content types where the expectation is that each post will be a lengthy and well-informed opinion piece.

I explored a few options. I tried using a custom content type, but it was much too awkward and not at all designed for the brief, smooth experience I was hoping for. I looked for modules to help, but there were none. So I set out to build my first Drupal module, aiming for simplicity.

PHP

First, I googled how to build forms in HTML. The security issues were over my head and I couldn't figure out how to store the submitted information. Then I searched on drupal.org and discovered the Form API and SQL. (Drupal runs on a database? What a concept!) The Form API, much to my surprise, was relatively easy. MySQL was easy. And more importantly, the documentation for both was very good. That was my first introduction to Drupal as a library rather than Drupal as a platform. In fact, that was my first introduction to PHP (which also has fantastic documentation) and the first time I had really attempted anything serious in a programming language. And I really liked it.

Awesome

Over the next few months I read a lot of snippets and other modules' code. I read inordinate amounts of documentation and asked dozens of dumb questions in the forums. And in the end, I had a rather pathetic textfield with a submit button and a list of recent status updates that were pulled from the database without using Drupal's API and displayed without escaping dangerous characters. It was awesome.

Within a couple of weeks I was getting almost as many status updates per day as posts of every other type of content (including comments) on my site combined.

Three years and 668 commits later, that module is very stable (and even pretty stylistically accurate). Only 1% of all issues in the queue are not yet fixed. It integrates with over 20 other modules, uses sophisticated AJAX updating, allows #hashtags and @mentions, and supports threaded conversations. And on the over 2000 websites where it's used, it's been a startling success. The demo website alone now often gets almost as much traffic as the social network from which the module grew.

Social media bandwagon

What my social network needed was not to cram in every feature that Facebook had. What it needed was a way to draw in new users with a low entry barrier and maintain relationships between power users with a way to build connections and demonstrate authority and influence. Status updates, with the small, friendly textbox and instant-feedback stream, are the best way to do that. And maybe it's not the best idea to build a Facebook replica, but sites of all other shapes and sizes can similarly benefit from the boost in interest, influence, and fun that short bites of content provide to users. (In fact, I recently gave a presentation on that topic at DrupalCamp South Carolina / SouthEast LinuxFest.)

Google Open Source

Facebook-style Statuses is now the base of a Google Summer of Code initiative (which I'm mentoring) to build a Micropublisher that will allow posting images, video, and links into the status stream. Unlike me 3 years ago, you are now able to build the essential features of Facebook in Drupal with no coding, minimal configuration, and equal ease of use. Start now!

This post is part of a series on Social Networking. Isaac has already blogged about the importance of social networking and how to build a social network. He is planning posts on the future of social streams in Drupal, social networking features missing from Drupal (and how we can fix that), Friend/Relationship modules, and integrating the Activity module with Facebook-style Statuses. You can find other posts on social networking on his website.