Currently, Drupal allows you to change the default display order of comments in comment settings between "most recent last" and "most recent first".

The only site I've ever seen use "most recent first" was groups.drupal.org a while ago, combined with threading.

This meant when you read discussions, your eye would have to travel like / \ / \ / \ between the various threads, as opposed to the standard \ \ \ \ with "most recent last" threading, or | with a flat list. Moshe changed the setting back to "most recent last" when some of us mentioned it in IRC, and it's been much better since then.

Therefore, I'm proposing this be removed from core as a significant usability bug. By the time D7 is released, I'm sure it'll be quite possible to override comment ordering in views (in fact it might even be possible now), so there'll be a contrib option for people who really, really want this if they absolutely have to have it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

I'd be in favor of always making comments oldest first and removing the option (and underlying code complexity) entirely. Top posting is evil. At the *very* least it should default to oldest first, not top-posting. :(

However, I'm sure some "but Drupal should let me be flexible and decide I want to eat puppies" do-gooder will come along and complain that we're being tyrants by "restricting choices"... :(

But, to the extent my biased opinions count for anything, I'd be fully in support of this restriction/simplification.

A: Yes.
Q: Are you sure?
A: Because it's confusing.
Q: Why don't you like top-posting?

-Derek

catch’s picture

Bump.

One situation you might want comments top-posted for, is if you do a guestbook/myspace style thing on user profiles with comments - where it's not actually a discussion but a stream of random stuff. Notwithstanding views covering this, I think we could at least reduce the options like this:

Flat - most recent first or last
Threaded - most recent last.

That'd get rid of the worst offender - reverse order threaded comments, which is pretty much impossible to follow (cf. groups a year or more ago).

Dries’s picture

Yes, please.

erofadd’s picture

Yes I this can be done by using the views module through the Sort Category

If its a new commnent you want to create you can simply click on the add button to add a new comment view which can be edited using the sort category order in views.

all the best.

catch’s picture

OK so looks like this is a goer.

There's some UI, and probably storage issues with this.

Currently we have these options:

Default display mode:
- Flat list - collapsed
- Flat list - expanded
- Threaded list - collapsed
- Threaded list - expanded

Default display order:
- Date - newest first
- Date - oldest first

(note that both 'default display' can't be overridden any more, because comment controls is gone - this means the help next needs fixing - another issue though).

I think it'd be nice to take the opportunity to rationalise these options a bit - to something like:

Appearance:
- Expanded
- Collapsed

Display mode:
- Flat list
- Threaded

(bit of conditional show/hide javascript)
Display order:
- Newest first
- Oldest first

This gives the user 2/3 choices to make, between 2 options a time, instead of two choices between up to four options. Hopefully a bit easier to grok. Will need to look in more detail how this would affect the variables though.

xmacinfo’s picture

I definitely would like to keep the display order option site wide default. When doing intranets, I love showing the most recent comments at the top.

However, the whole comments display should, IMHO, look like Nabble. They are threaded and they are all collapsed. We could have button to uncollapse all comments, etc.

Comments settings could then be used to set:
- Newest/Oldest first
- Collapsed/Expanded view

Would we need to set Flat/Threaded only if comments are threaded like Nabble and collapsible individually?

Just my two cents.

eaton’s picture

Views 2 lets you create Views of comments. I'm all in favor of making Earl the solution to all our special-cases. ;-)

catch’s picture

Assigned: Unassigned » catch
Status: Active » Needs review
FileSize
10.13 KB

Here's a patch.

Removes everything to do with display order 'newest first', deletes the variable for the node types, fixes a bug in comment.test where it was setting a variable incorrectly (comment_default_per_page vs. comment_default_per_page_article).

All comment tests pass with this patch.

catch’s picture

FileSize
10.84 KB

Improved a couple of comments and added CHANGELOG.txt entry.

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

xmacinfo’s picture

I still think this is a regression. And forcing users to load Views is not a good choice at all.

  1. Views takes about 6 months to a year before shipping.
  2. Views for Drupal 7 is not on the radar yet.
  3. Views takes a lot of resources (memory and CPU).

Unless we plan to move views in the core, we should roll back this code.

Damien Tournoud’s picture

Title: Remove "Display order" from comment settings. » Readd the comment ordering code (was Remove "Display order" from comment settings)
Assigned: catch » Unassigned
Status: Closed (fixed) » Needs review
FileSize
8.72 KB

After a discussion with catch, chx and webchick on IRC, we came to the conclusion that we should better keep the underlying code for this ordering, and just remove the UI elements in the administration page.

So here is a patch that partially revert what was committed previously, only adapted to DB:TNG. I'm working on the test on that whole "comment ordering" functionality.

The only chunk that requires an explanation is this one:

+        // TODO: change that query when our query build will support subqueries.
+        $thread = db_query("(SELECT thread
+          FROM {comments}
+          WHERE nid = :nid
+            AND status = 0
+          ORDER BY timestamp DESC
+          LIMIT $new_replies)
+          ORDER BY thread DESC LIMIT 1", array(':nid' => $node->nid));

The LIMIT is *intended* to be in the internal subquery, but our query builder currently does not support this. I also fixed the query for the other ordering, that was wrongly converted (see #314349). We also need a test for this.

Also, the ordering now default to oldest first, as per comments in that issue.

Damien Tournoud’s picture

FileSize
11.93 KB

Here is a test for the comment ordering feature, and also cleaned-up comment.test to comply with Test writers' guidelines.

keith.smith’s picture

Title: Readd the comment ordering code (was Remove "Display order" from comment settings) » Re-add the comment ordering code (was Remove "Display order" from comment settings)

Status: Needs review » Needs work

The last submitted patch failed testing.

tsi’s picture

+1 for bringing back the underlying code (without UI), and subscribe.

BarisW’s picture

Tried the patch in #13 but got some errors. Only chunk 1 and 2 could be applied correctly. I'm using Drupal 7.0.

xmacinfo’s picture

That patch is way too old. You'd need to reroll it.

BarisW’s picture

Ah, apologies. Didn't see that the patch was from 2008 :p

I now just copied the comment module to my sites/all/modules folder and changed the ASC to DESC in the code to get it working. Dirty, but works for this small website. Tried views, but failed (AJAX error).

paranojik’s picture

Status: Needs work » Needs review
FileSize
4.03 KB

I rerolled the patch from #13, but stripped away ordering for threaded comments.
Users should manually set the variable: variable_set('comment_default_order_' . $node->type, COMMENT_ORDER_NEWEST_FIRST), otherwise the default behaviour is COMMENT_ORDER_OLDEST_FIRST.

paranojik’s picture

Here's a version with a UI for selecting the display order.

Status: Needs review » Needs work

The last submitted patch, bring-back-comment-ordering-191499-22.patch, failed testing.

paranojik’s picture

Status: Needs work » Needs review
slashrsm’s picture

Status: Needs review » Reviewed & tested by the community

Code looks good. I think, that we should preserve a way to sort comments. Since custom sorting is probbably not used when using threaded view, it can be really usefull when using flat view.

I think we should leave just this functionality without UI. One, that needs it, can set this variable.

catch’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7

Needs to go into 8.x first.

Dries’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

It is not really explained why we want to keep this and roll back part of the original patch.

Personally, I do think it is a good idea to remove it and to get closer to Views. It makes sense to have some sort of query builder in core at some point.

If we want to keep this, we should discuss about it some more. I'm not sure we have a convincing case for it.

gavri’s picture

Here is a quick fix for D7 on the theme level using hook_page_alter
(change bartik with the hook name - (the name of the theme on the module)

function bartik_page_alter(&$page) {
	foreach ($page['content']['system_main']['nodes'] as $key => $value) {
		if (is_numeric($key)) {
			$page['content']['system_main']['nodes'][$key]['comments']['comments'] = array_reverse($page['content']['system_main']['nodes'][$key]['comments']['comments']);
		}
	}
	
}
paranojik’s picture

Status: Postponed (maintainer needs more info) » Needs review

@#28: I don't think this will work for discussions that spread over multiple pages.

@#27: Some points have already been made earlier in this discussion. In my opinion the decision to strip out the ordering code was done without thinking twice (as you can see from comments #6 to #10).
I think using views for such a little tweak is quite an overhead (from the amount of time one has to spend to implement this tweak, or from the performance viewpoint).

This patch brings very little code (so maintaining it shouldn't be a problem) but solves one (from my experience) not so rare use-case. The current solution in core looks like it's "half done". I'm for the inclusion of both the ordering code and the UI. We need this because it's always been there and we are used to it. We use it. It's quick and simple. It's intuitive.

catch’s picture

Aren't these queries alterable? If so a contrib module could provide a ui for this and handle the ordering too, no need for views. If they're not alterable that's and easy change to make. For the record this was not removed 'without a second thought', was posted following usability testing if d6 in Minnesota where we saw someone click on the comment settings fieldset, drop their jaw at the metre length list of options that had just been exposed, and then 'yowzer'. Not to mention several sites including groups.drupal.org at one point would manage to combine both threading and newest first ordering, which was completely unreadable at least without heavy theming. If this can't be done from contrib via hook_query_alter() let's fix that, but otherwise I'm opposed to adding this back.

xmacinfo’s picture

The idea is to add back the settings for the site admins only, not for the end users on the comment form. :-)

paranojik’s picture

Maybe I should have been clearer. I'm attaching two screenshots of the node-type edit form showing only the comment settings section. This patch only applies to this form. The "Display order" dropdown is only visible for flat comments and is shown/hidden with js.

catch’s picture

@xmacinfo: it was the admin settings I was talking about.

slashrsm’s picture

I also think that we should keep some way to *easyly* change comments ordering. UI part of this functionality can be removed, but variable should stay there IMO.

We should consistently tag all queries that relate to comment list, if we decide that this must be done via hook_query_alter().

acouch’s picture

This is a vote for re-adding the content ordering along with the UI. As the screenshot at #32 shows it doesn't (in my opinion) add too much more to the node edit form.

I am not a fan of showing most recent comments first but have seen that cropping up more and more in successful sites (example: http://host.madison.com/ct/business/biz_beat/article_dd6fdfc2-7685-11e0-...) and think it would be better to have the option.

dddbbb’s picture

sub

realguess’s picture

sub

Tuscan’s picture

I hope this feature will be re-added, atleast for flat comments only. I am trying to build a simpler version of a Facebook wall/youtube style comments page using flat comments (meaning I need newest comments first!), I was quite surprised to find such a simple but useful feature removed in D7.. Google the subject and you will find that there are quite a few other frustrated developers out there too, i'd say that's reason to add it back..

dddbbb’s picture

I've resorted to using Views/Panels to get newest comments first - only seems to work for flat comment though. Please bring this feature back!

FrequenceBanane’s picture

future backport interest me, so subscribe

corbacho’s picture

Fact:

  • Amazon (when displaying all reviews) have newest reviews first. (Quite logic thing)
  • Youtube has newest comments first
  • Disqus commenting system has this option.

Ok, blogger and wordpress don't have this option by default. But is Drupal only a blog platform? Comments can represent many different data when considering Drupal as a *framework*.

I agree that the ugly problem was when combined with threaded comments. So we can remove that: #32 screenshots looks very clean admin UI to me.

Also there are already issues in the forum: How to reverse comments order in Drupal 7? Simple task impossible? And someone has create a sandbox project to provide this feature Sort Comments

Really we want a new module? when it's only 1 extra variable that could be provided from core.
Please, reconsider to get it back.

xmacinfo’s picture

groups.drupal.org have newest comments first as well. :-)

dddbbb’s picture

Other site examples aside, I still think a choice between newset or oldest first is better than it being forced either way.

xmacinfo’s picture

Tuscan’s picture

Component: comment.module » color.module

Was a bit silly to remove the option in the first place imo

xmacinfo’s picture

Component: color.module » comment.module
dixon_’s picture

Status: Needs review » Postponed (maintainer needs more info)

I think the decision to remove this was based on very good usability studies as catch mentions in #30. I also think it's quite clear that reverse ordering of comments is relatively rare on most sites. Those two arguments makes this a perfect case for contrib to solve.

But before closing this as a "won't fix", it would be interesting to hear the arguments behind the mentioned discussion in #13 (although it was a very long time ago).

xmacinfo’s picture

Status: Postponed (maintainer needs more info) » Needs review

I also think it's quite clear that reverse ordering of comments is relatively rare on most sites.

I would consider LinkedIn, Google+ and Facebook as very good examples to follow.

paranojik’s picture

As @slashrsm already said in #34: at least what we should do is consistently tag all comment sort related queries. Until then contrib can only provide ugly hacks.

Bojhan’s picture

@xmacinfo Actually, that is entirely untrue - those are all "activity stream" which this is not.

dddbbb’s picture

Clearly there are conflicting opinions. Surely it makes sense to provide an option for the site owner to decide which order their comments appear in?

slashrsm’s picture

I agree with dixhuit. I understand, that there was a usability problem with this feature, but none of us requests that form element to be re-added. We just request some mechanism to override default behaviour on a non-hackish way.

I see two solutions, that do that and leave UI as it is:
- add consistent tag to all comment query, so we can override them in contrib or
- add variable that stores sort configuration (as it was in D6), which can be changed with drush or in a contrib module.

Both solutions fix this problem and leave UI as it is now.

corbacho’s picture

@slashrsm See #41 , there is already a contrib module that changes the variable.

laura s’s picture

I'm kind of flabbergasted that this configuration was removed. I don't know of any broadly accepted "best practice" of allowing only display of comments in chronological order. I would think the UX preferred by the site owner for the end user is more important than the UX of n00b site admins confused by too many form items. How many people are looking at the comments on a daily basis, vs. how many people are configuring commenting sorting order on a daily basis? Which should get the prioritized treatment?

BTW the module in #41 has 1 bug, with 2 people reporting that the module does not work. #1315324: Panels module integration

enzipher’s picture

+1 for bringing back the sorting. I was kinda chocked that a simple basic setting like this had been removed. To be forced to install yet another module for this is close to ridiculous.

As for the screenshot in #32, it doesn't have to be a select list, it can be a simple checkbox for "Show newest comments first". At least that would make it less cluttered.

Cheers,

Alex UA’s picture

I'm with #55 and am equally flabbergasted that this very useful feature was removed. Please bring back this option, at least on the comment admin page (meaning at least let us set it globally for our preferred sort).

David_Rothstein’s picture

Marked #1193520: Ability to sort threaded comments DESC (Newest First) as a duplicate.

This feature is now provided by at least two different D7 contrib modules:
http://drupal.org/project/sort_comments
http://drupal.org/project/comment_goodness

Surely it's useful in some cases, but how many? Frankly, newest first + flat seems to mainly be useful for sites that expect a high volume of low quality comments :) Newest first + threaded can in theory be more useful, but the way Drupal does it currently (where the spun-off threads get sorted newest first also) seems to make little sense. Overall, this feature tends to result in situations like @dww's example from #1...

I'm not sure why we need to go back to supporting this in core if it's possible in contrib. There are a lot of other very reasonable ways people might want to sort their comments (e.g. most-popular first, like StackExchange) but we can't deal with all the various cases in core anyway. I think it makes the most sense to just provide the basic ones and keep the UI simple.

brycesenz’s picture

@David_Rothstein -

"Surely it's useful in some cases, but how many?" You could use that logic to justify removing forums, contact forms, blogs, and probably about 2/3 of the rest of the modules that ship with core. And if you did, surely other contrib modules would step up to replace them in the following months.

If there are fundamental code/structure changes that warrant removing the code, then that's one thing. But it sounds like "recent comments first" just lost a popularity contest, and in the process screwed all of us who relied on that feature (and now can choose from two contrib modules, neither of which is stable).

#32 is one of many examples of how this could be added without causing a UX calamity.

laura s’s picture

@David_Rothstein I would be fine with having this functionality in contrib, but that would make most sense when comments functionality is also in contrib. At the moment, *neither* exists in contrib, and a host of Drupal projects require custom development to implement such a simple feature that is integral to comments configuration. Breaking off a piece of core comments functionality seems to be neither a UX improvement nor a step towards a streamlined core. It's just diminishment of functionality to achieve ... I still don't understand what.

corbacho’s picture

As I said in #41, many sites use the "newest first", like Youtube.

Today I saw in Drupal Planet this (about new features of Drupal Garden):

Now you can sort comments per content type and customize commenting labels. For a YouTube-like comment experience, you can sort comments by ‘Newer first’ which also moves the comment form to the top of the comment stream.

So I think this is another prove that this setting IS useful. We were not crazy :)

I recommend you guys to have a look to Comment goodness: the module that is making possible for Drupal Gardens to offer this feature.

So, from my part I will not ask anymore to support this in core. It has more sense in the contrib.

And thanks to Acquia Engineers involved to contribute this module back.

P3t3r’s picture

Both comment goodness and sort comments reintroduce the underlying problem why it was removed in the first place. Does anyone know a mod that sorts the comments like facebook and other large sites, i.e. DESC on the initial comments, and then ASC to keep the trees readable? Like this:

2
2.1
2.1.1
2.1.2
2.2

1
1.1
1.2
1.2.1
1.2.2

acouch’s picture

Comment Bonus API supports the DESC for the replies for the initial comments. It is still under development which has gotten stalled a little on my end but would be helped by any enthusiasm that is out there.

P3t3r’s picture

Wow, that was well-hidden! I'll try it out asap, thx!

kscheirer’s picture

Status: Needs review » Needs work
Issue tags: -Needs backport to D7

I'm a little lost, I don't see a patch to review except way back in #22, and there's been lots of developments since then. Can someone summarize the current issue? I'm removing the backport tag until it's clear that something will be ported.

jonathanshaw’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • Dries committed 1415340 on 8.3.x
    - Patch #191499 by catch: remove display order settings and cleaned up...

  • Dries committed 1415340 on 8.3.x
    - Patch #191499 by catch: remove display order settings and cleaned up...
jonathanshaw’s picture

We need some comment here to explain the effect and motivation of Dries' commit.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • Dries committed 1415340 on 8.4.x
    - Patch #191499 by catch: remove display order settings and cleaned up...

  • Dries committed 1415340 on 8.4.x
    - Patch #191499 by catch: remove display order settings and cleaned up...

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

  • Dries committed 1415340 on 9.1.x
    - Patch #191499 by catch: remove display order settings and cleaned up...
xmacinfo’s picture

What's happening with this issue and multiple commits?

dww’s picture

@xmacinfo re: #83:

@xjm just populated the 9.1.x branch of core and pushed all those commits to Gitlab. That resulted in d.o thinking there were new commits and putting these comments on many (but not all) issues that are still open. It's weird that we saw #82 for 9.1.x, but didn't see anything like it for the 8.[5-9].x branches nor 9.0.x. This whole behavior is kinda weird. I don't know much about that plumbing anymore and the details of how/why it works the way it does. But that's what happened. /shrug

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Title: Re-add the comment ordering code (was Remove "Display order" from comment settings) » Remove "Display order" from comment settings
Status: Needs work » Closed (outdated)
Issue tags: +Bug Smash Initiative

This issue is extremely confusing. The original issue was to remove the setting, and it was removed, but then it was re-opened to add it back but only the title was updated and not the issue summary. This may have made sense initially as part of a rollback strategy, but it's safe to say rolling back is no longer a viable option.

I think that after 13 years the (intentional) loss of this functionality no longer qualifies as a bug. It's also not really possible to see how it used to work.

To avoid further confusion I've updated the issue title to set it back to what it was originally. I also considered creating a feature request for it but there hasn't been a comment in support of this in 9 years. But if anyone feels like this should be a feature request, please create one with information about how it should work.