By tylr23 on Monday, 03 August 2020
Posted in General Issues
Likes 0
Views 671
Votes 0
Hi,

On the entry page, I would like to list first all comments which have a title and then list the comments which do not have a title.

I could not find which file/function to modify.

Some help is welcome

Kind regards,

Matt
Ok, my apologies Arlex, you had the right location I was using the dashboard comment view.

So the correct locations are :
dashboard comment view = models\comment.php
entry view = models\blog.php

It was quiet easy then there to sort by title title first but I think I got a bit lucky


switch ($sort) {
case 'desc':

$query .= ' ORDER BY a.`title` desc';
break;
default:
$query .= ' ORDER BY a.`title` asc';
break;
}


Thank you for support.
·
Wednesday, 05 August 2020 18:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, do you mean you would like to load the comment with the title first then only load the comment without title?

Screenshot : https://monosnap.com/file/zIjnVoc0QHKzXMrdV8Z1dEYnJoIoET
·
Monday, 03 August 2020 18:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Arlex,

It is like with Komento "featured" comment which appear first.

In your list the comment with title "no title here" would appear last.

Kind regards,
·
Monday, 03 August 2020 19:08
·
0 Likes
·
0 Votes
·
0 Comments
·
I see, then you have to modify this function getBlogComment from this file JoomlaFolder/administrator/components/com_easyblog/models/blog.php
·
Tuesday, 04 August 2020 10:28
·
0 Likes
·
0 Votes
·
0 Comments
·
I see, then you have to modify this function getBlogComment from this file JoomlaFolder/administrator/components/com_easyblog/models/blog.php


Thank you Arlex, in this function, there is indeed a conditionnal for the sorting

switch ($sort) {
case 'desc':

$query .= ' ORDER BY a.`rgt` desc';
break;
default:
$query .= ' ORDER BY a.`lft` asc';
break;
}


What is strange is that changing any value in this function does not have any effect, like if I replace rgt or lft by id it will not sort by the comment id.

Adding a line like $query .= ' ORDER BY a.`parent_id` = 0 desc' ; will result in an error.
·
Tuesday, 04 August 2020 17:48
·
0 Likes
·
0 Votes
·
0 Comments
·
I think you have to execute 2 SQL query in order to achieve this.

1. Execute one of the SQL query to retrieve a list of the comment belong that article + with the title.

2. Execute another SQL query to retrieve a list of the comment belong that article + without the title.

By the way, I am really sorry but unfortunately our support policy does not cover customization

Thanks for understanding.
·
Tuesday, 04 August 2020 19:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

I do not ask for customisation but for the right location of the code that I have to modify.

In my last reply I stated that modifying it would not have any effect so we could have supposed that the localisation of the code to modify was somewhere else and indeed I found the place where to modify it.

The sorting of the comments gets defined in models\comment.php and not in models\blogs.php

I modified the following and it solved my issue.


$db = EB::db();

$queryPagination = false;
$queryLimit = '';
$queryOrder = ' ORDER BY a.`title` DESC';
$queryWhere = '';

switch($sort)
{
case 'latest' :
default :
$queryOrder = ' ORDER BY a.`created` DESC';
break;
}
·
Wednesday, 05 August 2020 16:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

I do not ask for customisation but for the right location of the code that I have to modify.

In my last reply I stated that modifying it would not have any effect so we could have supposed that the localisation of the code to modify was somewhere else and indeed I found the place where to modify it.

The sorting of the comments gets defined in models\comment.php and not in models\blogs.php

I modified the following and it solved my issue.


$db = EB::db();

$queryPagination = false;
$queryLimit = '';
$queryOrder = ' ORDER BY a.`title` DESC';
$queryWhere = '';

switch($sort)
{
case 'latest' :
default :
$queryOrder = ' ORDER BY a.`created` DESC';
break;
}

Hm, that is strange, are you referring on the blog entry page comment section?

If yes, it should call that function from this file JoomlaFolder/administrator/components/com_easyblog/models/blog.php.
·
Wednesday, 05 August 2020 17:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

You are most welcome. Glad to hear that your issue has been resolved now.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding.
·
Wednesday, 05 August 2020 19:11
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post