# bbp-core/trunk/templates/form-reply.php

Forumax – AI Powered Advanced Community Forum Plugin, version trunk. 354 lines.

- Page: https://pluginprobe.com/plugins/bbp-core/trunk/code/templates/form-reply.php
- Raw: https://pluginprobe.com/plugins/bbp-core/trunk/raw/templates/form-reply.php
- Modified: 2026-08-13T11:39:12+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/trunk/code/templates/form-reply.php#L10-L20`.

```php
<?php

/**
 * New/Edit Reply
 *
 * @package bbPress
 * @subpackage Theme
 */

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

if ( bbp_is_reply_edit() ) : ?>

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

<?php endif; ?>

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

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

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

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

			<fieldset class="bbp-form">
				<legend>
					<div class="frmx-reply-title">
						<a href="<?php bbp_topic_permalink(); ?>" class="frmx-back-btn">
							<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg>
						</a>
						<span><?php printf( esc_html__( 'Reply to: %s', 'forumax' ), ( bbp_get_form_reply_to() ) ? sprintf( esc_html__( 'Reply #%1$s in %2$s', 'forumax' ), bbp_get_form_reply_to(), bbp_get_topic_title() ) : bbp_get_topic_title() ); ?></span>
					</div>
					<div class="frmx-reply-subtitle">
						<?php 
						$reply_to = bbp_get_form_reply_to();
						if ( $reply_to ) {
							$author_name = bbp_get_reply_author_display_name( $reply_to );
							printf( esc_html__( 'In response to %s &bull; Just now', 'forumax' ), $author_name );
						} else {
							$author_name = bbp_get_topic_author_display_name( bbp_get_topic_id() );
							printf( esc_html__( 'In response to %s &bull; Just now', 'forumax' ), $author_name );
						}
						?>
					</div>
				</legend>

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

				<?php if ( ! bbp_is_topic_open() && ! bbp_is_reply_edit() ) : ?>

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

				<?php endif; ?>

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

					<div class="bbp-template-notice">
						<ul>
							<li><?php esc_html_e( 'This forum is closed to new content, however your posting capabilities still allow you to post.', '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 do_action( 'bbp_template_notices' ); ?>

				<div>

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

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

					<?php bbp_the_content( array( 'context' => 'reply' ) ); ?>

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

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

						<p class="form-allowed-tags">
							<label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','forumax' ); ?></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_reply_form_tags' ); ?>

						<div class="frmx-tags-field">
							<div class="frmx-tags-icon">
								<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><circle cx="7" cy="7" r="1.5"></circle></svg>
							</div>
							<div class="frmx-tags-chips" id="frmx-tags-chips"></div>
							<input type="text" class="frmx-tags-input" id="frmx-tags-visible-input" placeholder="<?php esc_attr_e( 'Add tags…', 'forumax' ); ?>" <?php disabled( bbp_is_topic_spam() ); ?> />
							<input type="hidden" value="<?php bbp_form_topic_tags(); ?>" name="bbp_topic_tags" id="bbp_topic_tags" />
						</div>

						<script>
						document.addEventListener('DOMContentLoaded', function() {
							var chipsContainer = document.getElementById('frmx-tags-chips');
							var visibleInput   = document.getElementById('frmx-tags-visible-input');
							var hiddenInput    = document.getElementById('bbp_topic_tags');
							if (!chipsContainer || !visibleInput || !hiddenInput) return;

							var tags = hiddenInput.value
								? hiddenInput.value.split(',').map(function(t){ return t.trim(); }).filter(Boolean)
								: [];

							function render() {
								chipsContainer.innerHTML = '';
								tags.forEach(function(tag, i) {
									var chip = document.createElement('span');
									chip.className = 'frmx-tag-chip';
									chip.innerHTML = '<span class="frmx-tag-text">' + tag + '</span>' +
										'<button type="button" class="frmx-tag-remove" data-index="' + i + '">' +
										'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>' +
										'</button>';
									chipsContainer.appendChild(chip);
								});
								hiddenInput.value = tags.join(', ');
							}

							render();

							visibleInput.addEventListener('keydown', function(e) {
								if (e.key === 'Enter' || e.key === ',') {
									e.preventDefault();
									var val = visibleInput.value.trim().replace(/,$/,'').trim();
									if (val && tags.indexOf(val) === -1) {
										tags.push(val);
										render();
									}
									visibleInput.value = '';
								}
								if (e.key === 'Backspace' && !visibleInput.value && tags.length) {
									tags.pop();
									render();
								}
							});

							chipsContainer.addEventListener('click', function(e) {
								var btn = e.target.closest('.frmx-tag-remove');
								if (btn) {
									var idx = parseInt(btn.dataset.index, 10);
									tags.splice(idx, 1);
									render();
								}
							});

							visibleInput.addEventListener('blur', function() {
								var val = visibleInput.value.trim().replace(/,$/,'').trim();
								if (val && tags.indexOf(val) === -1) {
									tags.push(val);
									render();
								}
								visibleInput.value = '';
							});
						});
						</script>

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

					<?php endif; ?>



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

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

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

							<p class="form-reply-to">
								<label for="bbp_reply_to"><?php esc_html_e( 'Reply To:', 'forumax' ); ?></label><br />
								<?php bbp_reply_to_dropdown(); ?>
							</p>

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

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

							<p>
								<label for="bbp_reply_status"><?php esc_html_e( 'Reply Status:', 'forumax' ); ?></label><br />
								<?php bbp_form_reply_status_dropdown(); ?>
							</p>

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

						<?php endif; ?>

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

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

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

								<div>
									<label for="bbp_reply_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_reply_edit_reason(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" />
								</div>
							</fieldset>

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

						<?php endif; ?>

					<?php endif; ?>

					<div class="frmx-reply-bottom-grid">
						<div class="frmx-reply-attachments">
							<legend><?php esc_html_e( 'ATTACHMENTS', 'forumax' ); ?></legend>
							<?php do_action( 'frmx_reply_attachments' ); ?>
						</div>
						
						<div class="frmx-reply-options">
						<legend><?php esc_html_e( 'OPTIONS', 'forumax' ); ?></legend>
						<div class="frmx-options-inner">
							<?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_reply_edit() || ( bbp_is_reply_edit() && ! bbp_is_reply_anonymous() ) ) ) : ?>

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

								<div class="frmx-option-row">
									<div class="frmx-option-icon frmx-option-icon--notify">
										<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
									</div>
									<label for="bbp_topic_subscription" class="frmx-option-label">
										<?php if ( bbp_is_reply_edit() && ( bbp_get_reply_author_id() !== bbp_get_current_user_id() ) ) : ?>
											<span class="frmx-option-title"><?php esc_html_e( 'Email notifications', 'forumax' ); ?></span>
											<span class="frmx-option-desc"><?php esc_html_e( 'Notify the author of follow-up replies', 'forumax' ); ?></span>
										<?php else : ?>
											<span class="frmx-option-title"><?php esc_html_e( 'Notify me of replies', 'forumax' ); ?></span>
											<span class="frmx-option-desc"><?php esc_html_e( 'Get email alerts when someone responds', 'forumax' ); ?></span>
										<?php endif; ?>
									</label>
									<label class="frmx-toggle" for="bbp_topic_subscription">
										<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> />
										<span class="frmx-toggle-slider"></span>
									</label>
								</div>

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

							<?php endif; ?>

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

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

					<div class="bbp-submit-wrapper">

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

						<?php bbp_cancel_reply_to_link(); ?>
						<span class="frmx-cancel-divider"></span>

						<button type="submit" id="bbp_reply_submit" name="bbp_reply_submit" class="button submit fill-brand"><?php esc_html_e( 'Post Reply', 'forumax' ); ?> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-left:4px;"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg></button>

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

					</div>

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

				</div>

				<?php bbp_reply_form_fields(); ?>

			</fieldset>

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

		</form>
	</div>

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

	<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
		<div class="bbp-template-notice">
			<ul>
				<li><?php printf( esc_html__( 'The topic &#8216;%s&#8217; is closed to new replies.', 'forumax' ), bbp_get_topic_title() ); ?></li>
			</ul>
		</div>
	</div>

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

	<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
		<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( bbp_get_topic_forum_id() ) ); ?></li>
			</ul>
		</div>
	</div>

<?php else : ?>

	<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
		<?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 reply to this topic.', 'forumax' ); ?></li>
				</ul>
			</div>
		<?php else : ?>
			<div class="frmx-inline-login-prompt">
				<h3 class="frmx-inline-login-title"><?php echo esc_html__( 'Join the conversation', 'forumax' ); ?></h3>
				<p class="frmx-inline-login-subtitle"><?php echo esc_html__( 'You must be logged in to reply to this topic.', 'forumax' ); ?></p>
				<div class="frmx-subscription-login-form">
					<?php forumax_render_topic_login_form(); ?>
				</div>
			</div>
		<?php endif; ?>

	</div>

<?php endif; ?>

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

</div>

<?php endif;

```
