From d895ef8c40a91380f8f484b41b9df11889e1380b Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Mon, 20 May 2002 07:32:01 +0000
Subject: [PATCH] - Bugfix: the tracker module was using an incorrect time
 interval to show           recent/new comments.  Patch by Gerhard.

---
 modules/tracker.module         | 8 +++++++-
 modules/tracker/tracker.module | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/tracker.module b/modules/tracker.module
index 5404e9274562..a9d718d4203a 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -15,8 +15,14 @@ function tracker_link($type) {
   return $links ? $links : array();
 }
 
+function tracker_conf_options() {
+  $period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => "All");
+  $output .= form_select("Show comments more recent than", "tracker_period", variable_get("tracker_period", 259200), $period, "Comments younger than this get displayed.");
+  return $output;
+}
+
 function tracker_comments($id = 0) {
-  $period = time() - 259200 *20;  // all comments of the past 3 days
+  $period = time() - variable_get("tracker_period", 259200);  // all comments of the past 3 days if not configured to a different value
 
   if ($id) {
     $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period AND c.uid = '%s' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10", $id);
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 5404e9274562..a9d718d4203a 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -15,8 +15,14 @@ function tracker_link($type) {
   return $links ? $links : array();
 }
 
+function tracker_conf_options() {
+  $period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200), 1000000000 => "All");
+  $output .= form_select("Show comments more recent than", "tracker_period", variable_get("tracker_period", 259200), $period, "Comments younger than this get displayed.");
+  return $output;
+}
+
 function tracker_comments($id = 0) {
-  $period = time() - 259200 *20;  // all comments of the past 3 days
+  $period = time() - variable_get("tracker_period", 259200);  // all comments of the past 3 days if not configured to a different value
 
   if ($id) {
     $sresult = db_query("SELECT n.nid, n.title, COUNT(n.nid) AS comments, MAX(c.timestamp) AS last_comment FROM comments c LEFT JOIN node n ON c.nid = n.nid WHERE c.timestamp > $period AND c.uid = '%s' GROUP BY n.nid, n.title DESC ORDER BY last_comment DESC LIMIT 10", $id);
-- 
GitLab