bbp_admin_setting_callback_group_forums_root_id()
Replies per page setting field
Description Description
Source Source
File: includes/admin/settings.php
function bbp_admin_setting_callback_group_forums_root_id() {
// Group root ID
$group_root = bbp_get_group_forums_root_id();
if ( ! bbp_get_forum( $group_root ) ) {
delete_option( '_bbp_group_forums_root_id' );
$group_root = 0;
}
// Output the dropdown for all forums
$select = bbp_get_dropdown( array(
'selected' => $group_root,
'show_none' => esc_html__( '— No parent —', 'bbpress' ),
'orderby' => 'title',
'order' => 'ASC',
'select_id' => '_bbp_group_forums_root_id',
'disable_categories' => false,
'disabled' => '_bbp_group_forums_root_id'
) );
// Check cap one time
$can_add_new = current_user_can( 'publish_forums' );
$button = '';
// Text variations based on configuration
if ( empty( $group_root ) && ( true === $can_add_new ) ) {
// New URL
$new_url = wp_nonce_url( add_query_arg( array(
'page' => 'bbpress',
'create' => 'bbp-group-forum-root'
), admin_url( 'options-general.php' ) ), '_bbp_group_forums_root_id' );
// Button & text
$button = '<a href="' . esc_url( $new_url ) . '">' . esc_html__( 'create a new one', 'bbpress' ) . '</a>';
$text = esc_html__( 'Use %s to contain your group forums, or %s', 'bbpress' );
} else {
$text = esc_html__( 'Use %s to contain your group forums', 'bbpress' );
}
// Output
printf( $text, $select, $button ); ?>
<p class="description"><?php esc_html_e( 'Changing this will not move existing forums.', 'bbpress' ); ?></p>
<?php
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |