<?php
/**
Template Name: xffrontpage
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<div id="mainstory">
<?php
$threadModel = XenForo_Model::create( 'XenForo_Model_Thread' );
$conditions = array();
$fetchOptions = array(
'join' => XenForo_Model_Thread::FETCH_FIRSTPOST,
'order' => 'post_date',
'orderDirection' => 'desc',
'limit' => 5);
$threads = $threadModel->getThreadsInForum( 2, $conditions, $fetchOptions ); // 2 is the node
foreach ( $threads AS $threadId => $thread ) {
if ( $threadModel->canViewThread( $thread, $thread ) ) {
$formatter = XenForo_BbCode_Formatter_Base::create();
$parser = new XenForo_BbCode_Parser($formatter);
$html = $parser->render($thread['message']);
echo $html .'<br /><br /><hr>';
}
}
?>
</div><!-- #mainstory -->
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
EDIT: Nice work on your site LPH looks good, the more internal links the better as you have a hell of a lot of OBL that should help balance that out.. not only looks good but is very helpful for the end-user.
That was what I was worried about. ...but...Forest they way that ExpertPixels is doing things, is using the XF application code, and inserting the query results into it. You couldn't just stick the .php at the bottom of any old .php page and have it magically work.
Perhaps I could do what LPH did? I mean, embedding in WP can't be that much different from embedding in MediaWiki.Decided to attempt this in a WordPress page. It worked okay but there are some slight changes needed.
That was what I was worried about. ...but...
Perhaps I could do what LPH did? I mean, embedding in WP can't be that much different from embedding in MediaWiki.
LPH, what did you do to ensure access to XenForo_Model, etc?
Promoting threads could be quite a big feature and would take fundamental changes to the above code.
You would need to use the kotomi shell and pop it into a media wiki <div> tagThat was what I was worried about. ...but...
Perhaps I could do what LPH did? I mean, embedding in WP can't be that much different from embedding in MediaWiki.
LPH, what did you do to ensure access to XenForo_Model, etc?
If you just want to promote a thread into WP or media wiki that's super easy.
<?php
$threadModel = XenForo_Model::create('XenForo_Model_Thread');
$fetchOptions = array('join' => XenForo_Model_Thread::FETCH_FIRSTPOST);
$threadModel->getThreadById($id, $fetchOptions);
The only thing you need to watch if are doing this automagically is avoiding have spam posted to WP and ensuring you adhere to forum permissions. Don't want private forums pushed to WP.You can pull a thread by id using:
PHP:<?php $threadModel = XenForo_Model::create('XenForo_Model_Thread'); $fetchOptions = array('join' => XenForo_Model_Thread::FETCH_FIRSTPOST); $threadModel->getThreadById($id, $fetchOptions);
However, that is essentially 1 query per thread. You can manually write that for several threads to minimize or optimize.
But if you want to do it manually, with a button so admins or mods can decide to push it, then it's much less worrisome.
We use essential cookies to make this site work, and optional cookies to enhance your experience.