// set the amount of posts to display
$limit = 5;
$startTime = microtime(true);
// Set to forum location - See XenForo index.php for information
$fileDir = dirname(__FILE__);
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
$forumModel = XenForo_Model::create('XenForo_Model_Forum');
$visitor = XenForo_Visitor::getInstance();
$permissionCombinationId = $visitor['permission_combination_id'];
$threads = $forumModel->getThreads(array('discussion_state' => 'visible', 'permissionCombinationId' => $permissionCombinationId), array('limit' => $limit, 'order' => 'thread_id', 'orderDirection' => 'desc') );
foreach ( $threads AS $thread ) {
$visitor->setNodePermissions( $thread['node_id'],
$thread['node_permission_cache'] );
if ( $forumModel->canViewForum( $thread ) ) {
echo(
"<div class='entry-meta'><a href='"
. XenForo_Link::buildPublicLink( 'canonical:threads',
$thread )
. "'>"
. XenForo_Helper_String::wholeWordTrim( $thread['title'],
40 )
. "</a></div>"
);
}
}