function rpg_settings_page()
{
    global $rpg_settingsf;
    global $rpg_settingsg;
    global $rpg_groups;
    global $rpg_group_last;
    ?>
	<div class="wrap">
		<div id="upb-wrap" class="upb-help">
			<h2><?php 
    _e('Private Group Settings', 'bbp-private-groups');
    ?>
</h2>
			<?php 
    if (!isset($_REQUEST['updated'])) {
        $_REQUEST['updated'] = false;
    }
    ?>
			<?php 
    if (false !== $_REQUEST['updated']) {
        ?>
			<div class="updated fade"><p><strong><?php 
        _e('Group saved', 'bbp-private-groups');
        ?>
 ); ?></strong></p></div>
			<?php 
    }
    ?>
			
			<?php 
    //tests if we have selected a tab
    ?>
			<?php 
    if (isset($_GET['tab'])) {
        if ($active_tab == 'user_management') {
            pg_user_management($tab);
        }
        $active_tab = $_GET['tab'];
    } else {
        $active_tab = 'forum_visibility_settings';
    }
    // end if
    ?>
		
		<?php 
    // sets up the tabs
    ?>
			
		<h2 class="nav-tab-wrapper">
		
	<a href="?page=bbp-private-group-settings&tab=forum_visibility_settings" class="nav-tab <?php 
    echo $active_tab == 'forum_visibility_settings' ? 'nav-tab-active' : '';
    ?>
">Forum Visibility settings</a>
	<a href="?page=bbp-private-group-settings&tab=general_settings" class="nav-tab <?php 
    echo $active_tab == 'general_settings' ? 'nav-tab-active' : '';
    ?>
">General Settings</a>
 	<a href="?page=bbp-private-group-settings&tab=group_name_settings" class="nav-tab <?php 
    echo $active_tab == 'group_name_settings' ? 'nav-tab-active' : '';
    ?>
">Group Name Settings</a>
	<a href="?page=bbp-private-group-settings&tab=help" class="nav-tab <?php 
    echo $active_tab == 'help' ? 'nav-tab-active' : '';
    ?>
">Help</a>
	<a href="?page=bbp-private-group-settings&tab=management_information"  class="nav-tab <?php 
    echo $active_tab == 'Management_information' ? 'nav-tab-active' : '';
    ?>
">Management Information</a>
	<a href="?page=bbp-private-group-settings&tab=user_management"  class="nav-tab <?php 
    echo $active_tab == 'user_management' ? 'nav-tab-active' : '';
    ?>
">User Management</a></h2>	
	<table class="form-table">
			<tr>
			
			<td>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="S6PZGWPG3HLEA">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</td><td>
<?php 
    _e("If you find this plugin useful, please consider donating just a couple of dollars to help me develop and maintain it. You support will be appreciated", 'bbp-last-post');
    ?>


</td>
</tr>
</table>

<?php 
    //************************* Forum Visibility settings *************************//
    ?>

<?php 
    if ($active_tab == 'forum_visibility_settings') {
        ?>
			<form method="post" action="options.php">
			
			<?php 
        settings_fields('rpg_forum_settings');
        ?>
			
			<table class="form-table">
			
			<!-------------------------------Forum visibility ---------------------------------------->
			
			<tr valign="top">
						<th><h3><?php 
        _e('Forum Visibility', 'bbp-private-groups');
        ?>
</h3></th>
						<td><p><?php 
        _e('By default only users with access to a forum will see the forum titles in the indexes.  However you may want everyone to see that a forum exists (ie see the title) but not be able to access topics and replies within this.  In this case, set the forum visibility below.  If you want only logged in users to see these forums exist, then also set the forum to private within the dashboard>forums settings', 'bbp-private-groups');
        ?>
 <b> See help tab for more information</b></p></td>
			</tr>
			
			<!-- checkbox to activate -->
					<tr valign="top">  
					<th><?php 
        _e('Activate', 'bbp-private-groups');
        ?>
</th>
					<td>
					<?php 
        activate_forum_visibility_checkbox();
        ?>
					</td>
					</tr>
					
					<!-------------------------------Redirect Pages ---------------------------------------->
					
					<tr valign="top">
						<th><h3><?php 
        _e('Redirect Pages', 'bbp-private-groups');
        ?>
</h3></th>
						<td><p><?php 
        _e('<b>If you have activated forum visibility above</b>, then users without access will see forums headings and descriptions.  When they click these  forum titles, they need to be sent somewhere, if only to say that they do not have access.  However this is an excellent opportunity to "sign them up" so you can send them to say a register or buy access page. ', 'bbp-private-groups');
        ?>
</p></td>
					</tr>
					
					<tr valign="top">
					<th><?php 
        _e('URL of redirect page for LOGGED-IN user', 'bbp-private-groups');
        ?>
</th>
					<td>
						<input id="rpg_settingsf[redirect_page1]" class="large-text" name="rpg_settingsf[redirect_page1]" type="text" value="<?php 
        echo isset($rpg_settingsf['redirect_page1']) ? esc_html($rpg_settingsf['redirect_page1']) : '';
        ?>
" /><br/>
						<label class="description" for="rpg_settingsf[redirect_page]"><?php 
        _e('Enter the full url (permalink) of the page to redirect users without access to eg http://www.mysite.com/sign-up.  If you leave this blank, users will see your sites "404 not-found" page', 'bbp-private-groups');
        ?>
</label><br/>
					</td>
					</tr>
					
					<tr valign="top">
					<th><?php 
        _e('URL of redirect page for NON-LOGGED-IN', 'bbp-private-groups');
        ?>
</th>
					<td>
						<input id="rpg_settingsf[redirect_page2]" class="large-text" name="rpg_settingsf[redirect_page2]" type="text" value="<?php 
        echo isset($rpg_settingsf['redirect_page2']) ? esc_html($rpg_settingsf['redirect_page2']) : '';
        ?>
" /><br/>
						<label class="description" for="rpg_settingsf[redirect_page]"><?php 
        _e('Enter the full url (permalink) of the page to redirect users without access to eg http://www.mysite.com/sign-up.  This can be the same as the LOGGED-IN page, just giving the opportunity to have different pages if you want them !  If you leave this blank, users will be sent to the wordpress login page', 'bbp-private-groups');
        ?>
</label><br/>
					</td>
					</tr>
					
					<!-------------------------------Freshness settings ---------------------------------------->
					
					<tr valign="top">
						<th><?php 
        _e('Freshness Settings', 'bbp-private-groups');
        ?>
</th>
						<td><p><?php 
        _e('<b>If you have activated forum visibility above</b>, for private group forums, when user does not have access, you can either show a message in freshness column, or leave it as the default time since last post.  In both cases for users without access they will be taken to the redirect page above. ', 'bbp-private-groups');
        ?>
</p></td>
					</tr>
					
					<!-- checkbox to activate -->
					<tr valign="top">  
					<th><?php 
        _e('Activate', 'bbp-private-groups');
        ?>
</th>
					<td>
					<?php 
        freshness_checkbox();
        ?>
					</td>
					</tr>
					
					<tr valign="top">
					<th><?php 
        _e('Freshness Message', 'bbp-private-groups');
        ?>
</th>
					<td>
						<input id="rpg_settingsf[freshness_message]" class="large-text" name="rpg_settingsf[freshness_message]" type="text" value="<?php 
        echo isset($rpg_settingsf['freshness_message']) ? esc_html($rpg_settingsf['freshness_message']) : '';
        ?>
" /><br/>
						<label class="description" for="rpg_settingsf[redirect_page]"><?php 
        _e('Enter the message to be shown e.g. Click here to sign up', 'bbp-private-groups');
        ?>
</label><br/>
					</td>
					</tr>
					
					</table>
					
					<!-- save the options -->
				<p class="submit">
					<input type="submit" class="button-primary" value="<?php 
        _e('Save Options', 'bbp-private-groups');
        ?>
" />
				</p>
				
				</form>
		</div><!--end sf-wrap-->
	</div><!--end wrap-->
	
	<?php 
    }
    ?>
	
	<?php 
    //************************* General settings *************************//
    ?>
	
	<?php 
    if ($active_tab == 'general_settings') {
        ?>
			<form method="post" action="options.php">
			
			<?php 
        settings_fields('rpg_general_settings');
        ?>
			
			<table class="form-table">
					<!------------------------------- Hide topic/reply counts ------------------------------------------>
					<tr valign="top">
						<th colspan="2"><h3><?php 
        _e('Hide topic and reply counts', 'bbp-private-groups');
        ?>
</h3></th>
					</tr>
			
			<!-- checkbox to activate -->
					<tr valign="top">  
					<th><?php 
        _e('Activate', 'bbp-private-groups');
        ?>
</th>
					<td>
					<?php 
        activate_hide_counts_checkbox();
        ?>
					</td>
					</tr>
					
					<!------------------------------- Descriptions ------------------------------------------>
					<tr valign="top">
						<th colspan="2"><h3><?php 
        _e('Show Descriptions', 'bbp-private-groups');
        ?>
</h3></th>
					</tr>
					
					<!-- checkbox to activate -->
					<tr valign="top">  
					<th><?php 
        _e('Activate', 'bbp-private-groups');
        ?>
</th>
					<td>
					<?php 
        activate_descriptions_checkbox();
        ?>
					</td>
					</tr>
					
					<!------------------------------- Remove 'Private' prefix ------------------------------------------>
					<tr valign="top">
						<th colspan="2"><h3><?php 
        _e("Remove 'Private' prefix", 'bbp-private-groups');
        ?>
</h3></th>
					</tr>
					
					<!-- checkbox to activate -->
					<tr valign="top">  
					<th><?php 
        _e('Activate', 'bbp-private-groups');
        ?>
</th>
					<td>
					<?php 
        activate_private_prefix_checkbox();
        ?>
					</td>
					</tr>
					<tr valign="top">
					<td></td><td><?php 
        _e('By default bbPress shows the prefix "Private" before each private forum. Activate this checkbox to remove this prefix.', 'bbp-private-groups');
        ?>
</td>
					</tr>
					
					</table>
				
				<!-- save the options -->
				<p class="submit">
					<input type="submit" class="button-primary" value="<?php 
        _e('Save Options', 'bbp-private-groups');
        ?>
" />
				</p>
				
				</form>
		</div><!--end sf-wrap-->
	</div><!--end wrap-->
	
	<?php 
    }
    ?>
	
	
	
	
	<?php 
    //************************* Group name settings *************************//
    ?>
			<?php 
    if ($active_tab == 'group_name_settings') {
        ?>
			<form method="post" action="options.php">
			
			<?php 
        settings_fields('rpg_group_settings');
        ?>
			
			<table class="form-table">
			
			<tr valign="top">
			<th colspan="2"><p> This section allows you to set up groups.  Enter a Description for each group eg gamers, teachers, group1 etc.</p></th>
			</tr>
			<?php 
        $count = count($rpg_groups);
        if ($count == 1) {
            $count = 2;
        }
        for ($i = 0; $i < $count; ++$i) {
            $g = $i + 1;
            $name = "group" . $g;
            $item = "rpg_groups[" . $name . "]";
            ?>
			<!-------------------------  Group  --------------------------------------------->		
					<tr valign="top">
					<th><?php 
            echo $name;
            ?>
</th>
					<td>
					<?php 
            echo '<input id="' . $item . '" class="large-text" name="' . $item . '" type="text" value="' . esc_html($rpg_groups[$name]) . '"<br>';
            ?>
					</td>
					</tr>
					<?php 
        }
        ?>
					<!-- checkbox to activate new group -->
					<tr valign="top">  
					<th><?php 
        _e('Add new group', 'bbp-private-groups');
        ?>
</th>
					<td>
					<?php 
        activate_new_group();
        ?>
					
					</td>
					</tr>
					
					
					</table>
					<!-- save the options -->
				<p class="submit">
					<input type="submit" class="button-primary" value="<?php 
        _e('Save Groups', 'bbp-private-groups');
        ?>
" />
				</p>
				</form>
		</div><!--end sf-wrap-->
	</div><!--end wrap-->
	
<?php 
    }
    ?>

<?php 
    //************************* help page *************************//
    ?>
			<?php 
    if ($active_tab == 'help') {
        ?>
			<form method="post" action="options.php">

				<table class="form-table">
					
					<tr valign="top">
						<th colspan="2">
						
						<h3>Forum Visibility Settings</h3>

<p>You have various display options</p>

<h4><span style="color:blue">Only logged in users see group forums, and even then only ones that they have access to.</span></h4>

<p><i>Description : </i> the default view.  Allows up to 8 groups with unique combination of access to forums, but they only see those they have access to.</p>

<p><i>To set : </i>Do not set the visibility.</p>

<h4><span style="color:blue">All forum titles (and optionally descriptions) visible to both logged on and non-logged on users.</span></h4>

<p><i>Description: </i>Users and non-users will be able to see that group forums exist, but not access topics/replies.</p>

<p><i>Possible Usage : </i>show that lots of forums exist, with ability to go to “sign-up” page.</p>

<p><i>To set: </i>Set visibility to public below and set forums to public in each forum’s attributes (dashboard>forums).</p>

<h4><span style="color:blue">Public forums titles (and optionally descriptions) visible to logged on and non-logged on users.
Private forums set visible to logged on users</span></h4>

<p><i>Description : </i>Non-logged in will only see group forums that are public, but not access topics/replies.  Logged in users will see and access topics/replies for Private Group forums that are set to public, private forums that have no groups set will be accessible to all logged in users, but private group forums that the user does not belong to will be hidden. </p> 

<p><i>Possible Usage : </i>Show some group forums exists, whilst keeping others visible only for private groups.  Allows rich display options for each group, and user.</p>

<p><i>To set : </i>Set visibility to public below and set any private forums to private in that forum’s attributes (dashboard>forums). </p>

 </th>
					</tr>
					<a href="http://www.rewweb.co.uk/wp-content/uploads/2014/04/private-group-roles1.jpg"><img src="http://www.rewweb.co.uk/wp-content/uploads/2014/04/private-group-roles1.jpg"/> </a>
					</form>
		</div><!--end sf-wrap-->
	</div><!--end wrap-->
<?php 
    }
    ?>

<?php 
    //************************* Management Info *************************//
    ?>
			<?php 
    if ($active_tab == 'management_information') {
        ?>
					
			<?php 
        settings_fields('rpg_group_settings');
        ?>
			
			<table class="form-table">
			
			<tr valign="top">
			
			</tr>
			<?php 
        $count = count($rpg_groups);
        for ($i = 0; $i < $count; ++$i) {
            $g = $i + 1;
            $name = "group" . $g;
            $item = "rpg_groups[" . $name . "]";
            ?>
			<!-------------------------  Group  --------------------------------------------->		
					<tr valign="top">
					<th><?php 
            echo $name;
            ?>
</th>
					<td>
					Group name : 
					<?php 
            echo esc_html($rpg_groups[$name]) . '<br>';
            ?>
					No. users in this group : 
					<?php 
            global $wpdb;
            $users = $wpdb->get_col("select ID from {$wpdb->users}");
            $countu = 0;
            foreach ($users as $user) {
                $check = get_user_meta($user, 'private_group', true);
                if ($check == $name) {
                    $countu++;
                }
            }
            echo $countu;
            ?>
					

					<br>Forums in this group :
					<?php 
            global $wpdb;
            $forum = bbp_get_forum_post_type();
            $forums = $wpdb->get_col("select ID from {$wpdb->posts} where post_type='{$forum}'");
            $countu = 0;
            echo '<ul><i>';
            foreach ($forums as $forum) {
                $meta = (array) get_post_meta($forum, '_private_group', false);
                foreach ($meta as $meta2) {
                    if ($meta2 == $name) {
                        $ftitle = bbp_forum_title($forum);
                        echo '<li>' . $ftitle . '</li>';
                        $countu++;
                    }
                }
            }
            echo '</ul></i>';
            echo 'No. forums that have this group set : ' . $countu;
            ?>
					</td></tr>
					<?php 
        }
        ?>
													
					</table>
					
				</form>
		</div><!--end sf-wrap-->
	</div><!--end wrap-->
	
<?php 
    }
    ?>

<?php 
    //****  user management
    if ($active_tab == 'user_management') {
        $group = 'all';
        pg_user_management($group);
    }
    //end of tab function
}
示例#2
0
				<?php 
    bbp_topic_subscription_link();
    ?>
				<?php 
    bbp_topic_favorite_link();
    ?>
		</li>
		<?php 
}
?>
		<li class="topic-info-general clearfix">
			<div class="path fl"><a href="<?php 
bbp_forum_permalink(bbp_get_forum_id());
?>
"><?php 
bbp_forum_title(bbp_get_topic_forum_id(bbp_get_topic_id()));
?>
</a></div>
			<div class="date fr">
				<time datetime="<?php 
echo get_post_time('c', false, bbp_get_topic_id());
?>
">
					<?php 
printf(_x('%1$s at %2$s', '1: date, 2: time'), get_post_time(bbpresskr()->forum_option('date_format'), false, bbp_get_topic_id()), get_post_time(bbpresskr()->forum_option('time_format'), false, bbp_get_topic_id()));
?>
				</time>
			</div>
			<div class="title"><?php 
bbp_topic_title();
?>
    function ipt_kb_bbp_forum_title_in_list($forum_id = 0)
    {
        do_action('bbp_theme_before_forum_title');
        ?>
<a class="bbp-forum-title" href="<?php 
        bbp_forum_permalink($forum_id);
        ?>
"><?php 
        bbp_forum_title($forum_id);
        ?>
</a>
<?php 
        do_action('bbp_theme_after_forum_title');
        ?>
	<?php 
    }
示例#4
0
    /**
     * Displays the output, the forum list
     *
     * @since bbPress (r2653)
     *
     * @param mixed $args Arguments
     * @param array $instance Instance
     * @uses apply_filters() Calls 'bbp_forum_widget_title' with the title
     * @uses get_option() To get the forums per page option
     * @uses current_user_can() To check if the current user can read
     *                           private() To resety name
     * @uses bbp_has_forums() The main forum loop
     * @uses bbp_forums() To check whether there are more forums available
     *                     in the loop
     * @uses bbp_the_forum() Loads up the current forum in the loop
     * @uses bbp_forum_permalink() To display the forum permalink
     * @uses bbp_forum_title() To display the forum title
     */
    public function widget($args, $instance)
    {
        // Get widget settings
        $settings = $this->parse_settings($instance);
        // Typical WordPress filter
        $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base);
        // bbPress filter
        $settings['title'] = apply_filters('bbp_forum_widget_title', $settings['title'], $instance, $this->id_base);
        // Note: private and hidden forums will be excluded via the
        // bbp_pre_get_posts_normalize_forum_visibility action and function.
        $widget_query = new WP_Query(array('post_type' => bbp_get_forum_post_type(), 'post_parent' => $settings['parent_forum'], 'post_status' => bbp_get_public_status_id(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'orderby' => 'menu_order title', 'order' => 'ASC'));
        // Bail if no posts
        if (!$widget_query->have_posts()) {
            return;
        }
        echo $args['before_widget'];
        if (!empty($settings['title'])) {
            echo $args['before_title'] . $settings['title'] . $args['after_title'];
        }
        ?>

		<ul>

			<?php 
        while ($widget_query->have_posts()) {
            $widget_query->the_post();
            ?>

				<li><a class="bbp-forum-title" href="<?php 
            bbp_forum_permalink($widget_query->post->ID);
            ?>
"><?php 
            bbp_forum_title($widget_query->post->ID);
            ?>
</a></li>

			<?php 
        }
        ?>

		</ul>

		<?php 
        echo $args['after_widget'];
        // Reset the $post global
        wp_reset_postdata();
    }
