# bbp-core/2.4.3/templates/form-topic.php

Forumax – AI Powered Advanced Community Forum Plugin, version 2.4.3. 295 lines.

- Page: https://pluginprobe.com/plugins/bbp-core/2.4.3/code/templates/form-topic.php
- Raw: https://pluginprobe.com/plugins/bbp-core/2.4.3/raw/templates/form-topic.php
- Modified: 2026-06-10T13:02:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/bbp-core/2.4.3/code/templates/form-topic.php#L10-L20`.

```php
<?php
/**
 * New/Edit Topic
 *
 * @package    bbPress
 * @subpackage Theme
 */

// Exit if accessed directly
defined( 'ABSPATH' ) || exit;

if ( ! bbp_is_single_forum() ) : ?>

    <div id="bbpress-forums" class="bbpress-wrapper">

<?php endif; ?>

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

        <?php bbp_get_template_part( 'alert', 'topic-lock' ); ?>

    <?php endif; ?>

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

        <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">

            <form id="new-post" name="new-post" method="post">

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

                <fieldset class="bbp-form">
                    <legend>

                        <?php
                        if ( bbp_is_topic_edit() ) :
                            printf( esc_html__( 'Now Editing &ldquo;%s&rdquo;', 'forumax' ), bbp_get_topic_title() );
                        else :
                            ( bbp_is_single_forum() && bbp_get_forum_title() )
                                ? printf( esc_html__( 'Create New Topic in &ldquo;%s&rdquo;', 'forumax' ), bbp_get_forum_title() )
                                : esc_html_e( 'Create New Topic', 'forumax' );
                        endif;
                        ?>

                    </legend>

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

                    <?php if ( ! bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>

                        <div class="bbp-template-notice">
                            <ul>
                                <li><?php esc_html_e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to create a topic.',
                                        'forumax' ); ?></li>
                            </ul>
                        </div>

                    <?php endif; ?>

                    <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>

                        <div class="bbp-template-notice">
                            <ul>
                                <li><?php esc_html_e( 'Your account has the ability to post unrestricted HTML content.', 'forumax' ); ?></li>
                            </ul>
                        </div>

                    <?php endif; ?>

                    <?php if ( ! bbp_is_single_forum() ) : ?>
                        <?php do_action( 'bbp_template_notices' ); ?>
                    <?php endif; ?>

                    <div class="frmx-row aq-form-wrapper">

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

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

                        <div class="form-item frmx-col-md-12">
                            <label for="bbp_topic_title"><?php printf( esc_html__( 'Topic Title (Maximum Length: %d):', 'forumax' ),
                                    bbp_get_title_max_length() ); ?></label>
                            <input type="text" id="bbp_topic_title" value="<?php bbp_form_topic_title(); ?>" size="40" name="bbp_topic_title"
                                   maxlength="<?php bbp_title_max_length(); ?>"/>
                        </div>

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

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

                        <div class="form-item frmx-col-md-12">
                            <?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
                        </div>

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

                        <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>

                            <p class="form-allowed-tags">
                                <label><?php printf( esc_html__( 'You may use these %s tags and attributes:', 'forumax' ),
                                        '<abbr title="HyperText Markup Language">HTML</abbr>' ); ?></label><br/>
                                <code><?php bbp_allowed_tags(); ?></code>
                            </p>

                        <?php endif; ?>

                        <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>

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

                            <div class="form-item frmx-col-md-12">
                                <label for="bbp_topic_tags"><?php esc_html_e( 'Topic Tags:', 'forumax' ); ?></label>
                                <input type="text" value="<?php bbp_form_topic_tags(); ?>" size="40" name="bbp_topic_tags"
                                       id="bbp_topic_tags" <?php disabled( bbp_is_topic_spam() ); ?> />
                            </div>

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

                        <?php endif; ?>

                        <?php if ( ! bbp_is_single_forum() ) : ?>

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

                            <div class="form-item frmx-col-md-4">
                                <label for="bbp_forum_id"><?php esc_html_e( 'Forum:', 'forumax' ); ?></label>
                                <?php
                                bbp_dropdown( array(
                                    'show_none' => esc_html__( '&mdash; No forum &mdash;', 'forumax' ),
                                    'selected'  => bbp_get_form_topic_forum()
                                ) );
                                ?>
                            </div>

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

                        <?php endif; ?>

                        <?php if ( current_user_can( 'moderate', bbp_get_topic_id() ) ) : ?>

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

                            <div class="form-item frmx-col-md-<?php echo bbp_is_single_forum() ? '6' : '4'; ?>">

                                <label for="bbp_stick_topic"><?php esc_html_e( 'Topic Type:', 'forumax' ); ?></label>

                                <?php bbp_form_topic_type_dropdown(); ?>

                            </div>

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

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

                            <div class="form-item frmx-col-md-<?php echo bbp_is_single_forum() ? '6' : '4'; ?>">

                                <label for="bbp_topic_status"><?php esc_html_e( 'Topic Status:', 'forumax' ); ?></label>

                                <?php bbp_form_topic_status_dropdown(); ?>

                            </div>

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

                        <?php endif; ?>

                        <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>

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

                            <fieldset class="bbp-form">
                                <legend>
                                    <input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" <?php bbp_form_topic_log_edit(); ?> />
                                    <label for="bbp_log_topic_edit"><?php esc_html_e( 'Keep a log of this edit:', 'forumax' ); ?></label><br/>
                                </legend>

                                <div>
                                    <label for="bbp_topic_edit_reason"><?php printf( esc_html__( 'Optional reason for editing:', 'forumax' ),
                                            bbp_get_current_user_name() ); ?></label><br/>
                                    <input type="text" value="<?php bbp_form_topic_edit_reason(); ?>" size="40" name="bbp_topic_edit_reason"
                                           id="bbp_topic_edit_reason"/>
                                </div>
                            </fieldset>

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

                        <?php endif; ?>

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

                        <div class="form-item frmx-col-md-12 bbp-submit-wrapper">

                            <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous()
                                       && ( ! bbp_is_topic_edit()
                                            || ( bbp_is_topic_edit()
                                                 && ! bbp_is_topic_anonymous() ) )
                            ) : ?>

                                <div class="aq-notify-check">
                                    <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>

                                    <input class="checkbox-tik" name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox"
                                           value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> />

                                    <?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>

                                        <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify the author of follow-up replies via email',
                                                'forumax' ); ?></label>

                                    <?php else : ?>

                                        <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify me of follow-up replies via email', 'forumax' ); ?></label>

                                    <?php endif; ?>

                                    <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
                                </div>

                            <?php endif; ?>

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

                            <button type="submit" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit fill-brand">
                                <?php esc_html_e( 'Submit', 'forumax' ); ?>
                            </button>

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

                        </div>

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

                    </div>

                    <?php bbp_topic_form_fields(); ?>

                </fieldset>

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

            </form>
        </div>

    <?php elseif ( bbp_is_forum_closed() ) : ?>

        <div id="forum-closed-<?php bbp_forum_id(); ?>" class="bbp-forum-closed">
            <div class="bbp-template-notice">
                <ul>
                    <li><?php printf( esc_html__( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'forumax' ), bbp_get_forum_title() ); ?></li>
                </ul>
            </div>
        </div>

    <?php else : ?>

        <div id="no-topic-<?php bbp_forum_id(); ?>" class="bbp-no-topic">
            <?php if ( is_user_logged_in() ) : ?>
                <div class="bbp-template-notice bbp-login-required-notice">
                    <span class="bbp-notice-icon" aria-hidden="true">
                        <svg viewBox="0 0 24 24" width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10Z" stroke="currentColor" stroke-width="1.8"/>
                            <path d="M12 10.5v6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
                            <path d="M12 7.75h.01" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
                        </svg>
                    </span>
                    <ul>
                        <li><?php esc_html_e( 'You cannot create new topics.', 'forumax' ); ?></li>
                    </ul>
                </div>
            <?php else : ?>
                <div class="frmx-inline-login-prompt">
                    <h3 class="frmx-inline-login-title text-center"><?php echo esc_html__( 'Start a new topic', 'forumax' ); ?></h3>
                    <p class="frmx-inline-login-subtitle text-center"><?php echo esc_html__( 'You must be logged in to create new topics.', 'forumax' ); ?></p>
                    <div class="frmx-subscription-login-form">
                        <?php
                        if ( function_exists( 'forumax_get_opt' ) && forumax_get_opt( 'topic_login_shortcode' ) ) {
                            echo do_shortcode( forumax_get_opt( 'topic_login_shortcode' ) );
                        } else {
                            bbp_get_template_part( 'form', 'user-login' );
                        }
                        ?>
                    </div>
                </div>
            <?php endif; ?>

        </div>

    <?php endif; ?>

<?php if ( ! bbp_is_single_forum() ) : ?>

    </div>

<?php endif;

```
