static function template_redirect() { if (!function_exists('bbp_get_forum_id')) { return; } $forum_id = bbp_get_forum_id(); // Is this even a forum page at all? if (!bbp_is_forum_archive() && !empty($forum_id) && pmpro_bbp_is_forum()) { //is there a class for this forum? $class = new SPClass(); $class->getClassByForumID($forum_id); //class? make sure the current user is a member if (!empty($class->id) && !$class->isMember()) { wp_redirect(get_permalink($class->id)); exit; } } }
?> <?php do_action('sb_before_post_content'); ?> <div class="entry-content"> <?php wp_link_pages(array('before' => '<div class="entry-pages cb">' . __('Pages:', 'startbox'), 'after' => '</div>')); ?> <?php if (!empty($_REQUEST['invite']) && $class->isTeacher()) { get_template_part('class', 'invite'); } elseif ($class->isMember()) { //default, show assignments (move into template part?) ?> <h3> Assignments <?php if ($class->isTeacher()) { ?> <a class="btn btn-info btn-xs" href="/edit-assignment/?class_id=<?php echo $class->id; ?> "><i class="fa fa-plus"></i> New Assignment</a> <?php } ?> </h3>