Jump to:

23369 Posts in 18155 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » comment order

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

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

Page: 1
Go to End
Author Topic: 835 Views
  • crf
    Avatar
    Community Member
    2 Posts

    comment order Link to this post

    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?

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: comment order Link to this post

    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

  • crf
    Avatar
    Community Member
    2 Posts

    Re: comment order Link to this post

    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

    835 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.