Hi,
I once used the sort_comments module (thanks!) until I came to the need to have a "conversational sort order" as you might have for your emails :
- top comments are sorted newest to oldest
- replies (nested comments) are sorted oldest to newest
I have a code which is specific to postgres but it might be extended to more databases !
$orderby =& $query->getOrderBy();
$expressions =& $query->getExpressions();
if (isset($orderby['torder'])) {
unset($expressions['torder']);
unset($orderby['torder']);
$query->addExpression("SUBSTRING(c.thread from '^([^.]*)\.')", 'torder1');
$query->addExpression("SUBSTRING(c.thread from '^[^.]*\.(.*)')", 'torder2');
$query->orderBy('torder1', 'DESC');
$query->orderBy('torder2', 'ASC');
}
It would be a nice addition to this module !
Cheers,
Rémi