/**
* Prints the box content.
*
* @since 2.2.0.1
*
* @param $forums
*/
function show_forum_id_meta_box( $post ) {
// Add an nonce field so we can check for it later.
wp_nonce_field( 'xenword_meta_forum_id_box', 'xenword_meta_box_forum_id_nonce' );
$forums = XenForo_Model_Node::create( 'XenForo_Model_Node' )->getModelFromCache( 'XenForo_Model_Node' )->getViewableNodeList( null, true );
echo '<select id="xenword_forum_id" name="xenword_forum_id" class="textCtrl" ><optgroup label="Choose Forum">';
foreach ( $forums as $forum ) {
if ($forum['node_type_id'] == 'Forum') {
echo '<option value="' . $forum['node_id'] . '"';
echo ' selected="selected"' . 'class="_depth' . $forum['depth'] . '"';
echo '>' . $forum['title'] . '</option>';
}
}
echo '</optgroup></select>';
}
if ($forum['node_type_id'] == 'Forum') {
/**
* Prints the box content.
*
* @since 2.2.0.1
*
* @param $post
*
* @throws XenForo_Exception
*/
function show_forum_id_meta_box( $post ) {
// Add an nonce field so we can check for it later.
wp_nonce_field( 'xenword_meta_forum_id_box', 'xenword_meta_box_forum_id_nonce' );
$forumId = $post->forum_id;
/** @var $forumModel XenForo_Model_Node */
$forumModel = XenForo_Model_Node::create( 'XenForo_Model_Node' );
$forums = $forumModel->getViewableNodeList( null, true );
echo '<select id="xenword_forum_id" name="xenword_forum_id" class="textCtrl" >';
foreach ( $forums as $forum ) {
if ( $forum['node_type_id'] == 'Forum' ) {
echo '<option value="' . $forum['node_id'] . '"';
if ( $forum['node_id'] == $forumId ) {
echo 'selected="selected"';
}
echo ' class="_depth' . $forum['depth'] . '">' . $forum['title'] . '</option>';
}
}
echo '</select>';
}