Forums / Cotonti / Support / Change order of the comments

from ASC to DESC

foxhound
#1 2010-06-22 19:21
Probably a stupid question but I can not figure our where to change the order in which the comments are displayed.
I checked the page.inc.php, also the list.inc.php but nowhere there is anything mentioned about the order. So, I start to assume the order is set by the forums? Meaning the comments use the same settings as the forums do?

In the minichat plugin we use on the website I was able to change the order, I just have no idea where in the core files this setting is for the normal pages.

BTW, we have finally moved our website to Cotonti B)
Took us 3 days to do the whole move but it was well worth it! Thanks cotonti!
http://www.armaholic.com
<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
This post was edited by foxhound (2010-06-22 23:34, 13 years ago)
Kingsley
#2 2010-06-22 19:46
Small q:

how did you fix that with the minichat?
foxhound
#3 2010-06-22 23:32
In "plugins/minichat/inc/minichat.functions.php" change the following:
Line 53 (?):
$sortorder = "ASC";
to
$sortorder = "DESC";

Comment line 60 (?):
if (!isset($_GET['chatd']) && $totalitems!=0)  { $d = $perpage * (ceil($totalitems / $perpage)-1); }

And the last one, line 62 (?):
$sortorder = "ASC";
to
$sortorder = "DESC";

** (?) = I have edited my file a bit so its possible for you the line numbers are different.
<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
ez
#4 2010-06-22 23:44
comments:

Look in functions.php and find function sed_build_comments.

	$sql = sed_sql_query("SELECT c.*, u.user_avatar FROM $db_com AS c
		LEFT JOIN $db_users AS u ON u.user_id=c.com_authorid
		WHERE com_code='$code' ORDER BY com_id ASC LIMIT $d, ".$cfg['maxcommentsperpage']);

I think it is this one... (do not kill me If i am wrong)
change ASC in DESC

Warning: Corehacking !

It is a damn shame that this is not configurable !
==- I say: Keep it EZ -==
foxhound
#5 2010-06-23 03:18
That seesms to do it (only applied to the testsite yet).
I really can't believe I did not think of checking the functions php, feel pretty dumb now I-)

Thanks as always ez, you are a great help around here!

Added 4 days later:

Now that we have the comments in descending order, is it also possible to change the number in front of the posted comment?
I checked the functions.php and saw this: 'COMMENTS_ROW_ORDER' => $i,
I assume "$i" is global as its also used by the forums post order. Anyway to adapt it so only the comments are showing the highest number first?
<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
This post was edited by foxhound (2010-06-28 01:47, 13 years ago)
ez
#6 2010-06-28 04:30
@Fox:

		$i = $d;
		/* === Hook - Part1 : Set === */
		$extp = sed_getextplugins('comments.loop');
		/* ===== */
		while ($row = sed_sql_fetcharray($sql))
		{
			$i++;

the same function:

$i is local and starts with $d (and this is the page start counter [pagination])
It is just a counter for the number off items you want to show.
BUT you changed ASC in DESC so the counter is now "upside down"

You say that you want to change the counter...
just remove it from the tpl ? and leave the code like it is.. (most simple solution)

Date and time is usually good enough to see how the order is :/
==- I say: Keep it EZ -==
foxhound
#7 2010-06-29 05:30
Thanks for the info. I guess you are right.
I changed it and will see what people think, otherwise we revert back to asc ;)
<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />
This post was edited by foxhound (2010-07-13 19:33, 13 years ago)