Launchpad bug feeds in WordPress

One of the goals we have for Launchpad is to offer different ways to get data in and out.

For example, in addition to the web interface we have an email interface for the Bug Tracker. For many people, the quickest way to file a bug is to fire off an email. Of course, it also provides a full range of options for editing and commenting on existing bugs.

In Launchpad 1.1.12 we introduced bug feeds. Now, each bug, person, team, project and distribution in Launchpad has an associated Atom feed. I’ve used my bug feed on the home page of my website to give a flavour of what I’m working on. As I use WordPress, which has built-in support for MagpieRSS, this was supremely easy.

Upgrade to the latest WordPress

Before you begin, you should upgrade to the latest WordPress. Previously, I was running 2.2.2 and it had some trouble with the Atom feed.

Pulling in the feed

First off, you need to pull in MagpieRSS, which is distributed with WordPress.

I’ve created a sidebar specifically for the my site’s home page and I’ve got the following at the top of my home-sidebar.php template file:

include_once(ABSPATH . WPINC . ‘/rss.php’);
$myBugs = fetch_rss(“http://feeds.launchpad.net/~matthew.revell/latest-bugs.atom”);
$myBugsItems = array_slice($myBugs->items, 0, 4);

The first line includes MagpieRSS and the next creates an array of the feed’s posts in $myBugs. I don’t have too much room in my side bar, so I use the last line to cut it down to the top four entries.

Displaying the feed

Actually displaying the feed is simple:

<ul>
<? foreach ($myBugsItems as $item ) {
$title = $item[title];
$url = $item[link];
echo “<li><a href=$url>$title</a></li>”;
}

?>
</ul>

I’m looking to seeing how other people, in particular projects, use these new feeds.

Please post a comment or contact me if you’re using Launchpad’s feeds or you have a suggestion for how we can improve them.

Update: two suggestions of easier ways to achieve the same effect. Dave Murphy suggested Wigitize.com (hat-tip Joey) and Jeremy Visser commented that WordPress has a widget to embed a feed into your page.