PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
bbpress / templates / default / bbpress / form-topic.php

form-topic.php in bbPress 2.6.17, at templates/default/bbpress/form-topic.php

274 lines 8.0 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 Topic
5 *
6 * @package bbPress
7 * @subpackage Theme
8 */
9
10 // Exit if accessed directly
11 defined( 'ABSPATH' ) || exit;
12
13 if ( ! bbp_is_single_forum() ) : ?>
14
15 <div id="bbpress-forums" class="bbpress-wrapper">
16
17 <?php bbp_breadcrumb(); ?>
18
19 <?php endif; ?>
20
21 <?php if ( bbp_is_topic_edit() ) : ?>
22
23 <?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
24
25 <?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
26
27 <?php bbp_get_template_part( 'alert', 'topic-lock' ); ?>
28
29 <?php endif; ?>
30
31 <?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
32
33 <div id="new-topic-<?php bbp_topic_id(); ?>" class="bbp-topic-form">
34
35 <form id="new-post" name="new-post" method="post">
36
37 <?php do_action( 'bbp_theme_before_topic_form' ); ?>
38
39 <fieldset class="bbp-form">
40 <legend>
41
42 <?php
43 if ( bbp_is_topic_edit() ) :
44 /* translators: %s: Topic title */
45 printf( esc_html__( 'Now Editing &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_topic_title() );
46 else :
47 ( bbp_is_single_forum() && bbp_get_forum_title() )
48 /* translators: %s: Forum title */
49 ? printf( esc_html__( 'Create New Topic in &ldquo;%s&rdquo;', 'bbpress' ), bbp_get_forum_title() )
50 : esc_html_e( 'Create New Topic', 'bbpress' );
51 endif;
52 ?>
53
54 </legend>
55
56 <?php do_action( 'bbp_theme_before_topic_form_notices' ); ?>
57
58 <?php if ( ! bbp_is_topic_edit() && bbp_is_forum_closed() ) : ?>
59
60 <div class="bbp-template-notice">
61 <ul>
62 <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.', 'bbpress' ); ?></li>
63 </ul>
64 </div>
65
66 <?php endif; ?>
67
68 <?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
69
70 <div class="bbp-template-notice">
71 <ul>
72 <li><?php esc_html_e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></li>
73 </ul>
74 </div>
75
76 <?php endif; ?>
77
78 <?php do_action( 'bbp_template_notices' ); ?>
79
80 <div>
81
82 <?php bbp_get_template_part( 'form', 'anonymous' ); ?>
83
84 <?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
85
86 <p>
87 <label for="bbp_topic_title"><?php printf(
88 /* translators: %d: Maximum allowed length for topic title */
89 esc_html__( 'Topic Title (Maximum Length: %d):', 'bbpress' ),
90 bbp_get_title_max_length()
91 ); ?></label><br />
92 <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(); ?>" />
93 </p>
94
95 <?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
96
97 <?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
98
99 <?php bbp_the_content( array( 'context' => 'topic' ) ); ?>
100
101 <?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
102
103 <?php bbp_get_template_part( 'form', 'allowed-tags' ); ?>
104
105 <?php if ( bbp_allow_topic_tags() && current_user_can( 'assign_topic_tags', bbp_get_topic_id() ) ) : ?>
106
107 <?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
108
109 <p>
110 <label for="bbp_topic_tags"><?php esc_html_e( 'Topic Tags:', 'bbpress' ); ?></label><br />
111 <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() ); ?> />
112 </p>
113
114 <?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
115
116 <?php endif; ?>
117
118 <?php if ( ! bbp_is_single_forum() ) : ?>
119
120 <?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
121
122 <p>
123 <label for="bbp_forum_id"><?php esc_html_e( 'Forum:', 'bbpress' ); ?></label><br />
124 <?php
125 bbp_dropdown(
126 array(
127 'show_none' => esc_html__( '&mdash; No forum &mdash;', 'bbpress' ),
128 'selected' => bbp_get_form_topic_forum()
129 )
130 );
131 ?>
132 </p>
133
134 <?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
135
136 <?php endif; ?>
137
138 <?php if ( current_user_can( 'moderate', bbp_get_topic_id() ) ) : ?>
139
140 <?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
141
142 <p>
143
144 <label for="bbp_stick_topic"><?php esc_html_e( 'Topic Type:', 'bbpress' ); ?></label><br />
145
146 <?php bbp_form_topic_type_dropdown(); ?>
147
148 </p>
149
150 <?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
151
152 <?php do_action( 'bbp_theme_before_topic_form_status' ); ?>
153
154 <p>
155
156 <label for="bbp_topic_status"><?php esc_html_e( 'Topic Status:', 'bbpress' ); ?></label><br />
157
158 <?php bbp_form_topic_status_dropdown(); ?>
159
160 </p>
161
162 <?php do_action( 'bbp_theme_after_topic_form_status' ); ?>
163
164 <?php endif; ?>
165
166 <?php if ( bbp_is_subscriptions_active() && ! bbp_is_anonymous() && ( ! bbp_is_topic_edit() || ( bbp_is_topic_edit() && ! bbp_is_topic_anonymous() ) ) ) : ?>
167
168 <?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
169
170 <p>
171 <input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> />
172
173 <?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>
174
175 <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
176
177 <?php else : ?>
178
179 <label for="bbp_topic_subscription"><?php esc_html_e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
180
181 <?php endif; ?>
182 </p>
183
184 <?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
185
186 <?php endif; ?>
187
188 <?php if ( bbp_allow_revisions() && bbp_is_topic_edit() ) : ?>
189
190 <?php do_action( 'bbp_theme_before_topic_form_revisions' ); ?>
191
192 <fieldset class="bbp-form">
193 <legend>
194 <input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" <?php bbp_form_topic_log_edit(); ?> />
195 <label for="bbp_log_topic_edit"><?php esc_html_e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
196 </legend>
197
198 <div>
199 <label for="bbp_topic_edit_reason"><?php printf( esc_html__( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
200 <input type="text" value="<?php bbp_form_topic_edit_reason(); ?>" size="40" name="bbp_topic_edit_reason" id="bbp_topic_edit_reason" />
201 </div>
202 </fieldset>
203
204 <?php do_action( 'bbp_theme_after_topic_form_revisions' ); ?>
205
206 <?php endif; ?>
207
208 <?php do_action( 'bbp_theme_before_topic_form_submit_wrapper' ); ?>
209
210 <div class="bbp-submit-wrapper">
211
212 <?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
213
214 <button type="submit" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php esc_html_e( 'Submit', 'bbpress' ); ?></button>
215
216 <?php do_action( 'bbp_theme_after_topic_form_submit_button' ); ?>
217
218 </div>
219
220 <?php do_action( 'bbp_theme_after_topic_form_submit_wrapper' ); ?>
221
222 </div>
223
224 <?php bbp_topic_form_fields(); ?>
225
226 </fieldset>
227
228 <?php do_action( 'bbp_theme_after_topic_form' ); ?>
229
230 </form>
231 </div>
232
233 <?php elseif ( bbp_is_forum_closed() ) : ?>
234
235 <div id="forum-closed-<?php bbp_forum_id(); ?>" class="bbp-forum-closed">
236 <div class="bbp-template-notice">
237 <ul>
238 <li><?php printf(
239 /* translators: %s: Forum title */
240 esc_html__( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ),
241 bbp_get_forum_title()
242 ); ?></li>
243 </ul>
244 </div>
245 </div>
246
247 <?php else : ?>
248
249 <div id="no-topic-<?php bbp_forum_id(); ?>" class="bbp-no-topic">
250 <div class="bbp-template-notice">
251 <ul>
252 <li><?php is_user_logged_in()
253 ? esc_html_e( 'You cannot create new topics.', 'bbpress' )
254 : esc_html_e( 'You must be logged in to create new topics.', 'bbpress' );
255 ?></li>
256 </ul>
257 </div>
258
259 <?php if ( ! is_user_logged_in() ) : ?>
260
261 <?php bbp_get_template_part( 'form', 'user-login' ); ?>
262
263 <?php endif; ?>
264
265 </div>
266
267 <?php endif; ?>
268
269 <?php if ( ! bbp_is_single_forum() ) : ?>
270
271 </div>
272
273 <?php endif;
274