BBP_Forums_Group_Extension::topic_parent()
Output a dropdown for picking which group forum this topic is for.
Description Description
Source Source
File: includes/extend/buddypress/groups.php
public function topic_parent() {
// Get the group ID
$gid = bp_get_current_group_id();
// Get the forum IDs for this group
$forum_ids = bbp_get_group_forum_ids( $gid );
// Attempt to get the current topic forum ID
$topic_id = bbp_get_topic_id();
$forum_id = bbp_get_topic_forum_id( $topic_id );
// Setup the query arguments - note that these may be overridden later
// by various bbPress visibility and capability filters.
$args = array(
'post_type' => bbp_get_forum_post_type(),
'post_status' => bbp_get_public_status_id(),
'include' => $forum_ids,
'numberposts' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
);
// Get the forum objects for these forum IDs
$forums = get_posts( $args );
// Setup the dropdown arguments
$dd_args = array(
'posts' => $forums,
'selected' => $forum_id,
); ?>
<p>
<label for="bbp_forum_id"><?php esc_html_e( 'Forum:', 'bbpress' ); ?></label><br />
<?php bbp_dropdown( $dd_args ); ?>
</p>
<?php
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |