What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

Use-case: Jon Skeet has 422 answers for each question he asks (as of July 14th 2010). When he asks a question - you bet'cha it's a good one!
He asks 1 question every ~2 weeks, so it's definitely something I can track.
On the other hand, if I follow his answers, I'll be sitting reading StackOverflow most of my waking life. The man answers faster than I can read.

As there's no way to subscribe to only the questions for a specific user, I would like to suggest it as a feature.

share|improve this question
    
@Grace, we edit-collided –  jmfsg Jul 14 '10 at 14:43
    
@Juan It's worse than you think. I ended up catching a mid-edit with Jonathan as well (notice "defiantly" on my edit, which I didn't actually add). In any case, I think yours is a better result anyway. To which, sorry, Jonathan, for any inconveniences, eheh. –  Grace Note Jul 14 '10 at 14:44
    
No problems ;) My typo anyway... –  Jonathan Jul 15 '10 at 7:31
1  
+1, I'd like to subscribe to Jeff's questions on Meta, for the same reasons. –  Kip Aug 10 '10 at 15:38

1 Answer 1

Given that I am a programmer, I decided to whip up some PHP code to do this for me. Let's say this file is named so-user-questions.php, you'd access Jeff's MSO feed of only questions with so-user-questions.php?user_id=1&site=meta.stackoverflow.com. I spent all of an hour on this code--an hour that I'm normally sleeping!--so it may not be that super. I parse XML with a regular expression, which I think is just fine in the very limited way I do it, but many think I should be publicly executed for this. I also just rip elements out of the existing Atom feed rather than use the SO API. Whatevs. Here's the code:

<?php

$user_id = intval($_GET['user_id']);
$site = $_GET['site'];

if($user_id <= 0 || !preg_match('/^((meta\.)?(stackoverflow|serverfault|superuser|[a-z0-9\-_]+\.stackexchange)\.com)$/', $site))
{
  echo 'invalid args';
  exit();
}

$feed_url = "http://$site/feeds/user/$user_id";
$feed_content = @file_get_contents($feed_url);

if($feed_content === false)
{
  echo 'error fetching feed';
  exit();
}

$self_url = htmlspecialchars('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
$feed_content = preg_replace('/(<link\s*rel="self"\s[^>]*href=")[^">]+/', "\\1${self_url}", $feed_content, 1);

$feed_content = preg_replace_callback('{<entry>.*?</entry>}s', 'myCallback', $feed_content);
function myCallback($m) {
  return (preg_match('/<title[^>]*>(Answer|Comment) by/', $m[0]) ? '' : $m[0]);
}

header('Content-type: application/atom+xml; charset=utf-8', true);
ob_start('ob_gzhandler');
echo $feed_content;

Note: For the time being you can access this at http://www.vacant-nebula.com/so-user-questions/[site]/[user_id]/. So, for example, Jeff's feed of only questions from Meta can be reached at http://www.vacant-nebula.com/so-user-questions/meta.stackoverflow.com/1/. If I find that it is using too much of my limited shared hosting resources, or if I just feel like it, I will take it down. Consider yourself warned.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .