Keyword

How To reverse the order of Comments in K2 Item

  • Adrian Kiehlba
  • Adrian Kiehlba's Avatar Topic Author
  • Offline
  • New Member
More
11 years 11 months ago #104870 by Adrian Kiehlba
How To reverse the order of Comments in K2 Item was created by Adrian Kiehlba
Can anyone help guide me with the right code. I would like to reverse the order of the comments on a k2 item... Instead of it displaying the latest comment by the last one posted - I would like to keep the first comment at the top.

Much appreciated.

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #104871 by william white
Replied by william white on topic Re: How To reverse the order of Comments in K2 Item
SELECT *
FROM axlu9_k2_comments
WHERE itemID=3
AND published=1
ORDER BY commentDate DESC
LIMIT 0, 10
is found in the queries if you set debug on I think changing the desc to asc may do the trick...google mysql to verify...
you will have to search the core and find where this is generated and change it (hack the core)
There is a new extension for hacks but i have not tried it yet
extensions.joomla.org/extensions/style-a-design/templating/22441

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago - 11 years 11 months ago #104872 by william white
Replied by william white on topic Re: How To reverse the order of Comments in K2 Item
But a much easier way is k2 options - comments tab - comments ordering

Please Log in or Create an account to join the conversation.

  • Adrian Kiehlba
  • Adrian Kiehlba's Avatar Topic Author
  • Offline
  • New Member
More
11 years 11 months ago #104873 by Adrian Kiehlba
Replied by Adrian Kiehlba on topic Re: How To reverse the order of Comments in K2 Item
I didn't even realize that option existed for the comments... I thought I knew them all... Cheers thank you very much for the quick reply...

Whats the chance there could be a way to change that as per each k2 template ? That might not be doable but I do have two different templates for two categories that one makes sense to have it reversed and the other one to be the default.

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago - 11 years 11 months ago #104874 by william white
Replied by william white on topic Re: How To reverse the order of Comments in K2 Item
Back to the hack.....If someone knows how to manipulate the data at the level of the k2 override i would be most intrested in seeing the code
line 592 of item.php ver 2.5.7
<?php foreach ($this->item->comments as $key=>$comment): ?>
How to reorder the array stored in $this->item->comments before running the loop???

this
php.net/manual/en/function.rsort.php
may be a start

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum