PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.4.1
Forumax – AI Powered Advanced Community Forum Plugin v2.4.1
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / templates / form-reply.php

form-reply.php in Forumax – AI Powered Advanced Community Forum Plugin 2.4.1, at templates/form-reply.php

421 lines 15.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * New/Edit Reply
5 *
6 * @package bbPress
7 * @subpackage Theme
8 */
9
10 // Exit if accessed directly
11 defined( 'ABSPATH' ) || exit;
12
13 if ( bbp_is_reply_edit() ) : ?>
14
15 <div id="bbpress-forums" class="bbpress-wrapper">
16
17 <?php endif; ?>
18
19 <?php if ( bbp_current_user_can_access_create_reply_form() ) : ?>
20
21 <div id="new-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-form">
22
23 <form id="new-post" name="new-post" method="post">
24
25 <?php do_action( 'bbp_theme_before_reply_form' ); ?>
26
27 <fieldset class="bbp-form">
28 <legend>
29 <div class="frmx-reply-title">
30 <a href="<?php bbp_topic_permalink(); ?>" class="frmx-back-btn">
31 <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>
32 </a>
33 <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>
34 </div>
35 <div class="frmx-reply-subtitle">
36 <?php
37 $reply_to = bbp_get_form_reply_to();
38 if ( $reply_to ) {
39 $author_name = bbp_get_reply_author_display_name( $reply_to );
40 printf( esc_html__( 'In response to %s &bull; Just now', 'forumax' ), $author_name );
41 } else {
42 $author_name = bbp_get_topic_author_display_name( bbp_get_topic_id() );
43 printf( esc_html__( 'In response to %s &bull; Just now', 'forumax' ), $author_name );
44 }
45 ?>
46 </div>
47 </legend>
48
49 <?php do_action( 'bbp_theme_before_reply_form_notices' ); ?>
50
51 <?php if ( ! bbp_is_topic_open() && ! bbp_is_reply_edit() ) : ?>
52
53 <div class="bbp-template-notice">
54 <ul>
55 <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>
56 </ul>
57 </div>
58
59 <?php endif; ?>
60
61 <?php if ( ! bbp_is_reply_edit() && bbp_is_forum_closed() ) : ?>
62
63 <div class="bbp-template-notice">
64 <ul>
65 <li><?php esc_html_e( 'This forum is closed to new content, however your posting capabilities still allow you to post.', 'forumax' ); ?></li>
66 </ul>
67 </div>
68
69 <?php endif; ?>
70
71 <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
72
73 <div class="bbp-template-notice">
74 <ul>
75 <li><?php esc_html_e( 'Your account has the ability to post unrestricted HTML content.', 'forumax' ); ?></li>
76 </ul>
77 </div>
78
79 <?php endif; ?>
80
81 <?php do_action( 'bbp_template_notices' ); ?>
82
83 <div>
84
85 <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
86
87 <?php do_action( 'bbp_theme_before_reply_form_content' ); ?>
88
89 <?php bbp_the_content( array( 'context' => 'reply' ) ); ?>
90
91 <?php do_action( 'bbp_theme_after_reply_form_content' ); ?>
92
93 <script>
94 /* Style TinyMCE iframe body + toolbar to match the reference design */
95 document.addEventListener('DOMContentLoaded', function() {
96 if (typeof tinymce !== 'undefined') {
97 tinymce.on('AddEditor', function(e) {
98 e.editor.on('init', function() {
99 /* Style the iframe body */
100 var body = this.getBody();
101 if (body) {
102 body.style.backgroundColor = '#fff';
103 body.style.fontFamily = "'Inter', 'Roboto', -apple-system, sans-serif";
104 body.style.fontSize = '14px';
105 body.style.lineHeight = '1.6';
106 body.style.color = '#1a1a2e';
107 body.style.padding = '14px 18px';
108 }
109
110 /* Style the toolbar container background */
111 var container = this.getContainer();
112 if (container) {
113 /* Remove TinyMCE skin border */
114 container.style.border = 'none';
115 container.style.boxShadow = 'none';
116
117 /* Toolbar group background */
118 var toolbarGrp = container.querySelector('.mce-toolbar-grp');
119 if (toolbarGrp) {
120 toolbarGrp.style.backgroundColor = '#f6f7f9';
121 toolbarGrp.style.borderBottom = '1px solid #e5e7eb';
122 toolbarGrp.style.borderTop = 'none';
123 toolbarGrp.style.padding = '6px 10px';
124 }
125
126 /* Remove edit area border */
127 var editArea = container.querySelector('.mce-edit-area');
128 if (editArea) {
129 editArea.style.border = 'none';
130 }
131
132 /* Style individual toolbar buttons */
133 var btns = container.querySelectorAll('.mce-btn');
134 btns.forEach(function(btn) {
135 btn.style.background = 'transparent';
136 btn.style.border = 'none';
137 btn.style.boxShadow = 'none';
138 });
139
140 /* Style button groups and add dividers */
141 var groups = container.querySelectorAll('.mce-btn-group');
142 groups.forEach(function(group) {
143 group.style.border = 'none';
144 group.style.background = 'transparent';
145 group.style.boxShadow = 'none';
146 });
147 }
148 });
149 });
150 }
151 });
152 </script>
153
154 <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
155
156 <p class="form-allowed-tags">
157 <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','forumax' ); ?></label><br />
158 <code><?php bbp_allowed_tags(); ?></code>
159 </p>
160
161 <?php endif; ?>
162
163 <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
164
165 <?php do_action( 'bbp_theme_before_reply_form_tags' ); ?>
166
167 <div class="frmx-tags-field">
168 <div class="frmx-tags-icon">
169 <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>
170 </div>
171 <div class="frmx-tags-chips" id="frmx-tags-chips"></div>
172 <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() ); ?> />
173 <input type="hidden" value="<?php bbp_form_topic_tags(); ?>" name="bbp_topic_tags" id="bbp_topic_tags" />
174 </div>
175
176 <script>
177 document.addEventListener('DOMContentLoaded', function() {
178 var chipsContainer = document.getElementById('frmx-tags-chips');
179 var visibleInput = document.getElementById('frmx-tags-visible-input');
180 var hiddenInput = document.getElementById('bbp_topic_tags');
181 if (!chipsContainer || !visibleInput || !hiddenInput) return;
182
183 var tags = hiddenInput.value
184 ? hiddenInput.value.split(',').map(function(t){ return t.trim(); }).filter(Boolean)
185 : [];
186
187 function render() {
188 chipsContainer.innerHTML = '';
189 tags.forEach(function(tag, i) {
190 var chip = document.createElement('span');
191 chip.className = 'frmx-tag-chip';
192 chip.innerHTML = '<span class="frmx-tag-text">' + tag + '</span>' +
193 '<button type="button" class="frmx-tag-remove" data-index="' + i + '">' +
194 '<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>' +
195 '</button>';
196 chipsContainer.appendChild(chip);
197 });
198 hiddenInput.value = tags.join(', ');
199 }
200
201 render();
202
203 visibleInput.addEventListener('keydown', function(e) {
204 if (e.key === 'Enter' || e.key === ',') {
205 e.preventDefault();
206 var val = visibleInput.value.trim().replace(/,$/,'').trim();
207 if (val && tags.indexOf(val) === -1) {
208 tags.push(val);
209 render();
210 }
211 visibleInput.value = '';
212 }
213 if (e.key === 'Backspace' && !visibleInput.value && tags.length) {
214 tags.pop();
215 render();
216 }
217 });
218
219 chipsContainer.addEventListener('click', function(e) {
220 var btn = e.target.closest('.frmx-tag-remove');
221 if (btn) {
222 var idx = parseInt(btn.dataset.index, 10);
223 tags.splice(idx, 1);
224 render();
225 }
226 });
227
228 visibleInput.addEventListener('blur', function() {
229 var val = visibleInput.value.trim().replace(/,$/,'').trim();
230 if (val && tags.indexOf(val) === -1) {
231 tags.push(val);
232 render();
233 }
234 visibleInput.value = '';
235 });
236 });
237 </script>
238
239 <?php do_action( 'bbp_theme_after_reply_form_tags' ); ?>
240
241 <?php endif; ?>
242
243
244
245 <?php if ( bbp_is_reply_edit() ) : ?>
246
247 <?php if ( current_user_can( 'moderate', bbp_get_reply_id() ) ) : ?>
248
249 <?php do_action( 'bbp_theme_before_reply_form_reply_to' ); ?>
250
251 <p class="form-reply-to">
252 <label for="bbp_reply_to"><?php esc_html_e( 'Reply To:', 'forumax' ); ?></label><br />
253 <?php bbp_reply_to_dropdown(); ?>
254 </p>
255
256 <?php do_action( 'bbp_theme_after_reply_form_reply_to' ); ?>
257
258 <?php do_action( 'bbp_theme_before_reply_form_status' ); ?>
259
260 <p>
261 <label for="bbp_reply_status"><?php esc_html_e( 'Reply Status:', 'forumax' ); ?></label><br />
262 <?php bbp_form_reply_status_dropdown(); ?>
263 </p>
264
265 <?php do_action( 'bbp_theme_after_reply_form_status' ); ?>
266
267 <?php endif; ?>
268
269 <?php if ( bbp_allow_revisions() ) : ?>
270
271 <?php do_action( 'bbp_theme_before_reply_form_revisions' ); ?>
272
273 <fieldset class="bbp-form">
274 <legend>
275 <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> />
276 <label for="bbp_log_reply_edit"><?php esc_html_e( 'Keep a log of this edit:', 'forumax' ); ?></label><br />
277 </legend>
278
279 <div>
280 <label for="bbp_reply_edit_reason"><?php printf( esc_html__( 'Optional reason for editing:', 'forumax' ), bbp_get_current_user_name() ); ?></label><br />
281 <input type="text" value="<?php bbp_form_reply_edit_reason(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" />
282 </div>
283 </fieldset>
284
285 <?php do_action( 'bbp_theme_after_reply_form_revisions' ); ?>
286
287 <?php endif; ?>
288
289 <?php endif; ?>
290
291 <div class="frmx-reply-bottom-grid">
292 <div class="frmx-reply-attachments">
293 <legend><?php esc_html_e( 'ATTACHMENTS', 'forumax' ); ?></legend>
294 <?php do_action( 'frmx_reply_attachments' ); ?>
295 </div>
296
297 <div class="frmx-reply-options">
298 <legend><?php esc_html_e( 'OPTIONS', 'forumax' ); ?></legend>
299 <div class="frmx-options-inner">
300 <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_reply_edit() || ( bbp_is_reply_edit() && ! bbp_is_reply_anonymous() ) ) ) : ?>
301
302 <?php do_action( 'bbp_theme_before_reply_form_subscription' ); ?>
303
304 <div class="frmx-option-row">
305 <div class="frmx-option-icon frmx-option-icon--notify">
306 <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>
307 </div>
308 <label for="bbp_topic_subscription" class="frmx-option-label">
309 <?php if ( bbp_is_reply_edit() && ( bbp_get_reply_author_id() !== bbp_get_current_user_id() ) ) : ?>
310 <span class="frmx-option-title"><?php esc_html_e( 'Email notifications', 'forumax' ); ?></span>
311 <span class="frmx-option-desc"><?php esc_html_e( 'Notify the author of follow-up replies', 'forumax' ); ?></span>
312 <?php else : ?>
313 <span class="frmx-option-title"><?php esc_html_e( 'Notify me of replies', 'forumax' ); ?></span>
314 <span class="frmx-option-desc"><?php esc_html_e( 'Get email alerts when someone responds', 'forumax' ); ?></span>
315 <?php endif; ?>
316 </label>
317 <label class="frmx-toggle" for="bbp_topic_subscription">
318 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> />
319 <span class="frmx-toggle-slider"></span>
320 </label>
321 </div>
322
323 <?php do_action( 'bbp_theme_after_reply_form_subscription' ); ?>
324
325 <?php endif; ?>
326
327 <?php do_action( 'frmx_reply_options' ); ?>
328 </div>
329 </div>
330 </div>
331
332 <?php do_action( 'bbp_theme_before_reply_form_submit_wrapper' ); ?>
333
334 <div class="bbp-submit-wrapper">
335
336 <?php do_action( 'bbp_theme_before_reply_form_submit_button' ); ?>
337
338 <?php bbp_cancel_reply_to_link(); ?>
339 <span class="frmx-cancel-divider"></span>
340
341 <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>
342
343 <?php do_action( 'bbp_theme_after_reply_form_submit_button' ); ?>
344
345 </div>
346
347 <?php do_action( 'bbp_theme_after_reply_form_submit_wrapper' ); ?>
348
349 </div>
350
351 <?php bbp_reply_form_fields(); ?>
352
353 </fieldset>
354
355 <?php do_action( 'bbp_theme_after_reply_form' ); ?>
356
357 </form>
358 </div>
359
360 <?php elseif ( bbp_is_topic_closed() ) : ?>
361
362 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
363 <div class="bbp-template-notice">
364 <ul>
365 <li><?php printf( esc_html__( 'The topic &#8216;%s&#8217; is closed to new replies.', 'forumax' ), bbp_get_topic_title() ); ?></li>
366 </ul>
367 </div>
368 </div>
369
370 <?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>
371
372 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
373 <div class="bbp-template-notice">
374 <ul>
375 <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>
376 </ul>
377 </div>
378 </div>
379
380 <?php else : ?>
381
382 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
383 <?php if ( is_user_logged_in() ) : ?>
384 <div class="bbp-template-notice bbp-login-required-notice">
385 <span class="bbp-notice-icon" aria-hidden="true">
386 <svg viewBox="0 0 24 24" width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
387 <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"/>
388 <path d="M12 10.5v6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
389 <path d="M12 7.75h.01" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
390 </svg>
391 </span>
392 <ul>
393 <li><?php esc_html_e( 'You cannot reply to this topic.', 'forumax' ); ?></li>
394 </ul>
395 </div>
396 <?php else : ?>
397 <div class="frmx-inline-login-prompt">
398 <h3 class="frmx-inline-login-title"><?php echo esc_html__( 'Join the conversation', 'forumax' ); ?></h3>
399 <p class="frmx-inline-login-subtitle"><?php echo esc_html__( 'You must be logged in to reply to this topic.', 'forumax' ); ?></p>
400 <div class="frmx-subscription-login-form">
401 <?php
402 if ( function_exists( 'forumax_get_opt' ) && forumax_get_opt( 'topic_login_shortcode' ) ) {
403 echo do_shortcode( forumax_get_opt( 'topic_login_shortcode' ) );
404 } else {
405 bbp_get_template_part( 'form', 'user-login' );
406 }
407 ?>
408 </div>
409 </div>
410 <?php endif; ?>
411
412 </div>
413
414 <?php endif; ?>
415
416 <?php if ( bbp_is_reply_edit() ) : ?>
417
418 </div>
419
420 <?php endif;
421