Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

comment order


Go to End


3 Posts   1430 Views

Avatar
crf

Community Member, 2 Posts

26 March 2009 at 8:15am

Is there a way to reverse the order of the comments without editing the core code so that the newest comments are at the bottom?

Avatar
Double-A-Ron

Community Member, 607 Posts

26 March 2009 at 9:54am

Not that I'm aware, but it would be a nice simple feature for managing from the cms.

\sapphire\core\model\SiteTree.php
Line 288

public function Comments() {
		$spamfilter = isset($_GET['showspam']) ? '' : 'AND IsSpam=0';
		$unmoderatedfilter = Permission::check('ADMIN') ? '' : 'AND NeedsModeration = 0';
		$comments =  DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->ID) . "' $spamfilter $unmoderatedfilter", "Created DESC");
		
		return $comments ? $comments : new DataObjectSet();
	}

I think changing "Created DESC" to "Created ASC" will do what you want.

Cheers
Aaron

Avatar
crf

Community Member, 2 Posts

26 March 2009 at 10:13am

I agree. I think it would be a nice simple feature for the cms.

That was the code I didn't want to edit, but looks like I don't have a choice. Oh well. Thanks for the response.

Chris