$threadModel = $this->_getThreadModel();
$threadConditions = array(
'post_date' => array('>', XenForo_Application::$time - $maxDays * 86400),
'discussion_state' => 'visible',
'discussion_open' => '1'
);
$threadFetchOptions = array(
'join' => XenForo_Model_Thread::FETCH_AVATAR,
'order' => 'view_count',
'limit' => $maxThreads
);
$threads = $threadModel->getThreads($threadConditions, $threadFetchOptions);