UPDATES EasyBlog 6.0.11 Released! Update to the latest version now!

Helpdesk

Your Time
Our Time
Response Time
24 — 48 hours
We strive to provide the fastest ever response possible. However, we are not super beings.

Allow at least 24 — 48 hours
  Support is online
Our support specialists is available now. We will attend to you as soon as we can.
  Support is online

Most commented posts from last X days

tylr23 · ·
2:48 AM Monday, 20 April 2020
Normal
// Solved in thread https://stackideas.com/forums/comment-count-last-x-days //

Hi,

In the most commented post module's helper.php I am trying to get the items of the last 6 days.

I tried with

$query .= ' WHERE b.`created` >= DATE(NOW()) - INTERVAL 6 DAY;


and also tried with

$query .= ' WHERE b.' . $db->quoteName('created') . ' = ' DATE(NOW()) - INTERVAL 6 DAY;


Both lines would end up crashing the site, could you suggest me what the correct syntax is?

Here is the code from the helper.php to which I am adding the line to in the LEFT JOIN query :


$query = 'SELECT a.*, count(b.' . $db->quoteName('id') . ') as ' . $db->quoteName('comment_count');
$query .= ' FROM ' . $db->quoteName('#__easyblog_post') . ' AS a';

if (!$showBlockedUserPosts) {
//exlude blocked users posts
$query .= ' INNER JOIN `#__users` as uu on a.`created_by` = uu.`id` and uu.`block` = 0';
}

$query .= ' LEFT JOIN ' . $db->quoteName('#__easyblog_comment') . ' AS b ON a.' . $db->quoteName('id') . ' = b.' . $db->quoteName('post_id');
$query .= ' WHERE a.' . $db->quoteName('published') . ' = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
$query .= ' AND a.' . $db->quoteName('state') . ' = ' . $db->Quote(EASYBLOG_POST_NORMAL);
The replies under this section are restricted to logged in users or users with an active subscription with us