3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1078 Views |
-
Change sort order of PageComments

26 February 2010 at 9:15am
Hi everybody,
i'm looking for a way to change the sort order of page comments from "newest first" to "oldest first". Seems like such a simple thing to do, but i couldn't find a solution.
What would be the correct/easiest way to do this, any pointers?
Thanks a bunch!
Andi -
Re: Change sort order of PageComments

26 February 2010 at 2:27pm
It appears sort order is hard coded in the query - On line 215 of PageCommentInterface
DataObject::get("PageComment", "\"ParentID\" = '" . Convert::raw2sql($this->page->ID) . "' $spamfilter $unmoderatedfilter", '"Created" DESC', "", $limit);
If you wanted to change it you would need to change the DESC to ASC. It would be better if that sort field was a static variable you could set like PageCommentInterface::sort_comments('Created ASC'); I guess. Might be a nice enhancement ticket.
-
Re: Change sort order of PageComments

2 March 2010 at 2:22am
Hey Willr,
thanks for looking into this.. I can't believe that nobody seems to have run into this issue before.
I agree, it would be great to have this option available without hacking the core. -
Re: Change sort order of PageComments

2 March 2010 at 11:31am
Just so we can track the issue - I've made http://open.silverstripe.org/ticket/5130. Should be simple to implement so when I next have a spare 2 mins to add it and test it'll be sorted.
| 1078 Views | ||
|
Page:
1
|
Go to Top |


