Patch to add RSS feeds to tracker.module
jjeff - January 10, 2006 - 23:35
| Project: | Drupal |
| Version: | 8.x-dev |
| Component: | tracker.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | RSS, syndication |
Description
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.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| tracker-rss.patch | 4.9 KB | Ignored | None | None |

#1
+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().
#2
Coding style needs work too.
#3
Comments added.
Code styled.
Good?
-jeff
#4
this looks a bit odd:
if ($uid == 'feed'){
+ return tracker_feed();
+ }
+ elseif ($feed == 'feed'){
+ return tracker_feed($uid);
+ }
nice feature
#5
Rather than writing:
<?php+ 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:
<?phpif ($account = user_load(array('uid' => $uid)) {
}
?>
$uidbeing a number is not enough.$user, use$account.$useris the current user. Best not to share the same variable for two different purposes. It's prone to security errors.$feedurlshould be$feed,$urlor$feed_url.Similarly:
<?php+ 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:
<?phpif ($account = user_load(array('uid' => $uid))) {
...
}
else {
...
}
?>
#6
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)
(Sorry to head off on a tangent... just want to make this good.)
-jeff
#7
#8
Cleaned up and ready to go (I believe)...
-j
#9
regarding feeds and auth , the primary goal of securesite module is to provide auth'd feeds.
#10
That last patch was bad. I'm fixing and will post another soon.
#11
Fixed.
#12
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.
#13
#14
I still don't like the way you use
$uid(taken directly from the query string). It's prone to security errors.#15
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.
#16
This is a feature, not a bug.
I think we can clean up the code some more ...
#17
marked http://drupal.org/node/7474 as duplicate of this one
and +1 from me for the idea :)
#18
+1 I need this also.
#19
if possible, lets be thorough about our patch reviews. they are more than mere votes. see the guidelines: http://drupal.org/patch/review
#20
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.#21
please dont use so much id-attributes - I hate them!
dont hardcode html in general! use theme-functions
#22
Bump - wanna have ;)
#23
IMO, Views + view feed modules makes the tracker and this feature request nearly obsolete.
#24
Agreed with Moshe.
#25
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.
#26
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. :-)
#27
Can someone educate me as to whether or not this patch works for 5.x?
#28
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?
#29
#30
Can anyone give tips on how to apply this patch to Drupal? Can it work with 6.x-dev?
#31
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?
#32
ChrisBryant, you can currently do this with the Views module.
#33
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. :-)
#34
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!
#35
#36
+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.
#37
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?
#38
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?
#39
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.
#40
I have opened #492286: Provide RSS feed in the T2 queue.
#41
Code more along the lines of Tracker 2 has been commited to D7 #105639: Tracker performance improvements.
#42
This is a new feature, so moving to Drupal 8.