/
form-topic.php
219 lines (135 loc) · 7.35 KB
/
form-topic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
/**
* New/Edit Topic
*
* @package bbPress
* @subpackage Theme
*/
?>
<?php if ( !bbp_is_single_forum() ) : ?>
<?php bbp_breadcrumb(); ?>
<?php endif; ?>
<?php if ( bbp_is_topic_edit() ) : ?>
<?php bbp_topic_tag_list( bbp_get_topic_id() ); ?>
<?php bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) ); ?>
<?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" action="">
<?php do_action( 'bbp_theme_before_topic_form' ); ?>
<fieldset class="bbp-form">
<legend>
<?php
if ( bbp_is_topic_edit() )
printf( __( 'Now Editing “%s”', 'bbpress' ), bbp_get_topic_title() );
else
bbp_is_single_forum() ? printf( __( 'Create New Topic in “%s”', 'bbpress' ), bbp_get_forum_title() ) : _e( 'Create New Topic', 'bbpress' );
?>
</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">
<p><?php _e( 'This forum is marked as closed to new topics, however your posting capabilities still allow you to do so.', 'bbpress' ); ?></p>
</div>
<?php endif; ?>
<?php if ( current_user_can( 'unfiltered_html' ) ) : ?>
<div class="bbp-template-notice">
<p><?php _e( 'Your account has the ability to post unrestricted HTML content.', 'bbpress' ); ?></p>
</div>
<?php endif; ?>
<?php do_action( 'bbp_template_notices' ); ?>
<div>
<?php bbp_get_template_part( 'bbpress/form', 'anonymous' ); ?>
<?php do_action( 'bbp_theme_before_topic_form_title' ); ?>
<p>
<label for="bbp_topic_title"><?php printf( __( 'Topic Title (Maximum Length: %d):', 'bbpress' ), bbp_get_title_max_length() ); ?></label><br />
<input type="text" id="bbp_topic_title" value="<?php bbp_form_topic_title(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_title" maxlength="<?php bbp_title_max_length(); ?>" />
</p>
<?php do_action( 'bbp_theme_after_topic_form_title' ); ?>
<?php do_action( 'bbp_theme_before_topic_form_content' ); ?>
<p>
<label for="bbp_topic_content"><?php _e( 'Topic Description:', 'bbpress' ); ?></label><br />
<textarea id="bbp_topic_content" tabindex="<?php bbp_tab_index(); ?>" name="bbp_topic_content" cols="60" rows="6"><?php bbp_form_topic_content(); ?></textarea>
</p>
<?php do_action( 'bbp_theme_after_topic_form_content' ); ?>
<?php if ( !current_user_can( 'unfiltered_html' ) ) : ?>
<p class="form-allowed-tags">
<label><?php _e( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes:','bbpress' ); ?></label><br />
<code><?php bbp_allowed_tags(); ?></code>
</p>
<?php endif; ?>
<?php do_action( 'bbp_theme_before_topic_form_tags' ); ?>
<p>
<label for="bbp_topic_tags"><?php _e( 'Topic Tags:', 'bbpress' ); ?></label><br />
<input type="text" value="<?php bbp_form_topic_tags(); ?>" tabindex="<?php bbp_tab_index(); ?>" size="40" name="bbp_topic_tags" id="bbp_topic_tags" <?php disabled( bbp_is_topic_spam() ); ?> />
</p>
<?php do_action( 'bbp_theme_after_topic_form_tags' ); ?>
<?php if ( !bbp_is_single_forum() ) : ?>
<?php do_action( 'bbp_theme_before_topic_form_forum' ); ?>
<p>
<label for="bbp_forum_id"><?php _e( 'Forum:', 'bbpress' ); ?></label><br />
<?php bbp_dropdown( array( 'selected' => bbp_get_form_topic_forum() ) ); ?>
</p>
<?php do_action( 'bbp_theme_after_topic_form_forum' ); ?>
<?php endif; ?>
<?php if ( current_user_can( 'moderate' ) ) : ?>
<?php do_action( 'bbp_theme_before_topic_form_type' ); ?>
<p>
<label for="bbp_stick_topic"><?php _e( 'Topic Type:', 'bbpress' ); ?></label><br />
<?php bbp_topic_type_select(); ?>
</p>
<?php do_action( 'bbp_theme_after_topic_form_type' ); ?>
<?php endif; ?>
<?php if ( bbp_is_subscriptions_active() && !bbp_is_anonymous() && ( !bbp_is_topic_edit() || ( bbp_is_topic_edit() && !bbp_is_topic_anonymous() ) ) ) : ?>
<?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
<p>
<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> tabindex="<?php bbp_tab_index(); ?>" />
<?php if ( bbp_is_topic_edit() && ( $post->post_author != bbp_get_current_user_id() ) ) : ?>
<label for="bbp_topic_subscription"><?php _e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
<?php else : ?>
<label for="bbp_topic_subscription"><?php _e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
<?php endif; ?>
</p>
<?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
<?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><?php _e( 'Revision', 'bbpress' ); ?></legend>
<div>
<input name="bbp_log_topic_edit" id="bbp_log_topic_edit" type="checkbox" value="1" <?php bbp_form_topic_log_edit(); ?> tabindex="<?php bbp_tab_index(); ?>" />
<label for="bbp_log_topic_edit"><?php _e( 'Keep a log of this edit:', 'bbpress' ); ?></label><br />
</div>
<div>
<label for="bbp_topic_edit_reason"><?php printf( __( 'Optional reason for editing:', 'bbpress' ), bbp_get_current_user_name() ); ?></label><br />
<input type="text" value="<?php bbp_form_topic_edit_reason(); ?>" tabindex="<?php bbp_tab_index(); ?>" 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="bbp-submit-wrapper">
<?php do_action( 'bbp_theme_before_topic_form_submit_button' ); ?>
<button type="submit" tabindex="<?php bbp_tab_index(); ?>" id="bbp_topic_submit" name="bbp_topic_submit" class="button submit"><?php _e( 'Submit', 'bbpress' ); ?></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="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
<div class="bbp-template-notice">
<p><?php printf( __( 'The forum ‘%s’ is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
</div>
</div>
<?php else : ?>
<div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
<div class="bbp-template-notice">
<p><?php is_user_logged_in() ? _e( 'You cannot create new topics at this time.', 'bbpress' ) : _e( 'You must be logged in to create new topics.', 'bbpress' ); ?></p>
</div>
</div>
<?php endif; ?>