By tylr23 on Sunday, 17 October 2021
Posted in General Issues
Likes 0
Views 467
Votes 0
Hi,

I found in /models/blog.php that the getBlogComment function has a query to retrieve comment and tried to add the following but it does not have effect.

Can you help me with the syntax please?


if ($lite) {
$query = 'SELECT a.* FROM `#__easyblog_comment` a';
$query .= ' LEFT JOIN #__users AS c ON a.`created_by` = c.`id`';
$query .= ' WHERE a.`post_id` = '.$db->Quote($id);
$query .= ' AND a.`published` = 1';
$query .= ' AND a.' . $db->quoteName('created') . ' >= DATE_SUB(' . $db->Quote($now) . ', INTERVAL 6 DAY)';


Kind regards,

Matt

$query .= " AND a.`created` > DATE_SUB(" . $db->Quote($currenttime) . ", INTERVAL " . 7 . " DAY)";


+ defining variable $currenttime = EB::date()->toSql();

Worked.

Thank you for your guidance though Arlex.
·
Sunday, 24 October 2021 06:14
·
0 Likes
·
0 Votes
·
0 Comments
·
I am really sorry but unfortunately our support policy does not cover customizations

Thanks for understanding.
·
Monday, 18 October 2021 10:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

I understand but can you just tell me if this is the right section to modify in order to show only comments which are not older than 6 days on the entry page?


Is /models/blog.php after the if($lite) condition of the getBlogComment function the correct location ?


Kind regards,
·
Tuesday, 19 October 2021 00:40
·
0 Likes
·
0 Votes
·
0 Comments
·
May I know which comment section you referring to?

For example :

1. Latest blog post listing page - preview comment section

2. Blog entry page comment section

3. User dashboard overview page

By the way, if you put a vardump inside this getBlogComment function, did it show your vardump code after you refresh the page?

If yes, then you should modify the correct function file.
·
Wednesday, 20 October 2021 12:42
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Thank you for your answer Alex.

Sorry I forgot indeed to mention that indeed it is for the "Blog entry page comment section ".

By the way, if you put a vardump inside this getBlogComment function, did it show your vardump code after you refresh the page?

I will check a bit later.
·
Thursday, 21 October 2021 15:11
·
0 Likes
·
0 Votes
·
0 Comments
·
You're welcome.

Yes, it is the correct function file you check, but the $lite variable is returned false, so you have to add your custom SQL query under the else part.
·
Thursday, 21 October 2021 15:28
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome.

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

Thanks for understanding.
·
Monday, 25 October 2021 10:16
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post