Here's a patch that adds RSS feeds to both the "all posts" and individual users' view. So you can get a feed of all posts to a site (not just those that are promoted to front page) or all posts by an individual user.

The patch also fixes tracker so that it does not list moderated nodes.

Due to the nature of RSS, there is no point to sorting the feed by latest comments, so the feed is simply sorted in reverse chronological order.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matt westgate’s picture

Category: feature » bug

+1 on the bugfix and the feature. Until we make tracker URLs as robust as the taxonomy URL system, this is a worthwhile patch that allows folks to track only the users they want to.

I'm being nitpicky here, but we should add a line or two of documentation to tracker_feed().

Dries’s picture

Coding style needs work too.

jjeff’s picture

FileSize
4.99 KB

Comments added.
Code styled.
Good?
-jeff

moshe weitzman’s picture

this looks a bit odd:

if ($uid == 'feed'){
+ return tracker_feed();
+ }
+ elseif ($feed == 'feed'){
+ return tracker_feed($uid);
+ }

nice feature

Dries’s picture

Rather than writing:

+  if (is_numeric($uid)){
+    $feedpath = url("tracker/".$uid."/feed", NULL, NULL, TRUE);
+    // add 'alternate' tag for the user
+    $user = user_load(array('uid' => $uid));

I'd write:

  if ($account = user_load(array('uid' => $uid)) {
  }
  1. $uid being a number is not enough.
  2. Don't use $user, use $account. $user is the current user. Best not to share the same variable for two different purposes. It's prone to security errors.
  3. We don't glue words together: $feedurl should be $feed, $url or $feed_url.

Similarly:

+  if (is_null($uid)){
+    $result = db_query('SELECT nid FROM {node} WHERE status = 1 AND moderate = 0 ORDER BY created DESC LIMIT %d', variable_get('feed_default_items', 10));
+    $channel['title'] = t('All posts on %site', array('%site' => variable_get('site_name', 'drupal')));
+    $channel['link'] = url("tracker", NULL, NULL, TRUE);
+  }
+  else {
+    $user = user_load(array('uid' => $uid));
+    $result = db_query('SELECT nid FROM {node} WHERE status = 1 AND moderate = 0 AND uid = %d ORDER BY created DESC LIMIT %d', $uid, variable_get('feed_default_items', 10));
+    $channel['title'] = t('Posts by %name', array('%name' => $user->name));
+    $channel['link'] = url("tracker/$uid", NULL, NULL, TRUE);
+    $channel['description'] = t('%name\'s posts on %site', array('%name' => $user->name, '%site' => variable_get('site_name', 'drupal')));
+  }

Is better done as follows:

  if ($account = user_load(array('uid' => $uid))) {
    ...
  }
  else {
     ...
  }
jjeff’s picture

Okay, I'll clean this up.

But the reason that I was using is_numeric() was to allow for a feed of anonymous user posts (uid = 0). Will

user_load(array('uid' => 0))</a> return an account?

And some random thoughts:
Should we be checking the node_access table and only listing viewable content? Of course, this starts to get sticky because basically we need to run <code>node_access('view', $node, $uid)

on every node in the listing. And to further compound things, the RSS feed is going to execute as an anonymous user, so they still may not be able to get the content. Would tagging the session id onto the end of the feed URL allow Drupal to recognize them as a user... even if the request is coming from a separate RSS reader?

(Sorry to head off on a tangent... just want to make this good.)

-jeff

Robin Monks’s picture

Status: Needs review » Needs work
jjeff’s picture

Status: Needs work » Needs review
FileSize
4.98 KB

Cleaned up and ready to go (I believe)...

-j

chx’s picture

regarding feeds and auth , the primary goal of securesite module is to provide auth'd feeds.

jjeff’s picture

Status: Needs review » Needs work

That last patch was bad. I'm fixing and will post another soon.

jjeff’s picture

Status: Needs work » Needs review
FileSize
5.11 KB

Fixed.

Jaza’s picture

This patch is quite useful for following the main site-wide tracker, but it seems a bit useless for tracking your own posts (or other individuals'). You don't need the 'my recent posts' page to let you know when you've posted new content - you would know that without looking! The whole point of 'my recent posts' is to track updates (i.e. comments) on your posts. And the RSS feed doesn't communicate updates to posts at all.

As with Jeff, I don't see any solution to this problem. I guess that the only way to track updates to individual posts is either to use the comments RSS module, or to use the subscriptions module. This patch _could_ be modified to sort posts by latest comment, and to show posts as new when they are updated, but I don't know how well that would work.

Jaza’s picture

Version: 4.7.0-beta3 » x.y.z
Dries’s picture

I still don't like the way you use $uid (taken directly from the query string). It's prone to security errors.

matt westgate’s picture

FileSize
7.29 KB

Here's an approach to this patch which handles RSS similar to blog.module. I find this a little cleaner to look at and it conforms with an already existing Drupal style.

Dries’s picture

Category: bug » feature

This is a feature, not a bug.

I think we can clean up the code some more ...

Tobias Maier’s picture

marked http://drupal.org/node/7474 as duplicate of this one

and +1 from me for the idea :)

mcduarte2000’s picture

+1 I need this also.

moshe weitzman’s picture

if possible, lets be thorough about our patch reviews. they are more than mere votes. see the guidelines: http://drupal.org/patch/review

m3avrck’s picture

Status: Needs review » Needs work

ID tags on HTML elements can't have spaces in them.

$output = '<div id="tracker tracker-user-'. $account->uid .'">';

Perhaps that should *just be* tracker, to be consistent with the other use of <div id="tracker"> later on in the patch.

Also comments above the functions for PHPDoc would be useful.

It isn't clear how function tracker_page($a = NULL, $b = NULL) { makes use of argument $b. I didn't see anywhere in the patch that made use of this argument.

Tobias Maier’s picture

please dont use so much id-attributes - I hate them!
dont hardcode html in general! use theme-functions

Uwe Hermann’s picture

Bump - wanna have ;)

moshe weitzman’s picture

IMO, Views + view feed modules makes the tracker and this feature request nearly obsolete.

matt westgate’s picture

Status: Needs work » Closed (won't fix)

Agreed with Moshe.

Dries’s picture

Status: Closed (won't fix) » Needs work

Please don't mark this won't fix. We want this in core, and neither the feeds.module or the views.module are part of core at this point.

I'd like to see this patch land but it needs some clean-up. It uses 'blog' where it should be 'posts'. 'All Posts' should be 'All posts' (or something). Code can be slightly improved too.

jjeff’s picture

Perhaps, we should file this comment under feature creep, but how about a feed for all of the comments by a user... and/or all of the comments on a user's posts... and/or continuing comments on posts that a user has commented on...

Take a look at the different feeds that you can get from Flickr for some indications of where I would like to head with this. I'll take a look into these ideas in the next few days and try to roll a new patch. But I will likely need some help in the "cleaning it up" department -- as I consider myself to be a sloppy coder with big ideas. :-)

xaueious’s picture

Version: x.y.z » 5.1

Can someone educate me as to whether or not this patch works for 5.x?

funana’s picture

What's the status?

I would like to generate feeds for all usergenerated content by user, so that users can use their RSS on other pages, like "My posts on xyz.com" or "my bookmarkroll" (See also http://drupal.org/node/122445)...

Any news?

catch’s picture

Version: 5.1 » 7.x-dev
singpolyma’s picture

Can anyone give tips on how to apply this patch to Drupal? Can it work with 6.x-dev?

ChrisBryant’s picture

Are there any plans to include this in an upcoming Drupal release (and possibly on Drupal.org?)

This would be a killer feature for the community/Drupal.org to be able to use RSS to subscribe to our own and other users posts/updates. It will help people keep up with important activity in the community from whatever other methods/channels they use.

Please excuse me if there is already some other viable method to do this that I'm not aware of?

Dave Reid’s picture

ChrisBryant, you can currently do this with the Views module.

ChrisBryant’s picture

Thanks David. I'm aware of that, but the problem is that it's not part of Drupal core and also not available on Drupal.org.

If Drupal.org started using the views module for the tracker view then it would all be good and could be added that way as well. :-)

Alex UA’s picture

I'm currently trying to build a scraper to mimic this functionality so that we can display our drupal activity on our company profile pages, but the way the tables are structured is making it pretty difficult. Is there any way this could still make it into core? It would make things so much easier!

Dave Reid’s picture

Issue tags: +RSS, +syndication
Dane Powell’s picture

+1 for enabling this on drupal.org. The most annoying thing about developing for Drupal for me is having to visit drupal.org every single time I want to check for replies to my issues and posts.

Dane Powell’s picture

Seriously, I'm willing to do some legwork to make this happen, I just need some direction. How can we get an RSS feed of our issue activity?

ChrisBryant’s picture

Assigned: jjeff » Unassigned

At this point Drupal.org is already running views so this should just be a matter of adding the rss feed to the view. Can someone with access add that for us?

Damien Tournoud’s picture

Drupal.org doesn't use Views for the tracker pages, but the Tracker2 module. The query that Views and the core Tracker module use simply doesn't scale.

If this is a feature request for d.o, please move that issue to the Tracker2 module, or open a new issue there.

Dane Powell’s picture

jhedstrom’s picture

Code more along the lines of Tracker 2 has been commited to D7 #105639: Tracker performance improvements.

catch’s picture

Version: 7.x-dev » 8.x-dev

This is a new feature, so moving to Drupal 8.

Pinatz’s picture

Version: 8.x-dev » 6.15
Category: feature » support

Does this work with drupal 6.15? Or could anybody make a patch to get this working for a tracker.rss feed? I dont want to have a feed for every user but only one with every changes of the site like you can see in the tracker module :>

jhedstrom’s picture

Version: 6.15 » 8.x-dev
Category: support » feature

This issue needs to remain in the 8.x issue queue.

Pinatz’s picture

Okay, but anyways a solution for a general tracker-Rss-Feed with the newest changes ? =/

Vacilando’s picture

Subscribing.

jhedstrom’s picture

Version: 8.0.x-dev » 8.1.x-dev
Issue summary: View changes
Status: Needs work » Postponed (maintainer needs more info)

Wow, this one is old. Anything left to be done here?

Darren Oh’s picture

Status: Postponed (maintainer needs more info) » Fixed

With Views in core, this is no longer an issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Status: Closed (fixed) » Closed (won't fix)

Let's say its a won't fix since people can create those views themselves?