Home > Launchpad, Ubuntu > Launchpad bug feeds in WordPress

Launchpad bug feeds in WordPress

January 9th, 2008 Matthew Revell

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.

Launchpad bugs feedIn 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.

Something I forget to put in the original post was that I’ve also used straight MagpieRSS (i.e. without WordPress) to create an ugly but functional page at http://launchpad.understated.co.uk/. The code is pretty much exactly as shown in the WordPress example above.

Categories: Launchpad, Ubuntu Tags:
  1. Some guy from the interwebs
    January 10th, 2008 at 16:34 | #1

    Aren’t you DDoS’ing launchpad this way? (Honest question, no flame intended)

  2. Matthew Revell
    January 10th, 2008 at 16:53 | #2

    Nah, this is what feeds are intended for. The feeds setup on Launchpad is built to handle exactly this sort of usage. Besides, the feed is cached at my end so doesn’t hit Launchpad each time the page is viewed.

  3. January 10th, 2008 at 22:29 | #3

    Actually, it’s even easier if you use WordPress Widgets (built in to WP 2.3 and later), where you can just use the RSS widget to achieve exactly the same effect with no code.

Comments are closed.