Closed (outdated)
Project:
Drupal core
Version:
6.27
Component:
forum.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2013 at 06:42 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent
Let me explain by example, suppose we have forum id 2000 and set default sort by desc with order by last_comment_timestamp
Sample forum topic:
nid, title, created, changed, last_reply, last_comment_timestamp
100, Topic A, 1 Jan 2012, 1 Jan 2012, 2 Jan 2012, 2 Jan 2012
101, Topic B, 2 Jan 2012, 2 Jan 2012, none, 2 Jan 2012
102, Topic C, 3 Jan 2012, 3 Jan 2012, none, 3 Jan 2012
Current order in forum/2000 (which is not as I wish):
nid, title, created, changed, last_reply, last_comment_timestamp
102, Topic C, 3 Jan 2012, 3 Jan 2012, none, 3 Jan 2012
101, Topic B, 2 Jan 2012, 2 Jan 2012, none, 2 Jan 2012
100, Topic A, 1 Jan 2012, 1 Jan 2012, 2 Jan 2012, 2 Jan 2012
Expect:
nid, title, created, changed, last_reply, last_comment_timestamp
100, Topic A, 1 Jan 2012, 1 Jan 2012, 2 Jan 2012, 2 Jan 2012
102, Topic C, 3 Jan 2012, 3 Jan 2012, none, 3 Jan 2012
101, Topic B, 2 Jan 2012, 2 Jan 2012, none, 2 Jan 2012
The field "last_comment_timestamp" should not be used if there's no comment on that topic,
so I've made my own patch as attached, the patch fix SQL to count and order only the node that has comments.
| Comment | File | Size | Author |
|---|---|---|---|
| forum-topic-order-last-comment-timestamp.patch | 2.72 KB | noomz |
Comments
Comment #1
noomz commentedComment #3
larowlanSo this is about the treatment of NULL?