Just adding a bit guide about this query. It’s very simply, you can google it 🙂
#. We need query items between current day and 30 days ago
SELECT DATE_FORMAT(create_date, '%m/%d/%Y')
FROM mytable
WHERE create_date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()
So there is a sample code
#. After that we sort by on voted with DESC 🙂
ORDER BY `voted` DESC
So finally we have
/* adding by JOOservices */
if ( $params->get('sort_type') == 3 ) {
$where .= ' AND cm.date BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE() ';
$order = ' cm.voted ';
}
Very simply 🙂 Even it’s consider as custom work but we can do it in just 5min 😀