// 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);