×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Comment a nested comment - problem !

Comment a nested comment - problem ! 8 years 10 months ago #33214

  • Tero Pernu
  • Tero Pernu's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi,

I think a had a similar problem. I imported comments from K2 and the id numbers are running "backwards". The oldest comment had the biggest id number.

My customer wanted the comments to run threaded and from oldest to newest (from top down). After setting the comments sorting to "New entries last" the comments were organized correctly but the threaded comments were still "New entries first".

I changed the /components/com_comment/models/comment.php a bit and now the comments and threaded comments seem to follow my "New entries last" setting.
(Actually I also had to change the order to "New entries first" which is basically the opposite I wanted)

Here what I changed. Just before the line
// Don't change the ordering here - otherwise nested comments won't be sorted right
I changed the "$query->order('id ASC');" to " $query->order('id DESC');"

I'm not a coder, so I have no idea why this works. Daniel could you comment on this and tell is my solution good or if there's something I might have left unnoticed?

Comment a nested comment - problem ! 8 years 10 months ago #33215

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
I've written that comment, but don't ask me what was breaking. If I've written it, then something is probably wrong when you remove it.

I have no idea anymore. For me it doesn't make sense to have the nested comments sorted in new entries first. The nested comments are creating a conversations. Conversations run from top to bottom, not the other way around.

Comment a nested comment - problem ! 8 years 10 months ago #33216

  • Tero Pernu
  • Tero Pernu's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I was a bit unclear. My point was to get the comments and the threading comments running from the oldest to newest and from top to bottom.
With the code change and changing the order to "New entries first" it is now going the right way from the oldest to newest and from top to bottom.

Maybe my problem is the reversed id number order. After import the newest comments have the smaller id number.
Any way, it now working.

Comment a nested comment - problem ! 8 years 10 months ago #33225

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Test it further. I think that some comments were lost when you were setting a different order. I remember that I was banging my head on this 2 days or so. I couldn't make it work, so that's why I decided to disable nested comments for "new entries first". If you can get it to work I would be more than happy to include the changes.

Regards,
Daniel

Comment a nested comment - problem ! 8 years 10 months ago #33233

  • Tero Pernu
  • Tero Pernu's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
So, "$query->order('id ASC');" to " $query->order('id DESC');" in /components/com_comment/models/comment.php and setting "New entries first".

After those changes I have comments and threaded comments from the oldest -> newest from top -> bottom. Basically "New entries last". I don't know why, but it seems to work :)

Comment a nested comment - problem ! 8 years 7 months ago #33890

  • Tero Pernu
  • Tero Pernu's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
Hi again. My problem came back and bit me in the a**.

So, originally I have imported my comments from another blog and during import the id numbers have flipped. So the newest is 1 and oldest some 500. Now the new comments continue to have incrementally changed id numbers. So the newest after the import is 501.

My workaround was working before but now when there are new comments and new nested comments all around, the ordering does not work. In any which way I cannot get old and new comments with their nested comments to order by time. I've changed the $query->order('id ASC') to $query->order('date ASC') and $query->order('date DESC') with no success.

I suppose the comments are not in any case ordered by time but rather by the sql id number (which basically always is incrementally created and so ordered by time).
Is there a way I can try and fix this my self, or is changing the comment ordering according creation time on your todo list for the next update?
  • Page:
  • 1
  • 2
Time to create page: 0.107 seconds