Ordering comments in discusions by its DESC CommentID and DESC DateUpdated
Hi,
Does someone knows how to ordering comments in discussions by its DESC CommentIDs and DESC DateUpdated ?
Thanks in advance
Best Answer
-
R_J Admin
My answer was totally wrong, so you can forget it completely.
What do you expect?
If you sort by CommentID, you will have a list that does not take any other thing into consideration:
CommentID | DateUpdated
8 | 2016-09-05
7 | 2016-09-05
6 | 2016-09-05
5 | 2016-09-20
4 | 2016-09-20
3 | 2016-09-21
2 | 2016-09-02
1 | 2016-09-02The CommentID is unique. Having more than 1 sort criteria only makes sense if your first sort criteria is not unique. So if the first sort criteria is DateUpdated and the second criteria is the CommentID you would end with a list like that
CommentID | DateUpdated
3 | 2016-09-21
5 | 2016-09-20
4 | 2016-09-20
8 | 2016-09-05
7 | 2016-09-05
6 | 2016-09-05
2 | 2016-09-02
1 | 2016-09-02Changing that order would most probably require a plugin that uses CommentModels BeforeGet event but I guess that wouldn't be easy.
And again: I see no valid reason for that.5
Answers
Try adding
$Configuration['Vanilla']['Discussions']['SortDirection'] = 'asc';
to your/conf/config.php
but i need ordering messages by two criterias: DESC CommentIDs and DESC DateUpdated
this configuration will do it ?
My answer was totally wrong, so you can forget it completely.
What do you expect?
If you sort by CommentID, you will have a list that does not take any other thing into consideration:
CommentID | DateUpdated
8 | 2016-09-05
7 | 2016-09-05
6 | 2016-09-05
5 | 2016-09-20
4 | 2016-09-20
3 | 2016-09-21
2 | 2016-09-02
1 | 2016-09-02
The CommentID is unique. Having more than 1 sort criteria only makes sense if your first sort criteria is not unique. So if the first sort criteria is DateUpdated and the second criteria is the CommentID you would end with a list like that
CommentID | DateUpdated
3 | 2016-09-21
5 | 2016-09-20
4 | 2016-09-20
8 | 2016-09-05
7 | 2016-09-05
6 | 2016-09-05
2 | 2016-09-02
1 | 2016-09-02
Changing that order would most probably require a plugin that uses CommentModels BeforeGet event but I guess that wouldn't be easy.
And again: I see no valid reason for that.