?>
	</p>

</header><!-- .mb-page-header -->

<?php 
if (current_user_can('read_forum', mb_get_forum_id())) {
    // Check if the current user can read the forum.
    ?>

	<?php 
    mb_get_template_part('loop-forum', mb_show_hierarchical_forums() ? 'hierarchical' : 'flat');
    ?>

	<?php 
    if (mb_forum_type_allows_topics(mb_get_forum_type())) {
        // Only show topics if they're allowed.
        ?>

		<?php 
        mb_get_template_part('loop', 'topic');
        ?>

	<?php 
    }
    // End show topics check.
    ?>

<?php 
}
// End check to see if user can read forum.
Example #2
0
/**
 * Conditional check to see if a forum allows new topics to be created.
 *
 * @since  1.0.0
 * @access public
 * @param  int    $forum_id
 * @return bool
 */
function mb_forum_allows_topics($forum_id = 0)
{
    $forum_id = mb_get_forum_id($forum_id);
    $parent_id = mb_get_forum_parent_id($forum_id);
    $allow = true;
    /* Check if the forum type allows topics. */
    if (!mb_forum_type_allows_topics(mb_get_forum_type($forum_id))) {
        $allow = false;
    } elseif (!mb_forum_status_allows_topics(mb_get_forum_status($forum_id))) {
        $allow = false;
    } elseif (0 < $parent_id && !mb_forum_status_allows_topics(mb_get_forum_status($parent_id))) {
        $allow = false;
    }
    return apply_filters('mb_forum_allows_subforums', $allow, $forum_id);
}