Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
comment.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Jun 2011 at 23:47 UTC
Updated:
21 Jul 2012 at 16:14 UTC
An option should exist at
admin/structure/types/manage/[contenttype]
that gives users the option to sort comments with either the defaul option "Oldest First" (ASC) or "Newest First" (DESC)
If the comments on threaded the threads should be preserved properly.
this should be achieved by ordering the comments by "thread" DESC. (without the default substring).
so this..
$query->addExpression('SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))', 'torder');
$query->orderBy('torder', 'ASC');
should become this:
$query->orderBy('c.thread', 'DESC');
Obviously conditions and constants should be added to allow the user to have a choice.
thanks!
Comments
Comment #1
davidwbarratt commentedHere is a module that someone has written that accomplishes this feature:
http://drupal.org/project/sort_comments
it would be nice if this was part of core.
thanks!
david
Comment #2
Tenchu2525 commentedAgreed
Comment #3
dddave commentedCorrecting settings and title.
As contrib provides a solution I have my doubts if something will be included into D7.
Comment #4
mdupontI think it is best to use a contrib module or a block generated by Views module to achieve that. The reason is it very unlikely to be added to Drupal core is because few sites will use it. I mean, I have almost never seen a site that displays comments in descending order. Closing the issue.
Comment #5
yseki commentedto order comment desc, do that
Comment #6
emergencyofstate commented^ yuriseki, how would one implement this code?
Comment #7
brycesenz commented+1 for putting this back into Drupal core. The contrib module seems abandoned is still riddled with bugs.
@mdupont - Many major sites that I'm sure you've seen (e.g. YouTube) display newer comments first.
In any case, the solution is a bit more complicated than comment #5 when you get into threaded comments. I believe that the desired functionality there is that the comments are ordered DESC by the comment root, but ordered ASC for all replies to that comment.
Comment #8
bkosborneFYI - this screws up the linking of comments. Since we are just controlling the sort order, the comment links on the comment moderation page (/admin/content/comments in d7) link to the wrong page when anchoring to a comment.
Comment #9
David_Rothstein commentedThis feature existed in Drupal 6 but was deliberately removed in Drupal 7. The issue where it's being discussed is #191499: Remove "Display order" from comment settings.
Comment #10
P3t3r commentedSo, since this is not going into core again, what module / technique / ... should one use to have this functionality?
To clarify, I mean the behavior that most large sites use, like brycesenz puts it: "the comments are ordered DESC by the comment root, but ordered ASC for all replies to that comment".
Comment #11
greenwork commentedThe contrib module seems not to work. Why was this removed. I can think of many larger pages that have newest first.. EX facebook
Comment #12
greenwork commentedOk here is another contrib module that is working on some sites and at least has a stable release
http://drupal.org/project/comment_goodness