The news aggregator ver 4.5 is working well with cron. My issue is how can you limit the number of feed items received in each category. (admin/aggregator/list)

As an example, I started out with BBC News with 29 items. Then it was 42, 58, 67, 88 and today at 137. These can be reset by using "remove items" and then "update items". However, is there a way that each news feed can be limited to no more than a total of perhaps 40 items per feed and tied into a cron job? It is great that readers can view older RSS news feeds, but a limit needs to be placed on how many and how far back these go on a site.

Perhaps I have not set something correctly or the aggregator just does not have this feature. Any suggests on resolving this would be most appreciated.

Thanks

Jim

Comments

dries’s picture

The aggregator removes news items that are older than 3 months. There is no setting for this but you can easily edit the code. Just search modules/aggregator.module for '3 months'.

jasko’s picture

I've never done any PHP programming, but that sounds like it should be configurable. I guess it's time for me to try to add that to the module...

Alaska’s picture

Located the code to change out the time for a news item. In my case I will try a four day scenario which is a total of 345,600 seconds. I have commented out the original code and replaced it with the new material. Will replace the original aggregator and see what happens in four days or 345, 600 seconds.

Thanks for the help as it is most appreciated.

Jim

/*
  ** Remove all items that are older than 3 months:
  */

  //$age = time() - 8035200; 
  // 60 * 60 * 24 * 31 * 3
  $age = time() - 345600; // 60 * 60 * 24 * 4
  $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age);
Alaska’s picture

News aggregator just made it through its test with flying colors. It was setup for 345,600 seconds or four days. Checked the RSS feeds from BBC and all of the December 1st feeds have been removed.

Thanks to all for the assistance.

Jim

robert castelo’s picture

My News Page module allows you to filter feed items by key words, so that a page can be set to only show items relevant to your Website.

It also has an option to only show X number of items.

More details here:
http://drupal.org/node/13047

[a.k.a. MegaGrunt]

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----

Alaska’s picture

Robert:

Will keep your module in mind. I like the idea of being able to both be selective with subject and posting times.

Thanks for the heads up.

Jim