summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-10-12 19:44:16 +0000
committerDries Buytaert <dries@buytaert.net>2004-10-12 19:44:16 +0000
commit8ce9d2aca46345f7b83911efd3d83c6159af08de (patch)
treefac8c4a9cc0241238dd8d47a7f24a8dd3ebc4f86
parenta185443ed34db91d65b5278572c038a98508e4cb (diff)
downloadbrdo-8ce9d2aca46345f7b83911efd3d83c6159af08de.tar.gz
brdo-8ce9d2aca46345f7b83911efd3d83c6159af08de.tar.bz2
- Patch #11298 by nato: the function _forum_topics_read was not returning only nodes of type 'forum' resulting in the forum overview listing counting all node types as topics; attached patch modifies queries to return counts of only 'forum' type nodes.
-rw-r--r--modules/forum.module4
-rw-r--r--modules/forum/forum.module4
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/forum.module b/modules/forum.module
index ffc099fff..7845b673e 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -390,8 +390,8 @@ function _forum_topics_read($term, $uid) {
// Calculate the number of topics the user has read. Assume all entries older
// than NODE_NEW_LIMIT are read, and include the recent posts that user has
// read.
- $ancient = db_result(db_query('SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d '. node_access_join_sql() .' WHERE n.created <= %d AND n.status = 1 AND '. node_access_where_sql(), $term, NODE_NEW_LIMIT));
- $recent = db_result(db_query('SELECT COUNT(n.nid) FROM {node} n '. node_access_join_sql() .' INNER JOIN {history} h ON n.nid = h.nid AND h.uid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.created > %d AND '. node_access_where_sql(), $uid, $term, NODE_NEW_LIMIT));
+ $ancient = db_result(db_query("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d ". node_access_join_sql() ." WHERE n.created <= %d AND n.status = 1 AND n.type = 'forum' AND ". node_access_where_sql(), $term, NODE_NEW_LIMIT));
+ $recent = db_result(db_query("SELECT COUNT(n.nid) FROM {node} n ". node_access_join_sql() ." INNER JOIN {history} h ON n.nid = h.nid AND h.uid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum' AND n.created > %d AND ". node_access_where_sql(), $uid, $term, NODE_NEW_LIMIT));
return $ancient + $recent;
}
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index ffc099fff..7845b673e 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -390,8 +390,8 @@ function _forum_topics_read($term, $uid) {
// Calculate the number of topics the user has read. Assume all entries older
// than NODE_NEW_LIMIT are read, and include the recent posts that user has
// read.
- $ancient = db_result(db_query('SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d '. node_access_join_sql() .' WHERE n.created <= %d AND n.status = 1 AND '. node_access_where_sql(), $term, NODE_NEW_LIMIT));
- $recent = db_result(db_query('SELECT COUNT(n.nid) FROM {node} n '. node_access_join_sql() .' INNER JOIN {history} h ON n.nid = h.nid AND h.uid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.created > %d AND '. node_access_where_sql(), $uid, $term, NODE_NEW_LIMIT));
+ $ancient = db_result(db_query("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d ". node_access_join_sql() ." WHERE n.created <= %d AND n.status = 1 AND n.type = 'forum' AND ". node_access_where_sql(), $term, NODE_NEW_LIMIT));
+ $recent = db_result(db_query("SELECT COUNT(n.nid) FROM {node} n ". node_access_join_sql() ." INNER JOIN {history} h ON n.nid = h.nid AND h.uid = %d INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum' AND n.created > %d AND ". node_access_where_sql(), $uid, $term, NODE_NEW_LIMIT));
return $ancient + $recent;
}