Mikkel Høgh

Coding the web since 1999

20 Jun 2009

Introducing the Stack Overflow module for Drupal

As an avid user of Stack Overflow (and Server Fault, to some degree), I am well pleased to announce the stackoverflow.module for Drupal.

Why do we need a module for that?

Well, the Stack Overflow team recently introduced a new feature called “flair”. This is basically a badge you can put on your blog to show your level of awesomeness on Stack Overflow (or its related site, Server Fault).

My beef with that (and the reason for this module) is that using that requires either an iframe (ewww!) or injecting it with JavaScript (slowing the loading of your website). I found neither palatable, and in addition, I’d like to be able to run it through the Drupal theming system, so the theming guys will be able to make it look pretty.

What does it do?

Basically, it let’s you set enter your user ID for the different websites in the Stack Overflow family, and it then exposes a Drupal block for the flair for each of them. The data is loaded from the Stack Overflow JSON/REST API and cached with Drupal’s caching system for a configurable amount of time.

This means that your users will have the exactly same experience with the flair being displayed, without the overhead of extra HTTP requests to Stack Overflow’s server, with the exception of the favicon, which we cannot distribute with the module, unless we get a GPL2-licensed version.

So whether or not you care about performance, you can now stick a nice Stack Overflow flair on your site – another wonderful way to let your geek flag fly :)

Where can I see it?

I have stackoverflow.module (0.8-beta1) enabled on this site – there should be a couple of flairs in the sidebar with my face on them.

Future features

I plan to implement per-user settings for flairs, so each user on a site will be able to have his flair show up on his profile page. Other than that, I’m open for ideas. See you in the issue queue :)