PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / trunk
Forumax – AI Powered Advanced Community Forum Plugin vtrunk
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 trunk, at templates/form-reply.php

354 lines 13.3 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 <?php if ( ! ( bbp_use_wp_editor() || current_user_can( 'unfiltered_html' ) ) ) : ?>
94
95 <p class="form-allowed-tags">
96 <label><?php esc_html_e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','forumax' ); ?></label><br />
97 <code><?php bbp_allowed_tags(); ?></code>
98 </p>
99
100 <?php endif; ?>
101
102 <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
103
104 <?php do_action( 'bbp_theme_before_reply_form_tags' ); ?>
105
106 <div class="frmx-tags-field">
107 <div class="frmx-tags-icon">
108 <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>
109 </div>
110 <div class="frmx-tags-chips" id="frmx-tags-chips"></div>
111 <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() ); ?> />
112 <input type="hidden" value="<?php bbp_form_topic_tags(); ?>" name="bbp_topic_tags" id="bbp_topic_tags" />
113 </div>
114
115 <script>
116 document.addEventListener('DOMContentLoaded', function() {
117 var chipsContainer = document.getElementById('frmx-tags-chips');
118 var visibleInput = document.getElementById('frmx-tags-visible-input');
119 var hiddenInput = document.getElementById('bbp_topic_tags');
120 if (!chipsContainer || !visibleInput || !hiddenInput) return;
121
122 var tags = hiddenInput.value
123 ? hiddenInput.value.split(',').map(function(t){ return t.trim(); }).filter(Boolean)
124 : [];
125
126 function render() {
127 chipsContainer.innerHTML = '';
128 tags.forEach(function(tag, i) {
129 var chip = document.createElement('span');
130 chip.className = 'frmx-tag-chip';
131 chip.innerHTML = '<span class="frmx-tag-text">' + tag + '</span>' +
132 '<button type="button" class="frmx-tag-remove" data-index="' + i + '">' +
133 '<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>' +
134 '</button>';
135 chipsContainer.appendChild(chip);
136 });
137 hiddenInput.value = tags.join(', ');
138 }
139
140 render();
141
142 visibleInput.addEventListener('keydown', function(e) {
143 if (e.key === 'Enter' || e.key === ',') {
144 e.preventDefault();
145 var val = visibleInput.value.trim().replace(/,$/,'').trim();
146 if (val && tags.indexOf(val) === -1) {
147 tags.push(val);
148 render();
149 }
150 visibleInput.value = '';
151 }
152 if (e.key === 'Backspace' && !visibleInput.value && tags.length) {
153 tags.pop();
154 render();
155 }
156 });
157
158 chipsContainer.addEventListener('click', function(e) {
159 var btn = e.target.closest('.frmx-tag-remove');
160 if (btn) {
161 var idx = parseInt(btn.dataset.index, 10);
162 tags.splice(idx, 1);
163 render();
164 }
165 });
166
167 visibleInput.addEventListener('blur', function() {
168 var val = visibleInput.value.trim().replace(/,$/,'').trim();
169 if (val && tags.indexOf(val) === -1) {
170 tags.push(val);
171 render();
172 }
173 visibleInput.value = '';
174 });
175 });
176 </script>
177
178 <?php do_action( 'bbp_theme_after_reply_form_tags' ); ?>
179
180 <?php endif; ?>
181
182
183
184 <?php if ( bbp_is_reply_edit() ) : ?>
185
186 <?php if ( current_user_can( 'moderate', bbp_get_reply_id() ) ) : ?>
187
188 <?php do_action( 'bbp_theme_before_reply_form_reply_to' ); ?>
189
190 <p class="form-reply-to">
191 <label for="bbp_reply_to"><?php esc_html_e( 'Reply To:', 'forumax' ); ?></label><br />
192 <?php bbp_reply_to_dropdown(); ?>
193 </p>
194
195 <?php do_action( 'bbp_theme_after_reply_form_reply_to' ); ?>
196
197 <?php do_action( 'bbp_theme_before_reply_form_status' ); ?>
198
199 <p>
200 <label for="bbp_reply_status"><?php esc_html_e( 'Reply Status:', 'forumax' ); ?></label><br />
201 <?php bbp_form_reply_status_dropdown(); ?>
202 </p>
203
204 <?php do_action( 'bbp_theme_after_reply_form_status' ); ?>
205
206 <?php endif; ?>
207
208 <?php if ( bbp_allow_revisions() ) : ?>
209
210 <?php do_action( 'bbp_theme_before_reply_form_revisions' ); ?>
211
212 <fieldset class="bbp-form">
213 <legend>
214 <input name="bbp_log_reply_edit" id="bbp_log_reply_edit" type="checkbox" value="1" <?php bbp_form_reply_log_edit(); ?> />
215 <label for="bbp_log_reply_edit"><?php esc_html_e( 'Keep a log of this edit:', 'forumax' ); ?></label><br />
216 </legend>
217
218 <div>
219 <label for="bbp_reply_edit_reason"><?php printf( esc_html__( 'Optional reason for editing:', 'forumax' ), bbp_get_current_user_name() ); ?></label><br />
220 <input type="text" value="<?php bbp_form_reply_edit_reason(); ?>" size="40" name="bbp_reply_edit_reason" id="bbp_reply_edit_reason" />
221 </div>
222 </fieldset>
223
224 <?php do_action( 'bbp_theme_after_reply_form_revisions' ); ?>
225
226 <?php endif; ?>
227
228 <?php endif; ?>
229
230 <div class="frmx-reply-bottom-grid">
231 <div class="frmx-reply-attachments">
232 <legend><?php esc_html_e( 'ATTACHMENTS', 'forumax' ); ?></legend>
233 <?php do_action( 'frmx_reply_attachments' ); ?>
234 </div>
235
236 <div class="frmx-reply-options">
237 <legend><?php esc_html_e( 'OPTIONS', 'forumax' ); ?></legend>
238 <div class="frmx-options-inner">
239 <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_reply_edit() || ( bbp_is_reply_edit() && ! bbp_is_reply_anonymous() ) ) ) : ?>
240
241 <?php do_action( 'bbp_theme_before_reply_form_subscription' ); ?>
242
243 <div class="frmx-option-row">
244 <div class="frmx-option-icon frmx-option-icon--notify">
245 <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>
246 </div>
247 <label for="bbp_topic_subscription" class="frmx-option-label">
248 <?php if ( bbp_is_reply_edit() && ( bbp_get_reply_author_id() !== bbp_get_current_user_id() ) ) : ?>
249 <span class="frmx-option-title"><?php esc_html_e( 'Email notifications', 'forumax' ); ?></span>
250 <span class="frmx-option-desc"><?php esc_html_e( 'Notify the author of follow-up replies', 'forumax' ); ?></span>
251 <?php else : ?>
252 <span class="frmx-option-title"><?php esc_html_e( 'Notify me of replies', 'forumax' ); ?></span>
253 <span class="frmx-option-desc"><?php esc_html_e( 'Get email alerts when someone responds', 'forumax' ); ?></span>
254 <?php endif; ?>
255 </label>
256 <label class="frmx-toggle" for="bbp_topic_subscription">
257 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> />
258 <span class="frmx-toggle-slider"></span>
259 </label>
260 </div>
261
262 <?php do_action( 'bbp_theme_after_reply_form_subscription' ); ?>
263
264 <?php endif; ?>
265
266 <?php do_action( 'frmx_reply_options' ); ?>
267 </div>
268 </div>
269 </div>
270
271 <?php do_action( 'bbp_theme_before_reply_form_submit_wrapper' ); ?>
272
273 <div class="bbp-submit-wrapper">
274
275 <?php do_action( 'bbp_theme_before_reply_form_submit_button' ); ?>
276
277 <?php bbp_cancel_reply_to_link(); ?>
278 <span class="frmx-cancel-divider"></span>
279
280 <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>
281
282 <?php do_action( 'bbp_theme_after_reply_form_submit_button' ); ?>
283
284 </div>
285
286 <?php do_action( 'bbp_theme_after_reply_form_submit_wrapper' ); ?>
287
288 </div>
289
290 <?php bbp_reply_form_fields(); ?>
291
292 </fieldset>
293
294 <?php do_action( 'bbp_theme_after_reply_form' ); ?>
295
296 </form>
297 </div>
298
299 <?php elseif ( bbp_is_topic_closed() ) : ?>
300
301 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
302 <div class="bbp-template-notice">
303 <ul>
304 <li><?php printf( esc_html__( 'The topic &#8216;%s&#8217; is closed to new replies.', 'forumax' ), bbp_get_topic_title() ); ?></li>
305 </ul>
306 </div>
307 </div>
308
309 <?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>
310
311 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
312 <div class="bbp-template-notice">
313 <ul>
314 <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>
315 </ul>
316 </div>
317 </div>
318
319 <?php else : ?>
320
321 <div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
322 <?php if ( is_user_logged_in() ) : ?>
323 <div class="bbp-template-notice bbp-login-required-notice">
324 <span class="bbp-notice-icon" aria-hidden="true">
325 <svg viewBox="0 0 24 24" width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
326 <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"/>
327 <path d="M12 10.5v6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
328 <path d="M12 7.75h.01" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/>
329 </svg>
330 </span>
331 <ul>
332 <li><?php esc_html_e( 'You cannot reply to this topic.', 'forumax' ); ?></li>
333 </ul>
334 </div>
335 <?php else : ?>
336 <div class="frmx-inline-login-prompt">
337 <h3 class="frmx-inline-login-title"><?php echo esc_html__( 'Join the conversation', 'forumax' ); ?></h3>
338 <p class="frmx-inline-login-subtitle"><?php echo esc_html__( 'You must be logged in to reply to this topic.', 'forumax' ); ?></p>
339 <div class="frmx-subscription-login-form">
340 <?php forumax_render_topic_login_form(); ?>
341 </div>
342 </div>
343 <?php endif; ?>
344
345 </div>
346
347 <?php endif; ?>
348
349 <?php if ( bbp_is_reply_edit() ) : ?>
350
351 </div>
352
353 <?php endif;
354