示例#5
0
    /**
     * Displays the output, the forum list
     *
     * @since bbPress (r2653)
     *
     * @param mixed $args Arguments
     * @param array $instance Instance
     * @uses apply_filters() Calls 'bbp_forum_widget_title' with the title
     * @uses get_option() To get the forums per page option
     * @uses current_user_can() To check if the current user can read
     *                           private() To resety name
     * @uses bbp_has_forums() The main forum loop
     * @uses bbp_forums() To check whether there are more forums available
     *                     in the loop
     * @uses bbp_the_forum() Loads up the current forum in the loop
     * @uses bbp_forum_permalink() To display the forum permalink
     * @uses bbp_forum_title() To display the forum title
     */
    public function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('bbp_forum_widget_title', $instance['title']);
        $parent_forum = !empty($instance['parent_forum']) ? $instance['parent_forum'] : '0';
        // Note: private and hidden forums will be excluded via the
        // bbp_pre_get_posts_exclude_forums filter and function.
        $widget_query = new WP_Query(array('post_parent' => $parent_forum, 'post_type' => bbp_get_forum_post_type(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order', 'order' => 'ASC'));
        if ($widget_query->have_posts()) {
            echo $before_widget;
            echo $before_title . $title . $after_title;
            ?>

			<ul>

				<?php 
            while ($widget_query->have_posts()) {
                $widget_query->the_post();
                ?>

					<li><a class="bbp-forum-title" href="<?php 
                bbp_forum_permalink($widget_query->post->ID);
                ?>
" title="<?php 
                bbp_forum_title($widget_query->post->ID);
                ?>
"><?php 
                bbp_forum_title($widget_query->post->ID);
                ?>
</a></li>

				<?php 
            }
            ?>

			</ul>

			<?php 
            echo $after_widget;
            // Reset the $post global
            wp_reset_postdata();
        }
    }
示例#6
0
                            <ul id="forums-list-<?php 
        bbp_forum_id();
        ?>
" class="bbp-forums">
     
                                    <li class="bbp-header">
     
                                            <ul class="forum-titles">
                                                    <li class="bbp-forum-info"><?php 
        if (bbp_is_forum_category()) {
            ?>
<a class="bbp-forum-title" href="<?php 
            bbp_forum_permalink(bbp_get_forum_parent_id());
            ?>
"><?php 
            bbp_forum_title(bbp_get_forum_parent_id());
            ?>
</a><?php 
        } else {
            _e('Forum', 'bbpress');
        }
        ?>
</li>
                                                    <li class="bbp-forum-topic-count"><?php 
        _e('Topics', 'bbpress');
        ?>
/<?php 
        bbp_show_lead_topic() ? _e('Replies', 'bbpress') : _e('Posts', 'bbpress');
        ?>
</li>
                                                    <li class="bbp-forum-freshness"><?php 
        ?>





<?php 
        ?>


            <ul class="td-reply-list-header">
                <li class="td-posted-in">Posted in: <a href="<?php 
        bbp_forum_permalink(bbp_get_forum_id());
        ?>
"><?php 
        bbp_forum_title(bbp_get_forum_id());
        ?>
</a>
                </li>
                <li class="td-favorite-subscribe">
                    <?php 
        bbp_user_favorites_link();
        ?>
                    <?php 
        bbp_user_subscribe_link();
        ?>
                </li>
            </ul>


            <?php 
示例#8
0
		<div class="row column-content-wrapper">
			<div id="content" class="span12 article-container tc-gallery-style">   


				<article class="row-fluid">
					
					<?php do_action( 'bbp_before_main_content' ); ?>

					<?php do_action( 'bbp_template_notices' ); ?>

					<?php while ( have_posts() ) : the_post(); ?>

						<?php if ( bbp_user_can_view_forum() ) : ?>

							<div id="forum-<?php bbp_forum_id(); ?>" class="bbp-forum-content">
								<h1 class="entry-title"><?php bbp_forum_title(); ?></h1>
								<div class="entry-content">

									<?php bbp_get_template_part( 'content', 'single-forum' ); ?>

								</div>
							</div><!-- #forum-<?php bbp_forum_id(); ?> -->

						<?php else : // Forum exists, user no access ?>

							<?php bbp_get_template_part( 'feedback', 'no-access' ); ?>

						<?php endif; ?>

					<?php endwhile; ?>
示例#9
0
        /**
         * Output the forums for a group in the edit screens
         *
         * As of right now, bbPress only supports 1-to-1 group forum relationships.
         * In the future, many-to-many should be allowed.
         *
         * @since bbPress (r3653)
         * @uses bp_get_current_group_id()
         * @uses bbp_get_group_forum_ids()
         * @uses bbp_has_forums()
         * @uses bbp_get_template_part()
         */
        public function display_forums($offset = 0)
        {
            global $wp_query;
            // Allow actions immediately before group forum output
            do_action('bbp_before_group_forum_display');
            // Load up bbPress once
            $bbp = bbpress();
            /** Query Resets ******************************************************/
            // Forum data
            $forum_action = bp_action_variable($offset);
            $forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
            $forum_id = array_shift($forum_ids);
            // Always load up the group forum
            bbp_has_forums(array('p' => $forum_id, 'post_parent' => null));
            // Set the global forum ID
            $bbp->current_forum_id = $forum_id;
            // Assume forum query
            bbp_set_query_name('bbp_single_forum');
            ?>

		<div id="bbpress-forums">

			<?php 
            switch ($forum_action) {
                /** Single Forum **********************************************/
                case false:
                case 'page':
                    // Strip the super stickies from topic query
                    add_filter('bbp_get_super_stickies', array($this, 'no_super_stickies'), 10, 1);
                    // Unset the super sticky option on topic form
                    add_filter('bbp_get_topic_types', array($this, 'unset_super_sticky'), 10, 1);
                    // Query forums and show them if they exist
                    if (bbp_forums()) {
                        // Setup the forum
                        bbp_the_forum();
                        ?>

						<h3><?php 
                        bbp_forum_title();
                        ?>
</h3>

						<?php 
                        bbp_get_template_part('content', 'single-forum');
                        // No forums found
                    } else {
                        ?>

						<div id="message" class="info">
							<p><?php 
                        esc_html_e('This group does not currently have a forum.', 'bbpress');
                        ?>
</p>
						</div>

					<?php 
                    }
                    break;
                    /** Single Topic **********************************************/
                /** Single Topic **********************************************/
                case $this->topic_slug:
                    // hide the 'to front' admin links
                    add_filter('bbp_get_topic_stick_link', array($this, 'hide_super_sticky_admin_link'), 10, 2);
                    // Get the topic
                    bbp_has_topics(array('name' => bp_action_variable($offset + 1), 'posts_per_page' => 1, 'show_stickies' => false));
                    // If no topic, 404
                    if (!bbp_topics()) {
                        bp_do_404(bbp_get_forum_permalink($forum_id));
                        ?>
						<h3><?php 
                        bbp_forum_title();
                        ?>
</h3>
						<?php 
                        bbp_get_template_part('feedback', 'no-topics');
                        return;
                    }
                    // Setup the topic
                    bbp_the_topic();
                    ?>

					<h3><?php 
                    bbp_topic_title();
                    ?>
</h3>

					<?php 
                    // Topic edit
                    if (bp_action_variable($offset + 2) === bbp_get_edit_rewrite_id()) {
                        // Unset the super sticky link on edit topic template
                        add_filter('bbp_get_topic_types', array($this, 'unset_super_sticky'), 10, 1);
                        // Set the edit switches
                        $wp_query->bbp_is_edit = true;
                        $wp_query->bbp_is_topic_edit = true;
                        // Setup the global forum ID
                        $bbp->current_topic_id = get_the_ID();
                        // Merge
                        if (!empty($_GET['action']) && 'merge' === $_GET['action']) {
                            bbp_set_query_name('bbp_topic_merge');
                            bbp_get_template_part('form', 'topic-merge');
                            // Split
                        } elseif (!empty($_GET['action']) && 'split' === $_GET['action']) {
                            bbp_set_query_name('bbp_topic_split');
                            bbp_get_template_part('form', 'topic-split');
                            // Edit
                        } else {
                            bbp_set_query_name('bbp_topic_form');
                            bbp_get_template_part('form', 'topic');
                        }
                        // Single Topic
                    } else {
                        bbp_set_query_name('bbp_single_topic');
                        bbp_get_template_part('content', 'single-topic');
                    }
                    break;
                    /** Single Reply **********************************************/
                /** Single Reply **********************************************/
                case $this->reply_slug:
                    // Get the reply
                    bbp_has_replies(array('name' => bp_action_variable($offset + 1), 'posts_per_page' => 1));
                    // If no topic, 404
                    if (!bbp_replies()) {
                        bp_do_404(bbp_get_forum_permalink($forum_id));
                        ?>
						<h3><?php 
                        bbp_forum_title();
                        ?>
</h3>
						<?php 
                        bbp_get_template_part('feedback', 'no-replies');
                        return;
                    }
                    // Setup the reply
                    bbp_the_reply();
                    ?>

					<h3><?php 
                    bbp_reply_title();
                    ?>
</h3>

					<?php 
                    if (bp_action_variable($offset + 2) === bbp_get_edit_rewrite_id()) {
                        // Set the edit switches
                        $wp_query->bbp_is_edit = true;
                        $wp_query->bbp_is_reply_edit = true;
                        // Setup the global reply ID
                        $bbp->current_reply_id = get_the_ID();
                        // Move
                        if (!empty($_GET['action']) && 'move' === $_GET['action']) {
                            bbp_set_query_name('bbp_reply_move');
                            bbp_get_template_part('form', 'reply-move');
                            // Edit
                        } else {
                            bbp_set_query_name('bbp_reply_form');
                            bbp_get_template_part('form', 'reply');
                        }
                    }
                    break;
            }
            // Reset the query
            wp_reset_query();
            ?>

		</div>

		<?php 
            // Allow actions immediately after group forum output
            do_action('bbp_after_group_forum_display');
        }
示例#10
0
function td_show_forum($forum_object)
{
    $last_active = bbp_get_forum_last_active_id($forum_object->ID);
    $time_since = '';
    $last_updated_by_avatar = '';
    if (!empty($last_active)) {
        $time_since = bbp_get_forum_freshness_link($forum_object->ID);
        $last_updated_by_avatar = bbp_get_author_link(array('post_id' => $last_active, 'size' => 40, 'type' => 'avatar'));
        //echo $time_since;
    }
    ?>
    <div class="clearfix"></div>
    <ul class="td-forum-list-table td-forum-content">
        <li class="td-forum-category-title<?php 
    if (empty($forum_object->post_content)) {
        echo ' td-forum-title-no-desc';
    }
    ?>
">
            <div class="td-forum-index-padd">
                <a class="bbp-forum-title" href="<?php 
    bbp_forum_permalink($forum_object->ID);
    ?>
"><?php 
    bbp_forum_title($forum_object->ID);
    ?>
</a>
                <?php 
    if (!empty($forum_object->post_content)) {
        ?>
                    <div class="td-forum-description"><?php 
        echo $forum_object->post_content;
        ?>
</div>
                <?php 
    }
    ?>

                </li><li class="td-forum-replies">
                    <div><?php 
    echo bbp_get_forum_topic_count($forum_object->ID);
    ?>
 topics</div>
                    <div><?php 
    echo bbp_get_forum_reply_count($forum_object->ID);
    ?>
 replies</div>
                </li><li class="td-forum-last-comment">

                <div>
                    <?php 
    echo $last_updated_by_avatar;
    ?>
                </div>



                <div class="td-forum-last-comment-content">
                    <div class="td-forum-author-name">
                        by <a class="td-forum-last-author" href="<?php 
    bbp_reply_author_url($last_active);
    ?>
"><?php 
    echo bbp_get_topic_author_display_name($last_active);
    ?>
</a>
                    </div>
                    <div class="td-forum-time-comment">
                        <?php 
    bbp_forum_freshness_link($forum_object->ID);
    ?>
                    </div>
                </div>
        </li>
    </ul>
    <div class="clearfix"></div>
    <?php 
}
示例#11
0
/**
 * Display nested subforums with a hierarchical structure using their parent category
 * @version 2.0
 */
function apoc_loop_subforums()
{
    // Exclude private forums
    $private = apoc_private_forum_ids();
    // Check for subforums
    $subs = bbp_forum_get_subforums(array('post__not_in' => $private));
    if (empty($subs)) {
        return;
    }
    // Buffer output
    ob_start();
    // Print a header
    ?>
	<header class="forum-header">
		<div class="forum-content"><h2><?php 
    bbp_forum_title();
    ?>
</h2></div>
		<div class="forum-count">Topics</div>
		<div class="forum-freshness">Latest Post</div>
	</header>
	<ol class="forums category <?php 
    bbp_forum_status();
    ?>
"><?php 
    // Loop over forums
    foreach ($subs as $count => $sub) {
        // Get forum details
        $sub_id = $sub->ID;
        $title = $sub->post_title;
        $desc = $sub->post_content;
        $permalink = bbp_get_forum_permalink($sub_id);
        // Get topic counts
        $topics = bbp_get_forum_topic_count($sub_id, false);
        // Get the most recent reply and its topic
        $reply_id = bbp_get_forum_last_reply_id($sub_id);
        $topic_id = bbp_is_reply($reply_id) ? bbp_get_reply_topic_id($reply_id) : $reply_id;
        $topic_title = bbp_get_topic_title($topic_id);
        $link = bbp_get_reply_url($reply_id);
        // Get the author avatar
        $user_id = bbp_get_reply_author_id($reply_id);
        $avatar = apoc_get_avatar(array('user_id' => $user_id, 'link' => true, 'size' => 50));
        // Toggle html class
        $class = $count % 2 ? 'odd' : 'even';
        // Print output
        ?>
		<li id="forum-<?php 
        echo $sub_id;
        ?>
" class="forum <?php 
        echo $class;
        ?>
">
			<div class="forum-content">
				<h3 class="forum-title"><a href="<?php 
        echo $permalink;
        ?>
" title="Browse <?php 
        echo $title;
        ?>
"><?php 
        echo $title;
        ?>
</a></h3>
				<p class="forum-description"><?php 
        echo $desc;
        ?>
</p>
			</div>

			<div class="forum-count">
				<?php 
        echo $topics;
        ?>
			</div>

			<div class="forum-freshness">
				<?php 
        echo $avatar;
        ?>
				<div class="freshest-meta">
					<a class="freshest-title" href="<?php 
        echo $link;
        ?>
" title="<?php 
        echo $topic_title;
        ?>
"><?php 
        echo $topic_title;
        ?>
</a>
					<span class="freshest-author">By <?php 
        bbp_author_link(array('post_id' => $reply_id, 'type' => 'name'));
        ?>
</span>
					<span class="freshest-time"><?php 
        bbp_topic_last_active_time($topic_id);
        ?>
</span>
				</div>
			</div>
		</li>
	<?php 
    }
    ?>
	</ol>
		
	<?php 
    // Retrieve from buffer
    $output = ob_get_contents();
    ob_end_clean();
    echo $output;
}
?>

<?php 

$topics	 		= bbp_get_forum_topic_count('' , true );

$reply_id		= bbp_get_forum_last_reply_id( );
$topic_id		= bbp_is_reply( $reply_id ) ? bbp_get_reply_topic_id( $reply_id ) : $reply_id;
$topic_title	= bbp_get_topic_title( $topic_id );
$link 			= bbp_get_reply_url( $reply_id );
?>

<table class="forum" id="bbp-forum-<?php bbp_forum_id(); ?>">
	<tr class="header">
		<th colspan="4"><h3><?php bbp_forum_title(); ?></h3></th>
	</tr>

	<?php	
	// Check for subforums
	$subs = bbp_forum_get_subforums( );
	if ( !empty( $subs ) ) {

		?>

		<tr>
			<th>Board</th>
			<th>Topics</th>
			<th>Posts</th>
			<th>Last Post</th>
		</tr>
示例#13
0
/**
 * [g1_bbp_forums] shortcode callback function.
 *
 * @param 			array $atts
 * @param			string $content
 * @return			string
 */
function g1_bbp_forums_shortcode($atts, $content)
{
    /* We need a static counter to trace a shortcode without the id attribute */
    static $counter = 0;
    $counter++;
    extract(shortcode_atts(array('id' => '', 'class' => ''), $atts, 'g1_bbp_forums'));
    // Compose final HTML id attribute
    $final_id = strlen($id) ? $id : 'g1-bbp-forums-' . $counter;
    // Compose final HTML class attribute
    $final_class = array('g1-bbp-forums');
    $final_class = array_merge($final_class, explode(' ', $class));
    // Note: private and hidden forums will be excluded via the
    // bbp_pre_get_posts_normalize_forum_visibility action and function.
    $query = new WP_Query(array('post_type' => bbp_get_forum_post_type(), 'post_parent' => $settings['parent_forum'], 'post_status' => bbp_get_public_status_id(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'orderby' => 'menu_order title', 'order' => 'ASC'));
    if (!$query->have_posts()) {
        return '';
    }
    // Start output buffer
    ob_start();
    ?>
    <div class="<?php 
    echo implode(' ', array_map('sanitize_html_class', $final_class));
    ?>
">
        <div class="g1-collection g1-collection--grid g1-collection--one-third g1-collection--simple">
            <ul>
                <?php 
    while ($query->have_posts()) {
        $query->the_post();
        ?>
                <li class="g1-collection__item">
                    <article>
                        <?php 
        if (has_post_thumbnail()) {
            ?>
                            <figure class="entry-featured-media">

                                <a href="<?php 
            bbp_forum_permalink($query->post->ID);
            ?>
">
                                    <?php 
            the_post_thumbnail('g1_one_third');
            ?>
                                </a>
                            </figure>
                        <?php 
        } else {
            ?>
                            <?php 
            echo do_shortcode('[placeholder icon="camera" size="g1_one_third"]');
            ?>
                        <?php 
        }
        ?>
                        <div class="g1-nonmedia">
                            <div class="g1-inner">
                                <header class="entry-header">
                                    <h3 class="entry-title">
                                        <a href="<?php 
        bbp_forum_permalink($query->post->ID);
        ?>
"><?php 
        bbp_forum_title($query->post->ID);
        ?>
</a>
                                    </h3>
                                    <p class="entry-meta g1-meta">
                                        <span><?php 
        _e('Topics', 'bbpress');
        ?>
: <?php 
        bbp_forum_topic_count($query->post->ID);
        ?>
</span>
                                        <span><?php 
        bbp_show_lead_topic() ? _e('Replies', 'bbpress') : _e('Posts', 'bbpress');
        ?>
: <?php 
        bbp_show_lead_topic() ? bbp_forum_reply_count($query->post->ID) : bbp_forum_post_count($query->post->ID);
        ?>
</span>
                                    </p>
                                </header>
                                <div class="entry-summary">
                                    <?php 
        the_excerpt();
        ?>
                                </div>
                            </div>
                        </div>
                    </article>
                </li>
                <?php 
    }
    ?>
            </ul>
        </div>
    </div>
    <?php 
    // Reset the $post global
    wp_reset_postdata();
    // Return and flush the output buffer
    return ob_get_clean();
}
示例#14
0
        /**
         * Output the forums for a group in the edit screens
         *
         * @since bbPress (r3653)
         * @uses bp_get_current_group_id()
         * @uses bbp_get_group_forum_ids()
         * @uses bbp_has_forums()
         * @uses bbp_get_template_part()
         */
        public function display_forums($offset = 0)
        {
            global $wpdb;
            $bbp = bbpress();
            // Forum data
            $forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
            $forum_args = array('post__in' => $forum_ids, 'post_parent' => null);
            ?>

		<div id="bbpress-forums">

			<?php 
            // Looking at the group forum root
            if (!bp_action_variable($offset)) {
                // Query forums and show them if
                if (!empty($forum_ids) && bbp_has_forums($forum_args)) {
                    bbp_the_forum();
                    // Only one forum found
                    if ($bbp->forum_query->post_count == 1) {
                        ?>

						<h3><?php 
                        _e('Forum', 'bbpress');
                        ?>
</h3>

						<?php 
                        bbp_set_query_name('bbp_single_forum');
                        ?>

						<?php 
                        if (bbp_has_topics(array('post_parent' => bbp_get_forum_id()))) {
                            ?>

							<?php 
                            bbp_get_template_part('pagination', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('loop', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('pagination', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        } else {
                            ?>

							<?php 
                            bbp_get_template_part('feedback', 'no-topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        }
                        // More than 1 forum found
                    } elseif ($bbp->forum_query->post_count > 1) {
                        ?>

						<h3><?php 
                        _e('Forums', 'bbpress');
                        ?>
</h3>

						<?php 
                        bbp_get_template_part('loop', 'forums');
                        ?>

						<h3><?php 
                        _e('Topics', 'bbpress');
                        ?>
</h3>

						<?php 
                        if (bbp_has_topics(array('post_parent__in' => $forum_ids))) {
                            ?>

							<?php 
                            bbp_get_template_part('pagination', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('loop', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('pagination', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        } else {
                            ?>

							<?php 
                            bbp_get_template_part('feedback', 'no-topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        }
                        // No forums found
                    } else {
                        ?>

						<div id="message" class="info">
							<p><?php 
                        _e('This group does not currently have any forums.', 'bbpress');
                        ?>
</p>
						</div>

						<?php 
                        if (bp_is_group_admin_screen($this->slug)) {
                            bbp_get_template_part('form', 'forum');
                        }
                    }
                    // No forums found
                } else {
                    ?>

					<div id="message" class="info">
						<p><?php 
                    _e('This group does not currently have any forums.', 'bbpress');
                    ?>
</p>
					</div>

					<?php 
                    if (bp_is_group_admin_screen($this->slug)) {
                        bbp_get_template_part('form', 'forum');
                    }
                }
                // Single forum
            } elseif (bp_action_variable($offset) != $this->slug && bp_action_variable($offset) != $this->topic_slug) {
                // Get the forum
                $forum_post_type = bbp_get_forum_post_type();
                $forum_slug = bp_action_variable($offset);
                $forums = $wpdb->get_row("SELECT ID FROM {$wpdb->posts} WHERE post_name = '{$forum_slug}' AND post_type = '{$forum_post_type}'", ARRAY_N);
                // Forum exists
                if (!empty($forums)) {
                    $forum_id = $forums[0];
                    $bbp->current_forum_id = $forum_id;
                    bbp_set_query_name('bbp_single_forum');
                    ?>

					<h3><?php 
                    bbp_forum_title();
                    ?>
</h3>

					<?php 
                    bbp_get_template_part('content', 'single-forum');
                    ?>

				<?php 
                } else {
                    ?>

					<?php 
                    bbp_get_template_part('feedback', 'no-topics');
                    ?>

					<?php 
                    bbp_get_template_part('form', 'topic');
                    ?>

				<?php 
                }
                // Single topic
            } elseif (bp_action_variable($offset) != $this->slug && bp_action_variable($offset) == $this->topic_slug) {
                // Get the topic
                $topic_post_type = bbp_get_topic_post_type();
                $topic_slug = bp_action_variable($offset + 1);
                $topics = $wpdb->get_row("SELECT ID FROM {$wpdb->posts} WHERE post_name = '{$topic_slug}' AND post_type = '{$topic_post_type}'", ARRAY_N);
                // Topic exists
                if (!empty($topics)) {
                    $topic_id = $topics[0];
                    $bbp->current_topic_id = $topic_id;
                    bbp_set_query_name('bbp_single_topic');
                    ?>

					<h3><?php 
                    bbp_topic_title();
                    ?>
</h3>

					<?php 
                    bbp_get_template_part('content', 'single-topic');
                    ?>

				<?php 
                } else {
                    ?>

					<?php 
                    bbp_get_template_part('feedback', 'no-topics');
                    ?>

					<?php 
                    bbp_get_template_part('form', 'topic');
                    ?>

				<?php 
                }
            }
            ?>

		</div>

		<?php 
        }
示例#15
0
<li class="bboss_search_item bboss_search_item_forum">
	<div class="item">
		<div class="item-title"><a href="<?php 
bbp_forum_permalink(get_the_ID());
?>
"><?php 
bbp_forum_title(get_the_ID());
?>
</a></div>
		<div class="item-desc"><?php 
bbp_forum_content(get_the_ID());
?>
</div>
	</div>
</li>
    /**
     * Displays the output, the forum list
     *
     * @since bbPress (r2653)
     *
     * @param mixed $args Arguments
     * @param array $instance Instance
     * @uses apply_filters() Calls 'bbp_forum_widget_title' with the title
     * @uses get_option() To get the forums per page option
     * @uses current_user_can() To check if the current user can read
     *                           private() To resety name
     * @uses bbp_has_forums() The main forum loop
     * @uses bbp_forums() To check whether there are more forums available
     *                     in the loop
     * @uses bbp_the_forum() Loads up the current forum in the loop
     * @uses bbp_forum_permalink() To display the forum permalink
     * @uses bbp_forum_title() To display the forum title
     */
    public function widget($args, $instance)
    {
        // Get widget settings
        $settings = $this->parse_settings($instance);
        // Typical WordPress filter
        $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base);
        // bbPress filter
        $settings['title'] = apply_filters('bbp_forum_widget_title', $settings['title'], $instance, $this->id_base);
        // Note: private and hidden forums will be excluded via the
        // bbp_pre_get_posts_exclude_forums filter and function.
        $query_data = array('post_type' => bbp_get_forum_post_type(), 'post_parent' => $settings['parent_forum'], 'post_status' => bbp_get_public_status_id(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order', 'order' => 'ASC');
        //Get an array of IDs which the current user has permissions to view
        $allowed_posts = tehnik_bpp_get_permitted_post_ids(new WP_Query($query_data));
        // The default forum query with allowed forum ids array added
        $query_data['post__in'] = $allowed_posts;
        $widget_query = new WP_Query($query_data);
        // Bail if no posts
        if (!$widget_query->have_posts()) {
            return;
        }
        echo $args['before_widget'];
        if (!empty($settings['title'])) {
            echo $args['before_title'] . $settings['title'] . $args['after_title'];
        }
        ?>

        <ul>

            <?php 
        while ($widget_query->have_posts()) {
            $widget_query->the_post();
            ?>

                <li><a class="bbp-forum-title" href="<?php 
            bbp_forum_permalink($widget_query->post->ID);
            ?>
" title="<?php 
            bbp_forum_title($widget_query->post->ID);
            ?>
"><?php 
            bbp_forum_title($widget_query->post->ID);
            ?>
</a></li>

            <?php 
        }
        ?>

        </ul>

        <?php 
        echo $args['after_widget'];
        // Reset the $post global
        wp_reset_postdata();
    }
示例#17
0
" <?php 
bbp_forum_class();
?>
>

	<li class="bbp-forum-info">

		<?php 
do_action('bbp_theme_before_forum_title');
?>

		<a class="bbp-forum-title" href="<?php 
bbp_forum_permalink();
?>
"><?php 
bbp_forum_title();
?>
</a>

		<?php 
do_action('bbp_theme_after_forum_title');
?>

		<?php 
do_action('bbp_theme_before_forum_description');
?>

		<div class="bbp-forum-content"><?php 
bbp_forum_content();
?>
</div>
示例#18
0
文件: group.php 项目: hscale/webento
        /**
         * Output the forums for a group in the edit screens
         *
         * @since bbPress (r3653)
         * @uses bp_get_current_group_id()
         * @uses bbp_get_group_forum_ids()
         * @uses bbp_has_forums()
         * @uses bbp_get_template_part()
         */
        public function display_forums($offset = 0)
        {
            // Allow actions immediately before group forum output
            do_action('bbp_before_group_forum_display');
            // Load up bbPress once
            $bbp = bbpress();
            // Forum data
            $forum_slug = bp_action_variable($offset);
            $forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
            $forum_args = array('post__in' => $forum_ids, 'post_parent' => null);
            // Unset global queries
            $bbp->forum_query = new stdClass();
            $bbp->topic_query = new stdClass();
            $bbp->reply_query = new stdClass();
            // Unset global ID's
            $bbp->current_forum_id = 0;
            $bbp->current_topic_id = 0;
            $bbp->current_reply_id = 0;
            $bbp->current_topic_tag_id = 0;
            // Reset the post data
            wp_reset_postdata();
            // Allow admins special views
            $post_status = array(bbp_get_closed_status_id(), bbp_get_public_status_id());
            if (is_super_admin() || current_user_can('moderate') || bp_is_item_admin() || bp_is_item_mod()) {
                $post_status = array_merge($post_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()));
            }
            ?>

		<div id="bbpress-forums">

			<?php 
            // Looking at the group forum root
            if (empty($forum_slug) || 'page' == $forum_slug) {
                // Query forums and show them if they exist
                if (!empty($forum_ids) && bbp_has_forums($forum_args)) {
                    // Only one forum found
                    if (1 == $bbp->forum_query->post_count) {
                        // Remove 'name' check for paginated requests
                        if ('page' == $forum_slug) {
                            $forum_args = array('post_type' => bbp_get_forum_post_type());
                        } else {
                            $forum_args = array('name' => $forum_slug, 'post_type' => bbp_get_forum_post_type());
                        }
                        // Get the forums
                        $forums = get_posts($forum_args);
                        bbp_the_forum();
                        // Forum exists
                        if (!empty($forums)) {
                            $forum = $forums[0];
                            // Suppress subforums for now
                            add_filter('bbp_get_forum_subforum_count', '__return_false');
                            // Set up forum data
                            bbpress()->current_forum_id = $forum->ID;
                            bbp_set_query_name('bbp_single_forum');
                            ?>

							<h3><?php 
                            bbp_forum_title();
                            ?>
</h3>

							<?php 
                            bbp_get_template_part('content', 'single-forum');
                            ?>

							<?php 
                            // Remove the subforum suppression filter
                            remove_filter('bbp_get_forum_subforum_count', '__return_false');
                            ?>

						<?php 
                        } else {
                            ?>

							<?php 
                            bbp_get_template_part('feedback', 'no-topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        }
                        // More than 1 forum found or group forum admin screen
                    } elseif (1 < $bbp->forum_query->post_count) {
                        ?>

						<h3><?php 
                        _e('Forums', 'bbpress');
                        ?>
</h3>

						<?php 
                        bbp_get_template_part('loop', 'forums');
                        ?>

						<h3><?php 
                        _e('Topics', 'bbpress');
                        ?>
</h3>

						<?php 
                        if (bbp_has_topics(array('post_parent__in' => $forum_ids))) {
                            ?>

							<?php 
                            bbp_get_template_part('pagination', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('loop', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('pagination', 'topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        } else {
                            ?>

							<?php 
                            bbp_get_template_part('feedback', 'no-topics');
                            ?>

							<?php 
                            bbp_get_template_part('form', 'topic');
                            ?>

						<?php 
                        }
                        // No forums found
                    } else {
                        ?>

						<div id="message" class="info">
							<p><?php 
                        _e('This group does not currently have any forums.', 'bbpress');
                        ?>
</p>
						</div>

					<?php 
                    }
                    // No forums found
                } else {
                    ?>

					<div id="message" class="info">
						<p><?php 
                    _e('This group does not currently have any forums.', 'bbpress');
                    ?>
</p>
					</div>

				<?php 
                }
                // Single forum
            } elseif (bp_action_variable($offset) != $this->slug && bp_action_variable($offset) != $this->topic_slug && bp_action_variable($offset) != $this->reply_slug) {
                // Get forum data
                $forum_slug = bp_action_variable($offset);
                $forum_args = array('name' => $forum_slug, 'post_type' => bbp_get_forum_post_type());
                $forums = get_posts($forum_args);
                // Forum exists
                if (!empty($forums)) {
                    $forum = $forums[0];
                    // Set up forum data
                    $forum_id = bbpress()->current_forum_id = $forum->ID;
                    // Reset necessary forum_query attributes for forums loop to function
                    $bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type();
                    $bbp->forum_query->in_the_loop = true;
                    $bbp->forum_query->post = get_post($forum_id);
                    // Forum edit
                    if (bp_action_variable($offset + 1) == $bbp->edit_id) {
                        global $wp_query, $post;
                        $wp_query->bbp_is_edit = true;
                        $wp_query->bbp_is_forum_edit = true;
                        $post = $forum;
                        bbp_set_query_name('bbp_forum_form');
                        bbp_get_template_part('form', 'forum');
                    } else {
                        bbp_set_query_name('bbp_single_forum');
                        ?>

						<h3><?php 
                        bbp_forum_title();
                        ?>
</h3>

						<?php 
                        bbp_get_template_part('content', 'single-forum');
                    }
                } else {
                    bbp_get_template_part('feedback', 'no-topics');
                    bbp_get_template_part('form', 'topic');
                }
                // Single topic
            } elseif (bp_action_variable($offset) == $this->topic_slug) {
                // Get topic data
                $topic_slug = bp_action_variable($offset + 1);
                $topic_args = array('name' => $topic_slug, 'post_type' => bbp_get_topic_post_type(), 'post_status' => $post_status);
                $topics = get_posts($topic_args);
                // Topic exists
                if (!empty($topics)) {
                    $topic = $topics[0];
                    // Set up topic data
                    $topic_id = bbpress()->current_topic_id = $topic->ID;
                    $forum_id = bbp_get_topic_forum_id($topic_id);
                    // Reset necessary forum_query attributes for topics loop to function
                    $bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type();
                    $bbp->forum_query->in_the_loop = true;
                    $bbp->forum_query->post = get_post($forum_id);
                    // Reset necessary topic_query attributes for topics loop to function
                    $bbp->topic_query->query_vars['post_type'] = bbp_get_topic_post_type();
                    $bbp->topic_query->in_the_loop = true;
                    $bbp->topic_query->post = $topic;
                    // Topic edit
                    if (bp_action_variable($offset + 2) == $bbp->edit_id) {
                        global $wp_query, $post;
                        $wp_query->bbp_is_edit = true;
                        $wp_query->bbp_is_topic_edit = true;
                        $post = $topic;
                        // Merge
                        if (!empty($_GET['action']) && 'merge' == $_GET['action']) {
                            bbp_set_query_name('bbp_topic_merge');
                            bbp_get_template_part('form', 'topic-merge');
                            // Split
                        } elseif (!empty($_GET['action']) && 'split' == $_GET['action']) {
                            bbp_set_query_name('bbp_topic_split');
                            bbp_get_template_part('form', 'topic-split');
                            // Edit
                        } else {
                            bbp_set_query_name('bbp_topic_form');
                            bbp_get_template_part('form', 'topic');
                        }
                        // Single Topic
                    } else {
                        bbp_set_query_name('bbp_single_topic');
                        ?>

						<h3><?php 
                        bbp_topic_title();
                        ?>
</h3>

						<?php 
                        bbp_get_template_part('content', 'single-topic');
                    }
                    // No Topics
                } else {
                    bbp_get_template_part('feedback', 'no-topics');
                    bbp_get_template_part('form', 'topic');
                }
                // Single reply
            } elseif (bp_action_variable($offset) == $this->reply_slug) {
                // Get reply data
                $reply_slug = bp_action_variable($offset + 1);
                $reply_args = array('name' => $reply_slug, 'post_type' => bbp_get_reply_post_type());
                $replies = get_posts($reply_args);
                if (empty($replies)) {
                    return;
                }
                // Get the first reply
                $reply = $replies[0];
                // Set up reply data
                $reply_id = bbpress()->current_reply_id = $reply->ID;
                $topic_id = bbp_get_reply_topic_id($reply_id);
                $forum_id = bbp_get_reply_forum_id($reply_id);
                // Reset necessary forum_query attributes for reply to function
                $bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type();
                $bbp->forum_query->in_the_loop = true;
                $bbp->forum_query->post = get_post($forum_id);
                // Reset necessary topic_query attributes for reply to function
                $bbp->topic_query->query_vars['post_type'] = bbp_get_topic_post_type();
                $bbp->topic_query->in_the_loop = true;
                $bbp->topic_query->post = get_post($topic_id);
                // Reset necessary reply_query attributes for reply to function
                $bbp->reply_query->query_vars['post_type'] = bbp_get_reply_post_type();
                $bbp->reply_query->in_the_loop = true;
                $bbp->reply_query->post = $reply;
                if (bp_action_variable($offset + 2) == $bbp->edit_id) {
                    global $wp_query, $post;
                    $wp_query->bbp_is_edit = true;
                    $wp_query->bbp_is_reply_edit = true;
                    $post = $reply;
                    bbp_set_query_name('bbp_reply_form');
                    bbp_get_template_part('form', 'reply');
                }
            }
            ?>

		</div>

		<?php 
            // Allow actions immediately after group forum output
            do_action('bbp_after_group_forum_display');
        }