FORUMS CLOSED DUE TO SPAM. YOU STILL CAN ADD POST!

FrogCMS comment plugin

Feed 3 posts, 2 voices

Avatar
12 posts

Hi there,

using the frogcms comment plugin, how do you sort the comments from old to new? Much obliged

 
Avatar
180 posts

You may do a few changes in code:

Find [root]\frog\plugins\comment\Comment.php (line 132) and change on:

public static function findApprovedByPageId($id, $offset = false, $limit = false, $order = false)
{
    return self::find(array('where' => 'is_approved=1 AND page_id=' . (int)$id, 'offset' => $offset, 'limit' => $limit, 'order' => $order));
}

Find [root]\frog\plugins\comment\index.php (line 100) and change on:

function comments(&$page, $offset = false, $limit = false, $order = false)
{
    $comments = array();
    $comments = Comment::findApprovedByPageId($page->id, $offset, $limit, $order);
    return $comments;
}

Then go to the admin backend on Snippet tab and edit comment-each snippet:

Find line:

<?php $comments = comments($this, $from, 10); ?>

Change on:

<?php $comments = comments($this, $from, 10, 'comment.created_on ASC'); ?>

or

<?php $comments = comments($this, $from, 10, 'comment.created_on DESC'); ?>
 
Avatar
12 posts

That did the trick. Thanks for taking the time to help me out :)
Just got my new site running with frogCMS :)

 
Avatar
180 posts

Hi! It’s great! ^^