PluginProbe
bbPress / 2.6.2
bbPress v2.6.2
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 2.2.2 All 71 releases
bbpress / includes / admin / settings.php

settings.php in bbPress 2.6.2, at includes/admin/settings.php

2,100 lines 71.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress Admin Settings
5 *
6 * @package bbPress
7 * @subpackage Administration
8 */
9
10 // Exit if accessed directly
11 defined( 'ABSPATH' ) || exit;
12
13 /** Sections ******************************************************************/
14
15 /**
16 * Get the Forums settings sections.
17 *
18 * @since 2.1.0 bbPress (r4001)
19 *
20 * @return array
21 */
22 function bbp_admin_get_settings_sections() {
23
24 // Filter & return
25 return (array) apply_filters( 'bbp_admin_get_settings_sections', array(
26
27 // Settings
28 'bbp_settings_users' => array(
29 'title' => esc_html__( 'Forum User Settings', 'bbpress' ),
30 'callback' => 'bbp_admin_setting_callback_user_section',
31 'page' => 'discussion'
32 ),
33 'bbp_settings_features' => array(
34 'title' => esc_html__( 'Forum Features', 'bbpress' ),
35 'callback' => 'bbp_admin_setting_callback_features_section',
36 'page' => 'discussion'
37 ),
38 'bbp_settings_theme_compat' => array(
39 'title' => esc_html__( 'Forum Theme Packages', 'bbpress' ),
40 'callback' => 'bbp_admin_setting_callback_subtheme_section',
41 'page' => 'general'
42 ),
43 'bbp_settings_per_page' => array(
44 'title' => esc_html__( 'Topics and Replies Per Page', 'bbpress' ),
45 'callback' => 'bbp_admin_setting_callback_per_page_section',
46 'page' => 'reading'
47 ),
48 'bbp_settings_per_rss_page' => array(
49 'title' => esc_html__( 'Topics and Replies Per RSS Page', 'bbpress' ),
50 'callback' => 'bbp_admin_setting_callback_per_rss_page_section',
51 'page' => 'reading',
52 ),
53 'bbp_settings_root_slugs' => array(
54 'title' => esc_html__( 'Forum Root Slug', 'bbpress' ),
55 'callback' => 'bbp_admin_setting_callback_root_slug_section',
56 'page' => 'permalink'
57 ),
58 'bbp_settings_single_slugs' => array(
59 'title' => esc_html__( 'Forum Single Slugs', 'bbpress' ),
60 'callback' => 'bbp_admin_setting_callback_single_slug_section',
61 'page' => 'permalink',
62 ),
63 'bbp_settings_user_slugs' => array(
64 'title' => esc_html__( 'Forum User Slugs', 'bbpress' ),
65 'callback' => 'bbp_admin_setting_callback_user_slug_section',
66 'page' => 'permalink',
67 ),
68
69 // Extend
70 'bbp_settings_buddypress' => array(
71 'title' => esc_html__( 'Forum Integration for BuddyPress', 'bbpress' ),
72 'callback' => 'bbp_admin_setting_callback_buddypress_section',
73 'page' => 'buddypress',
74 ),
75 'bbp_settings_akismet' => array(
76 'title' => esc_html__( 'Forum Integration for Akismet', 'bbpress' ),
77 'callback' => 'bbp_admin_setting_callback_akismet_section',
78 'page' => 'discussion'
79 ),
80
81 // Converter
82 'bbp_converter_connection' => array(
83 'title' => esc_html__( 'Database Settings', 'bbpress' ),
84 'callback' => 'bbp_converter_setting_callback_main_section',
85 'page' => 'converter'
86 ),
87 'bbp_converter_options' => array(
88 'title' => esc_html__( 'Options', 'bbpress' ),
89 'callback' => 'bbp_converter_setting_callback_options_section',
90 'page' => 'converter'
91 )
92 ) );
93 }
94
95 /**
96 * Get all of the settings fields.
97 *
98 * @since 2.1.0 bbPress (r4001)
99 *
100 * @return array
101 */
102 function bbp_admin_get_settings_fields() {
103
104 // Filter & return
105 return (array) apply_filters( 'bbp_admin_get_settings_fields', array(
106
107 /** User Section ******************************************************/
108
109 'bbp_settings_users' => array(
110
111 // Default role setting
112 '_bbp_default_role' => array(
113 'sanitize_callback' => 'sanitize_text_field',
114 'args' => array()
115 ),
116
117 // Allow global access
118 '_bbp_allow_global_access' => array(
119 'title' => esc_html__( 'Roles', 'bbpress' ),
120 'callback' => 'bbp_admin_setting_callback_global_access',
121 'sanitize_callback' => 'intval',
122 'args' => array()
123 ),
124
125 // Allow content throttling
126 '_bbp_allow_content_throttle' => array(
127 'sanitize_callback' => 'intval',
128 'args' => array()
129 ),
130
131 // Throttle setting
132 '_bbp_throttle_time' => array(
133 'title' => esc_html__( 'Flooding', 'bbpress' ),
134 'callback' => 'bbp_admin_setting_callback_throttle',
135 'sanitize_callback' => 'intval',
136 'args' => array()
137 ),
138
139 // Allow content editing
140 '_bbp_allow_content_edit' => array(
141 'sanitize_callback' => 'intval',
142 'args' => array()
143 ),
144
145 // Edit lock setting
146 '_bbp_edit_lock' => array(
147 'title' => esc_html__( 'Editing', 'bbpress' ),
148 'callback' => 'bbp_admin_setting_callback_editlock',
149 'sanitize_callback' => 'intval',
150 'args' => array()
151 ),
152
153 // Allow anonymous posting setting
154 '_bbp_allow_anonymous' => array(
155 'title' => esc_html__( 'Anonymous', 'bbpress' ),
156 'callback' => 'bbp_admin_setting_callback_anonymous',
157 'sanitize_callback' => 'intval',
158 'args' => array()
159 )
160 ),
161
162 /** Features Section **************************************************/
163
164 'bbp_settings_features' => array(
165
166 // Allow topic and reply revisions
167 '_bbp_allow_revisions' => array(
168 'title' => esc_html__( 'Revisions', 'bbpress' ),
169 'callback' => 'bbp_admin_setting_callback_revisions',
170 'sanitize_callback' => 'intval',
171 'args' => array()
172 ),
173
174 // Allow favorites setting
175 '_bbp_enable_favorites' => array(
176 'title' => esc_html__( 'Favorites', 'bbpress' ),
177 'callback' => 'bbp_admin_setting_callback_favorites',
178 'sanitize_callback' => 'intval',
179 'args' => array()
180 ),
181
182 // Allow subscriptions setting
183 '_bbp_enable_subscriptions' => array(
184 'title' => esc_html__( 'Subscriptions', 'bbpress' ),
185 'callback' => 'bbp_admin_setting_callback_subscriptions',
186 'sanitize_callback' => 'intval',
187 'args' => array()
188 ),
189
190 // Allow engagements setting
191 '_bbp_enable_engagements' => array(
192 'title' => esc_html__( 'Engagements', 'bbpress' ),
193 'callback' => 'bbp_admin_setting_callback_engagements',
194 'sanitize_callback' => 'intval',
195 'args' => array()
196 ),
197
198 // Allow topic tags
199 '_bbp_allow_topic_tags' => array(
200 'title' => esc_html__( 'Topic tags', 'bbpress' ),
201 'callback' => 'bbp_admin_setting_callback_topic_tags',
202 'sanitize_callback' => 'intval',
203 'args' => array()
204 ),
205
206 // Allow per-forum moderators
207 '_bbp_allow_forum_mods' => array(
208 'title' => esc_html__( 'Forum Moderators', 'bbpress' ),
209 'callback' => 'bbp_admin_setting_callback_forum_mods',
210 'sanitize_callback' => 'intval',
211 'args' => array()
212 ),
213
214 // Allow moderators to edit users
215 '_bbp_allow_super_mods' => array(
216 'title' => esc_html__( 'Super Moderators', 'bbpress' ),
217 'callback' => 'bbp_admin_setting_callback_super_mods',
218 'sanitize_callback' => 'intval',
219 'args' => array()
220 ),
221
222 // Allow topic tags
223 '_bbp_allow_search' => array(
224 'title' => esc_html__( 'Search', 'bbpress' ),
225 'callback' => 'bbp_admin_setting_callback_search',
226 'sanitize_callback' => 'intval',
227 'args' => array()
228 ),
229
230 // Allow fancy editor setting
231 '_bbp_use_wp_editor' => array(
232 'title' => esc_html__( 'Post Formatting', 'bbpress' ),
233 'callback' => 'bbp_admin_setting_callback_use_wp_editor',
234 'args' => array(),
235 'sanitize_callback' => 'intval'
236 ),
237
238 // Allow auto embedding setting
239 '_bbp_use_autoembed' => array(
240 'title' => esc_html__( 'Auto-embed links', 'bbpress' ),
241 'callback' => 'bbp_admin_setting_callback_use_autoembed',
242 'sanitize_callback' => 'intval',
243 'args' => array()
244 ),
245
246 // Set reply threading level
247 '_bbp_thread_replies_depth' => array(
248 'title' => esc_html__( 'Reply Threading', 'bbpress' ),
249 'callback' => 'bbp_admin_setting_callback_thread_replies_depth',
250 'sanitize_callback' => 'intval',
251 'args' => array()
252 ),
253
254 // Allow threaded replies
255 '_bbp_allow_threaded_replies' => array(
256 'sanitize_callback' => 'intval',
257 'args' => array()
258 )
259 ),
260
261 /** Theme Packages ****************************************************/
262
263 'bbp_settings_theme_compat' => array(
264
265 // Theme package setting
266 '_bbp_theme_package_id' => array(
267 'title' => esc_html__( 'Current Package', 'bbpress' ),
268 'callback' => 'bbp_admin_setting_callback_subtheme_id',
269 'sanitize_callback' => 'esc_sql',
270 'args' => array()
271 )
272 ),
273
274 /** Per Page Section **************************************************/
275
276 'bbp_settings_per_page' => array(
277
278 // Topics per page setting
279 '_bbp_topics_per_page' => array(
280 'title' => esc_html__( 'Topics', 'bbpress' ),
281 'callback' => 'bbp_admin_setting_callback_topics_per_page',
282 'sanitize_callback' => 'intval',
283 'args' => array( 'label_for' => '_bbp_topics_per_page' )
284 ),
285
286 // Replies per page setting
287 '_bbp_replies_per_page' => array(
288 'title' => esc_html__( 'Replies', 'bbpress' ),
289 'callback' => 'bbp_admin_setting_callback_replies_per_page',
290 'sanitize_callback' => 'intval',
291 'args' => array( 'label_for' => '_bbp_replies_per_page' )
292 )
293 ),
294
295 /** Per RSS Page Section **********************************************/
296
297 'bbp_settings_per_rss_page' => array(
298
299 // Topics per page setting
300 '_bbp_topics_per_rss_page' => array(
301 'title' => esc_html__( 'Topics', 'bbpress' ),
302 'callback' => 'bbp_admin_setting_callback_topics_per_rss_page',
303 'sanitize_callback' => 'intval',
304 'args' => array( 'label_for' => '_bbp_topics_per_rss_page' )
305 ),
306
307 // Replies per page setting
308 '_bbp_replies_per_rss_page' => array(
309 'title' => esc_html__( 'Replies', 'bbpress' ),
310 'callback' => 'bbp_admin_setting_callback_replies_per_rss_page',
311 'sanitize_callback' => 'intval',
312 'args' => array( 'label_for' => '_bbp_replies_per_rss_page' )
313 )
314 ),
315
316 /** Front Slugs *******************************************************/
317
318 'bbp_settings_root_slugs' => array(
319
320 // Root slug setting
321 '_bbp_root_slug' => array(
322 'title' => esc_html__( 'Forum Root', 'bbpress' ),
323 'callback' => 'bbp_admin_setting_callback_root_slug',
324 'sanitize_callback' => 'bbp_sanitize_slug',
325 'args' => array( 'label_for' => '_bbp_root_slug' )
326 ),
327
328 // Include root setting
329 '_bbp_include_root' => array(
330 'title' => esc_html__( 'Forum Prefix', 'bbpress' ),
331 'callback' => 'bbp_admin_setting_callback_include_root',
332 'sanitize_callback' => 'intval',
333 'args' => array()
334 ),
335
336 // What to show on Forum Root
337 '_bbp_show_on_root' => array(
338 'title' => esc_html__( 'Forum root should show', 'bbpress' ),
339 'callback' => 'bbp_admin_setting_callback_show_on_root',
340 'sanitize_callback' => 'sanitize_text_field',
341 'args' => array( 'label_for'=>'_bbp_show_on_root' )
342 ),
343 ),
344
345 /** Single Slugs ******************************************************/
346
347 'bbp_settings_single_slugs' => array(
348
349 // Forum slug setting
350 '_bbp_forum_slug' => array(
351 'title' => esc_html__( 'Forum', 'bbpress' ),
352 'callback' => 'bbp_admin_setting_callback_forum_slug',
353 'sanitize_callback' => 'bbp_sanitize_slug',
354 'args' => array( 'label_for'=>'_bbp_forum_slug' )
355 ),
356
357 // Topic slug setting
358 '_bbp_topic_slug' => array(
359 'title' => esc_html__( 'Topic', 'bbpress' ),
360 'callback' => 'bbp_admin_setting_callback_topic_slug',
361 'sanitize_callback' => 'bbp_sanitize_slug',
362 'args' => array( 'label_for'=>'_bbp_topic_slug' )
363 ),
364
365 // Topic tag slug setting
366 '_bbp_topic_tag_slug' => array(
367 'title' => esc_html__( 'Topic Tag', 'bbpress' ),
368 'callback' => 'bbp_admin_setting_callback_topic_tag_slug',
369 'sanitize_callback' => 'bbp_sanitize_slug',
370 'args' => array( 'label_for'=>'_bbp_topic_tag_slug' )
371 ),
372
373 // View slug setting
374 '_bbp_view_slug' => array(
375 'title' => esc_html__( 'Topic View', 'bbpress' ),
376 'callback' => 'bbp_admin_setting_callback_view_slug',
377 'sanitize_callback' => 'bbp_sanitize_slug',
378 'args' => array( 'label_for'=>'_bbp_view_slug' )
379 ),
380
381 // Reply slug setting
382 '_bbp_reply_slug' => array(
383 'title' => _x( 'Reply', 'noun', 'bbpress' ),
384 'callback' => 'bbp_admin_setting_callback_reply_slug',
385 'sanitize_callback' => 'bbp_sanitize_slug',
386 'args' => array( 'label_for'=>'_bbp_reply_slug' )
387 ),
388
389 // Edit slug setting
390 '_bbp_edit_slug' => array(
391 'title' => esc_html__( 'Edit', 'bbpress' ),
392 'callback' => 'bbp_admin_setting_callback_edit_slug',
393 'sanitize_callback' => 'bbp_sanitize_slug',
394 'args' => array( 'label_for'=>'_bbp_edit_slug' )
395 ),
396
397 // Search slug setting
398 '_bbp_search_slug' => array(
399 'title' => esc_html__( 'Search', 'bbpress' ),
400 'callback' => 'bbp_admin_setting_callback_search_slug',
401 'sanitize_callback' => 'bbp_sanitize_slug',
402 'args' => array( 'label_for'=>'_bbp_search_slug' )
403 )
404 ),
405
406 /** User Slugs ********************************************************/
407
408 'bbp_settings_user_slugs' => array(
409
410 // User slug setting
411 '_bbp_user_slug' => array(
412 'title' => esc_html__( 'User Base', 'bbpress' ),
413 'callback' => 'bbp_admin_setting_callback_user_slug',
414 'sanitize_callback' => 'bbp_sanitize_slug',
415 'args' => array( 'label_for'=>'_bbp_user_slug' )
416 ),
417
418 // Topics slug setting
419 '_bbp_topic_archive_slug' => array(
420 'title' => esc_html__( 'Topics Started', 'bbpress' ),
421 'callback' => 'bbp_admin_setting_callback_topic_archive_slug',
422 'sanitize_callback' => 'bbp_sanitize_slug',
423 'args' => array( 'label_for'=>'_bbp_topic_archive_slug' )
424 ),
425
426 // Replies slug setting
427 '_bbp_reply_archive_slug' => array(
428 'title' => esc_html__( 'Replies Created', 'bbpress' ),
429 'callback' => 'bbp_admin_setting_callback_reply_archive_slug',
430 'sanitize_callback' => 'bbp_sanitize_slug',
431 'args' => array( 'label_for'=>'_bbp_reply_archive_slug' )
432 ),
433
434 // Favorites slug setting
435 '_bbp_user_favs_slug' => array(
436 'title' => esc_html__( 'Favorite Topics', 'bbpress' ),
437 'callback' => 'bbp_admin_setting_callback_user_favs_slug',
438 'sanitize_callback' => 'bbp_sanitize_slug',
439 'args' => array( 'label_for'=>'_bbp_user_favs_slug' )
440 ),
441
442 // Subscriptions slug setting
443 '_bbp_user_subs_slug' => array(
444 'title' => esc_html__( 'Subscriptions', 'bbpress' ),
445 'callback' => 'bbp_admin_setting_callback_user_subs_slug',
446 'sanitize_callback' => 'bbp_sanitize_slug',
447 'args' => array( 'label_for'=>'_bbp_user_subs_slug' )
448 ),
449
450 // Engagements slug setting
451 '_bbp_user_engs_slug' => array(
452 'title' => esc_html__( 'Engagements', 'bbpress' ),
453 'callback' => 'bbp_admin_setting_callback_user_engagements_slug',
454 'sanitize_callback' => 'bbp_sanitize_slug',
455 'args' => array( 'label_for'=>'_bbp_user_engs_slug' )
456 )
457 ),
458
459 /** BuddyPress ********************************************************/
460
461 'bbp_settings_buddypress' => array(
462
463 // Are group forums enabled?
464 '_bbp_enable_group_forums' => array(
465 'title' => esc_html__( 'Group Forums', 'bbpress' ),
466 'callback' => 'bbp_admin_setting_callback_group_forums',
467 'sanitize_callback' => 'intval',
468 'args' => array()
469 ),
470
471 // Group forums parent forum ID
472 '_bbp_group_forums_root_id' => array(
473 'title' => esc_html__( 'Primary Forum', 'bbpress' ),
474 'callback' => 'bbp_admin_setting_callback_group_forums_root_id',
475 'sanitize_callback' => 'intval',
476 'args' => array( 'label_for'=>'_bbp_group_forums_root_id' )
477 )
478 ),
479
480 /** Akismet ***********************************************************/
481
482 'bbp_settings_akismet' => array(
483
484 // Should we use Akismet
485 '_bbp_enable_akismet' => array(
486 'title' => esc_html__( 'Use Akismet', 'bbpress' ),
487 'callback' => 'bbp_admin_setting_callback_akismet',
488 'sanitize_callback' => 'intval',
489 'args' => array()
490 )
491 ),
492
493 /** Converter Page ****************************************************/
494
495 // Connection
496 'bbp_converter_connection' => array(
497
498 // System Select
499 '_bbp_converter_platform' => array(
500 'title' => esc_html__( 'Select Platform', 'bbpress' ),
501 'callback' => 'bbp_converter_setting_callback_platform',
502 'sanitize_callback' => 'sanitize_text_field',
503 'args' => array( 'label_for'=> '_bbp_converter_platform' )
504 ),
505
506 // Database Server
507 '_bbp_converter_db_server' => array(
508 'title' => esc_html__( 'Database Server', 'bbpress' ),
509 'callback' => 'bbp_converter_setting_callback_dbserver',
510 'sanitize_callback' => 'sanitize_text_field',
511 'args' => array( 'label_for'=> '_bbp_converter_db_server' )
512 ),
513
514 // Database Server Port
515 '_bbp_converter_db_port' => array(
516 'title' => esc_html__( 'Database Port', 'bbpress' ),
517 'callback' => 'bbp_converter_setting_callback_dbport',
518 'sanitize_callback' => 'intval',
519 'args' => array( 'label_for'=> '_bbp_converter_db_port' )
520 ),
521
522 // Database Name
523 '_bbp_converter_db_name' => array(
524 'title' => esc_html__( 'Database Name', 'bbpress' ),
525 'callback' => 'bbp_converter_setting_callback_dbname',
526 'sanitize_callback' => 'sanitize_text_field',
527 'args' => array( 'label_for'=> '_bbp_converter_db_name' )
528 ),
529
530 // Database User
531 '_bbp_converter_db_user' => array(
532 'title' => esc_html__( 'Database User', 'bbpress' ),
533 'callback' => 'bbp_converter_setting_callback_dbuser',
534 'sanitize_callback' => 'sanitize_text_field',
535 'args' => array( 'label_for'=> '_bbp_converter_db_user' )
536 ),
537
538 // Database Password
539 '_bbp_converter_db_pass' => array(
540 'title' => esc_html__( 'Database Password', 'bbpress' ),
541 'callback' => 'bbp_converter_setting_callback_dbpass',
542 'sanitize_callback' => 'sanitize_text_field',
543 'args' => array( 'label_for'=> '_bbp_converter_db_pass' )
544 ),
545
546 // Database Prefix
547 '_bbp_converter_db_prefix' => array(
548 'title' => esc_html__( 'Table Prefix', 'bbpress' ),
549 'callback' => 'bbp_converter_setting_callback_dbprefix',
550 'sanitize_callback' => 'sanitize_text_field',
551 'args' => array( 'label_for'=> '_bbp_converter_db_prefix' )
552 )
553 ),
554
555 // Options
556 'bbp_converter_options' => array(
557
558 // Rows Limit
559 '_bbp_converter_rows' => array(
560 'title' => esc_html__( 'Rows Limit', 'bbpress' ),
561 'callback' => 'bbp_converter_setting_callback_rows',
562 'sanitize_callback' => 'intval',
563 'args' => array( 'label_for'=> '_bbp_converter_rows' )
564 ),
565
566 // Delay Time
567 '_bbp_converter_delay_time' => array(
568 'title' => esc_html__( 'Delay Time', 'bbpress' ),
569 'callback' => 'bbp_converter_setting_callback_delay_time',
570 'sanitize_callback' => 'intval',
571 'args' => array( 'label_for'=> '_bbp_converter_delay_time' )
572 ),
573
574 // Convert Users
575 '_bbp_converter_convert_users' => array(
576 'title' => esc_html__( 'Convert Users', 'bbpress' ),
577 'callback' => 'bbp_converter_setting_callback_convert_users',
578 'sanitize_callback' => 'intval',
579 'args' => array( 'label_for'=> '_bbp_converter_convert_users' )
580 ),
581
582 // Halt
583 '_bbp_converter_halt' => array(
584 'title' => esc_html__( 'Stop on Error', 'bbpress' ),
585 'callback' => 'bbp_converter_setting_callback_halt',
586 'sanitize_callback' => 'intval',
587 'args' => array( 'label_for'=> '_bbp_converter_halt' )
588 ),
589
590 // Restart
591 '_bbp_converter_restart' => array(
592 'title' => esc_html__( 'Start Over', 'bbpress' ),
593 'callback' => 'bbp_converter_setting_callback_restart',
594 'sanitize_callback' => 'intval',
595 'args' => array( 'label_for'=> '_bbp_converter_restart' )
596 ),
597
598 // Clean
599 '_bbp_converter_clean' => array(
600 'title' => esc_html__( 'Helper Data', 'bbpress' ),
601 'callback' => 'bbp_converter_setting_callback_clean',
602 'sanitize_callback' => 'intval',
603 'args' => array( 'label_for'=> '_bbp_converter_clean' )
604 )
605 )
606 ) );
607 }
608
609 /**
610 * Get settings fields by section.
611 *
612 * @since 2.1.0 bbPress (r4001)
613 *
614 * @param string $section_id ID of the section to get fields for
615 * @staticvar array $fields All of the available fields
616 * @return mixed False if section is invalid, array of fields otherwise.
617 */
618 function bbp_admin_get_settings_fields_for_section( $section_id = '' ) {
619 static $fields = array();
620
621 // Default return value
622 $retval = array();
623
624 // Bail if section is empty
625 if ( empty( $section_id ) ) {
626 return false;
627 }
628
629 // Get all of the fields (so we can snag one section of them)
630 if ( empty( $fields ) ) {
631 $fields = bbp_admin_get_settings_fields();
632 }
633
634 // Get the field by section
635 if ( isset( $fields[ $section_id ] ) ) {
636 $retval = $fields[ $section_id ];
637 }
638
639 // Filter & return
640 return (array) apply_filters( 'bbp_admin_get_settings_fields_for_section', $retval, $section_id );
641 }
642
643 /** User Section **************************************************************/
644
645 /**
646 * User settings section description for the settings page
647 *
648 * @since 2.0.0 bbPress (r2786)
649 */
650 function bbp_admin_setting_callback_user_section() {
651 ?>
652
653 <p><?php esc_html_e( 'Setting time limits and other user posting capabilities', 'bbpress' ); ?></p>
654
655 <?php
656 }
657
658
659 /**
660 * Edit lock setting field
661 *
662 * @since 2.0.0 bbPress (r2737)
663 */
664 function bbp_admin_setting_callback_editlock() {
665
666 // Start the output buffer for the second option
667 ob_start(); ?>
668
669 </label>
670 <label for="_bbp_edit_lock">
671 <input name="_bbp_edit_lock" id="_bbp_edit_lock" type="number" min="0" step="1" value="<?php bbp_form_option( '_bbp_edit_lock', '5' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_lock' ); ?> />
672
673 <?php $select = ob_get_clean(); ?>
674
675 <label for="_bbp_allow_content_edit">
676 <input name="_bbp_allow_content_edit" id="_bbp_allow_content_edit" type="checkbox" value="1" <?php checked( bbp_allow_content_edit( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_content_edit' ); ?> />
677 <?php printf( esc_html__( 'Allow users to edit their content for %s minutes after posting', 'bbpress' ), $select ); ?>
678 </label>
679 <p class="description"><?php esc_html_e( 'If checked, setting to "0 minutes" allows editing forever.', 'bbpress' ); ?></p>
680
681 <?php
682 }
683
684 /**
685 * Throttle setting field
686 *
687 * @since 2.0.0 bbPress (r2737)
688 */
689 function bbp_admin_setting_callback_throttle() {
690
691 // Start the output buffer for the second option
692 ob_start(); ?>
693
694 </label>
695 <label for="_bbp_throttle_time">
696 <input name="_bbp_throttle_time" id="_bbp_throttle_time" type="number" min="0" step="1" value="<?php bbp_form_option( '_bbp_throttle_time', '10' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_throttle_time' ); ?> />
697
698 <?php $select = ob_get_clean(); ?>
699
700 <label for="_bbp_allow_content_throttle">
701 <input name="_bbp_allow_content_throttle" id="_bbp_allow_content_throttle" type="checkbox" value="1" <?php checked( bbp_allow_content_throttle( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_content_throttle' ); ?> />
702 <?php printf( esc_html__( 'Allow flood protection by throttling users for %s seconds after posting', 'bbpress' ), $select ); ?>
703 </label>
704 <p class="description"><?php esc_html_e( 'Use this to discourage users from spamming your forums.', 'bbpress' ); ?></p>
705
706 <?php
707 }
708
709 /**
710 * Allow anonymous posting setting field
711 *
712 * @since 2.0.0 bbPress (r2737)
713 */
714 function bbp_admin_setting_callback_anonymous() {
715 ?>
716
717 <input name="_bbp_allow_anonymous" id="_bbp_allow_anonymous" type="checkbox" value="1" <?php checked( bbp_allow_anonymous( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_anonymous' ); ?> />
718 <label for="_bbp_allow_anonymous"><?php esc_html_e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label>
719 <p class="description"><?php esc_html_e( 'Works best on intranets or paired with antispam measures like Akismet.', 'bbpress' ); ?></p>
720
721 <?php
722 }
723
724 /**
725 * Allow global access setting field
726 *
727 * @since 2.0.0 bbPress (r3378)
728 */
729 function bbp_admin_setting_callback_global_access() {
730
731 // Get the default role once rather than loop repeatedly below
732 $default_role = bbp_get_default_role();
733 $roles = bbp_get_dynamic_roles();
734
735 // Start the output buffer for the select dropdown
736 ob_start(); ?>
737
738 </label>
739 <label for="_bbp_default_role">
740 <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>>
741 <?php foreach ( $roles as $role => $details ) : ?>
742
743 <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo bbp_translate_user_role( $details['name'] ); ?></option>
744
745 <?php endforeach; ?>
746 </select>
747
748 <?php $select = ob_get_clean(); ?>
749
750 <label for="_bbp_allow_global_access">
751 <input name="_bbp_allow_global_access" id="_bbp_allow_global_access" type="checkbox" value="1" <?php checked( bbp_allow_global_access( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> />
752 <?php printf( esc_html__( 'Automatically give registered visitors the %s forum role', 'bbpress' ), $select ); ?>
753 </label>
754 <p class="description"><?php esc_html_e( 'Uncheck this to manually assign all user access to your forums.', 'bbpress' ); ?></p>
755
756 <?php
757 }
758
759 /** Features Section **********************************************************/
760
761 /**
762 * Features settings section description for the settings page
763 *
764 * @since 2.0.0 bbPress (r2786)
765 */
766 function bbp_admin_setting_callback_features_section() {
767 ?>
768
769 <p><?php esc_html_e( 'Forum features that can be toggled on and off', 'bbpress' ); ?></p>
770
771 <?php
772 }
773
774 /**
775 * Allow favorites setting field
776 *
777 * @since 2.0.0 bbPress (r2786)
778 */
779 function bbp_admin_setting_callback_favorites() {
780 ?>
781
782 <input name="_bbp_enable_favorites" id="_bbp_enable_favorites" type="checkbox" value="1" <?php checked( bbp_is_favorites_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_favorites' ); ?> />
783 <label for="_bbp_enable_favorites"><?php esc_html_e( 'Allow users to mark topics as favorites', 'bbpress' ); ?></label>
784
785 <?php
786 }
787
788 /**
789 * Allow subscriptions setting field
790 *
791 * @since 2.0.0 bbPress (r2737)
792 */
793 function bbp_admin_setting_callback_subscriptions() {
794 ?>
795
796 <input name="_bbp_enable_subscriptions" id="_bbp_enable_subscriptions" type="checkbox" value="1" <?php checked( bbp_is_subscriptions_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_subscriptions' ); ?> />
797 <label for="_bbp_enable_subscriptions"><?php esc_html_e( 'Allow users to subscribe to forums and topics', 'bbpress' ); ?></label>
798
799 <?php
800 }
801
802 /**
803 * Allow engagements setting field
804 *
805 * @since 2.0.0 bbPress (r2737)
806 */
807 function bbp_admin_setting_callback_engagements() {
808 ?>
809
810 <input name="_bbp_enable_engagements" id="_bbp_enable_engagements" type="checkbox" value="1" <?php checked( bbp_is_engagements_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_engagements' ); ?> />
811 <label for="_bbp_enable_engagements"><?php esc_html_e( 'Allow tracking of topics each user engages in', 'bbpress' ); ?></label>
812
813 <?php
814 }
815
816 /**
817 * Allow topic tags setting field
818 *
819 * @since 2.4.0 bbPress (r4944)
820 */
821 function bbp_admin_setting_callback_topic_tags() {
822 ?>
823
824 <input name="_bbp_allow_topic_tags" id="_bbp_allow_topic_tags" type="checkbox" value="1" <?php checked( bbp_allow_topic_tags( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_topic_tags' ); ?> />
825 <label for="_bbp_allow_topic_tags"><?php esc_html_e( 'Allow topics to have tags', 'bbpress' ); ?></label>
826
827 <?php
828 }
829
830 /**
831 * Allow forum-mods setting field
832 *
833 * @since 2.6.0 bbPress (r5834)
834 */
835 function bbp_admin_setting_callback_forum_mods() {
836 ?>
837
838 <input name="_bbp_allow_forum_mods" id="_bbp_allow_forum_mods" type="checkbox" value="1" <?php checked( bbp_allow_forum_mods( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_forum_mods' ); ?> />
839 <label for="_bbp_allow_forum_mods"><?php esc_html_e( 'Allow forums to have dedicated moderators', 'bbpress' ); ?></label>
840
841 <?php
842 }
843
844 /**
845 * Allow super-mods setting field
846 *
847 * @since 2.6.0 bbPress (r6562)
848 */
849 function bbp_admin_setting_callback_super_mods() {
850 ?>
851
852 <input name="_bbp_allow_super_mods" id="_bbp_allow_super_mods" type="checkbox" value="1" <?php checked( bbp_allow_super_mods( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_super_mods' ); ?> />
853 <label for="_bbp_allow_super_mods"><?php esc_html_e( 'Allow moderators to edit other users', 'bbpress' ); ?></label>
854
855 <?php
856 }
857
858 /**
859 * Allow forum wide search
860 *
861 * @since 2.4.0 bbPress (r4970)
862 */
863 function bbp_admin_setting_callback_search() {
864 ?>
865
866 <input name="_bbp_allow_search" id="_bbp_allow_search" type="checkbox" value="1" <?php checked( bbp_allow_search( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_search' ); ?> />
867 <label for="_bbp_allow_search"><?php esc_html_e( 'Allow forum wide search', 'bbpress' ); ?></label>
868
869 <?php
870 }
871
872 /**
873 * Hierarchical reply maximum depth level setting field
874 *
875 * Replies will be threaded if depth is 2 or greater
876 *
877 * @since 2.4.0 bbPress (r4944)
878 */
879 function bbp_admin_setting_callback_thread_replies_depth() {
880
881 // Set maximum depth for dropdown
882 $max_depth = (int) apply_filters( 'bbp_thread_replies_depth_max', 10 );
883 $current_depth = bbp_thread_replies_depth();
884
885 // Start an output buffer for the select dropdown
886 ob_start(); ?>
887
888 </label>
889 <label for="_bbp_thread_replies_depth">
890 <select name="_bbp_thread_replies_depth" id="_bbp_thread_replies_depth" <?php bbp_maybe_admin_setting_disabled( '_bbp_thread_replies_depth' ); ?>>
891 <?php for ( $i = 2; $i <= $max_depth; $i++ ) : ?>
892
893 <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $current_depth ); ?>><?php echo esc_html( $i ); ?></option>
894
895 <?php endfor; ?>
896 </select>
897
898 <?php $select = ob_get_clean(); ?>
899
900 <label for="_bbp_allow_threaded_replies">
901 <input name="_bbp_allow_threaded_replies" id="_bbp_allow_threaded_replies" type="checkbox" value="1" <?php checked( '1', bbp_allow_threaded_replies( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_threaded_replies' ); ?> />
902 <?php printf( esc_html__( 'Enable threaded (nested) replies %s levels deep', 'bbpress' ), $select ); ?>
903 </label>
904
905 <?php
906 }
907
908 /**
909 * Allow topic and reply revisions
910 *
911 * @since 2.0.0 bbPress (r3412)
912 */
913 function bbp_admin_setting_callback_revisions() {
914 ?>
915
916 <input name="_bbp_allow_revisions" id="_bbp_allow_revisions" type="checkbox" value="1" <?php checked( bbp_allow_revisions( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_revisions' ); ?> />
917 <label for="_bbp_allow_revisions"><?php esc_html_e( 'Allow topic and reply revision logging', 'bbpress' ); ?></label>
918
919 <?php
920 }
921
922 /**
923 * Use the WordPress editor setting field
924 *
925 * @since 2.1.0 bbPress (r3586)
926 */
927 function bbp_admin_setting_callback_use_wp_editor() {
928 ?>
929
930 <input name="_bbp_use_wp_editor" id="_bbp_use_wp_editor" type="checkbox" value="1" <?php checked( bbp_use_wp_editor( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_wp_editor' ); ?> />
931 <label for="_bbp_use_wp_editor"><?php esc_html_e( 'Add toolbar & buttons to textareas to help with HTML formatting', 'bbpress' ); ?></label>
932
933 <?php
934 }
935
936 /**
937 * Main subtheme section
938 *
939 * @since 2.0.0 bbPress (r2786)
940 */
941 function bbp_admin_setting_callback_subtheme_section() {
942 ?>
943
944 <p><?php esc_html_e( 'How your forum content is displayed within your existing theme.', 'bbpress' ); ?></p>
945
946 <?php
947 }
948
949 /**
950 * Use the WordPress editor setting field
951 *
952 * @since 2.1.0 bbPress (r3586)
953 */
954 function bbp_admin_setting_callback_subtheme_id() {
955
956 // Declare locale variable
957 $theme_options = '';
958 $current_package = bbp_get_theme_package_id( 'default' );
959
960 // Note: This should never be empty. /templates/ is the
961 // canonical backup if no other packages exist. If there's an error here,
962 // something else is wrong.
963 //
964 // @see bbPress::register_theme_packages()
965 foreach ( (array) bbpress()->theme_compat->packages as $id => $theme ) {
966 $theme_options .= '<option value="' . esc_attr( $id ) . '"' . selected( $theme->id, $current_package, false ) . '>' . esc_html( $theme->name ) . '</option>';
967 }
968
969 if ( ! empty( $theme_options ) ) : ?>
970
971 <select name="_bbp_theme_package_id" id="_bbp_theme_package_id" <?php bbp_maybe_admin_setting_disabled( '_bbp_theme_package_id' ); ?>><?php echo $theme_options ?></select>
972 <label for="_bbp_theme_package_id"><?php esc_html_e( 'will serve all bbPress templates', 'bbpress' ); ?></label>
973
974 <?php else : ?>
975
976 <p><?php esc_html_e( 'No template packages available.', 'bbpress' ); ?></p>
977
978 <?php endif;
979 }
980
981 /**
982 * Allow oEmbed in replies
983 *
984 * @since 2.1.0 bbPress (r3752)
985 */
986 function bbp_admin_setting_callback_use_autoembed() {
987 ?>
988
989 <input name="_bbp_use_autoembed" id="_bbp_use_autoembed" type="checkbox" value="1" <?php checked( bbp_use_autoembed( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_autoembed' ); ?> />
990 <label for="_bbp_use_autoembed"><?php esc_html_e( 'Embed media (YouTube, Twitter, Flickr, etc...) directly into topics and replies', 'bbpress' ); ?></label>
991
992 <?php
993 }
994
995 /** Per Page Section **********************************************************/
996
997 /**
998 * Per page settings section description for the settings page
999 *
1000 * @since 2.0.0 bbPress (r2786)
1001 */
1002 function bbp_admin_setting_callback_per_page_section() {
1003 ?>
1004
1005 <p><?php esc_html_e( 'How many topics and replies to show per page', 'bbpress' ); ?></p>
1006
1007 <?php
1008 }
1009
1010 /**
1011 * Topics per page setting field
1012 *
1013 * @since 2.0.0 bbPress (r2786)
1014 */
1015 function bbp_admin_setting_callback_topics_per_page() {
1016 ?>
1017
1018 <input name="_bbp_topics_per_page" id="_bbp_topics_per_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_topics_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_page' ); ?> />
1019 <?php esc_html_e( 'per page', 'bbpress' ); ?>
1020
1021 <?php
1022 }
1023
1024 /**
1025 * Replies per page setting field
1026 *
1027 * @since 2.0.0 bbPress (r2786)
1028 */
1029 function bbp_admin_setting_callback_replies_per_page() {
1030 ?>
1031
1032 <input name="_bbp_replies_per_page" id="_bbp_replies_per_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_replies_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_page' ); ?> />
1033 <?php esc_html_e( 'per page', 'bbpress' ); ?>
1034
1035 <?php
1036 }
1037
1038 /** Per RSS Page Section ******************************************************/
1039
1040 /**
1041 * Per page settings section description for the settings page
1042 *
1043 * @since 2.0.0 bbPress (r2786)
1044 */
1045 function bbp_admin_setting_callback_per_rss_page_section() {
1046 ?>
1047
1048 <p><?php esc_html_e( 'How many topics and replies to show per RSS page', 'bbpress' ); ?></p>
1049
1050 <?php
1051 }
1052
1053 /**
1054 * Topics per RSS page setting field
1055 *
1056 * @since 2.0.0 bbPress (r2786)
1057 */
1058 function bbp_admin_setting_callback_topics_per_rss_page() {
1059 ?>
1060
1061 <input name="_bbp_topics_per_rss_page" id="_bbp_topics_per_rss_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_topics_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_rss_page' ); ?> />
1062 <?php esc_html_e( 'per page', 'bbpress' ); ?>
1063
1064 <?php
1065 }
1066
1067 /**
1068 * Replies per RSS page setting field
1069 *
1070 * @since 2.0.0 bbPress (r2786)
1071 */
1072 function bbp_admin_setting_callback_replies_per_rss_page() {
1073 ?>
1074
1075 <input name="_bbp_replies_per_rss_page" id="_bbp_replies_per_rss_page" type="number" min="1" step="1" value="<?php bbp_form_option( '_bbp_replies_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_rss_page' ); ?> />
1076 <?php esc_html_e( 'per page', 'bbpress' ); ?>
1077
1078 <?php
1079 }
1080
1081 /** Slug Section **************************************************************/
1082
1083 /**
1084 * Slugs settings section description for the settings page
1085 *
1086 * @since 2.0.0 bbPress (r2786)
1087 */
1088 function bbp_admin_setting_callback_root_slug_section() {
1089
1090 // Flush rewrite rules when this section is saved
1091 if ( isset( $_GET['settings-updated'] ) && isset( $_GET['page'] ) ) {
1092 flush_rewrite_rules();
1093 } ?>
1094
1095 <p><?php esc_html_e( 'Customize your Forums root. Partner with a WordPress Page and use Shortcodes for more flexibility.', 'bbpress' ); ?></p>
1096
1097 <?php
1098 }
1099
1100 /**
1101 * Root slug setting field
1102 *
1103 * @since 2.0.0 bbPress (r2786)
1104 */
1105 function bbp_admin_setting_callback_root_slug() {
1106 ?>
1107
1108 <input name="_bbp_root_slug" id="_bbp_root_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_root_slug', 'forums', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_root_slug' ); ?> />
1109
1110 <?php
1111 // Slug Check
1112 bbp_form_slug_conflict_check( '_bbp_root_slug', 'forums' );
1113 }
1114
1115 /**
1116 * Include root slug setting field
1117 *
1118 * @since 2.0.0 bbPress (r2786)
1119 */
1120 function bbp_admin_setting_callback_include_root() {
1121 ?>
1122
1123 <input name="_bbp_include_root" id="_bbp_include_root" type="checkbox" value="1" <?php checked( bbp_include_root_slug() ); bbp_maybe_admin_setting_disabled( '_bbp_include_root' ); ?> />
1124 <label for="_bbp_include_root"><?php esc_html_e( 'Prefix all forum content with the Forum Root slug (Recommended)', 'bbpress' ); ?></label>
1125
1126 <?php
1127 }
1128
1129 /**
1130 * Include root slug setting field
1131 *
1132 * @since 2.0.0 bbPress (r2786)
1133 */
1134 function bbp_admin_setting_callback_show_on_root() {
1135
1136 // Current setting
1137 $show_on_root = bbp_show_on_root();
1138
1139 // Options for forum root output
1140 $root_options = array(
1141 'forums' => array(
1142 'name' => esc_attr__( 'Forum Index', 'bbpress' )
1143 ),
1144 'topics' => array(
1145 'name' => esc_attr__( 'Topics by Last Post', 'bbpress' )
1146 )
1147 ); ?>
1148
1149 <select name="_bbp_show_on_root" id="_bbp_show_on_root" <?php bbp_maybe_admin_setting_disabled( '_bbp_show_on_root' ); ?>>
1150
1151 <?php foreach ( $root_options as $option_id => $details ) : ?>
1152
1153 <option <?php selected( $show_on_root, $option_id ); ?> value="<?php echo esc_attr( $option_id ); ?>"><?php echo esc_html( $details['name'] ); ?></option>
1154
1155 <?php endforeach; ?>
1156
1157 </select>
1158
1159 <?php
1160
1161 // Look for theme support
1162 $forum_archive = basename( bbp_get_forum_archive_template() );
1163
1164 // This setting doesn't work if the theme has an archive-forum.php template.
1165 if ( ! empty( $forum_archive ) ) : ?>
1166
1167 <p class="description"><?php printf( esc_html__( 'This setting will be ignored because %s was found in your theme.', 'bbpress' ), '<code>' . $forum_archive . '</code>' ); ?></p>
1168
1169 <?php endif;
1170 }
1171
1172 /** User Slug Section *********************************************************/
1173
1174 /**
1175 * Slugs settings section description for the settings page
1176 *
1177 * @since 2.0.0 bbPress (r2786)
1178 */
1179 function bbp_admin_setting_callback_user_slug_section() {
1180 ?>
1181
1182 <p><?php esc_html_e( 'Customize your user profile slugs.', 'bbpress' ); ?></p>
1183
1184 <?php
1185 }
1186
1187 /**
1188 * User slug setting field
1189 *
1190 * @since 2.0.0 bbPress (r2786)
1191 */
1192 function bbp_admin_setting_callback_user_slug() {
1193 ?>
1194
1195 <input name="_bbp_user_slug" id="_bbp_user_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_slug', 'users', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_slug' ); ?> />
1196
1197 <?php
1198 // Slug Check
1199 bbp_form_slug_conflict_check( '_bbp_user_slug', 'users' );
1200 }
1201
1202 /**
1203 * Topic archive slug setting field
1204 *
1205 * @since 2.0.0 bbPress (r2786)
1206 */
1207 function bbp_admin_setting_callback_topic_archive_slug() {
1208 ?>
1209
1210 <input name="_bbp_topic_archive_slug" id="_bbp_topic_archive_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_archive_slug', 'topics', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_archive_slug' ); ?> />
1211
1212 <?php
1213 // Slug Check
1214 bbp_form_slug_conflict_check( '_bbp_topic_archive_slug', 'topics' );
1215 }
1216
1217 /**
1218 * Reply archive slug setting field
1219 *
1220 * @since 2.4.0 bbPress (r4932)
1221 */
1222 function bbp_admin_setting_callback_reply_archive_slug() {
1223 ?>
1224
1225 <input name="_bbp_reply_archive_slug" id="_bbp_reply_archive_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_reply_archive_slug', 'replies', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_reply_archive_slug' ); ?> />
1226
1227 <?php
1228 // Slug Check
1229 bbp_form_slug_conflict_check( '_bbp_reply_archive_slug', 'replies' );
1230 }
1231
1232 /**
1233 * Favorites slug setting field
1234 *
1235 * @since 2.4.0 bbPress (r4932)
1236 */
1237 function bbp_admin_setting_callback_user_favs_slug() {
1238 ?>
1239
1240 <input name="_bbp_user_favs_slug" id="_bbp_user_favs_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_favs_slug', 'favorites', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_favs_slug' ); ?> />
1241
1242 <?php
1243 // Slug Check
1244 bbp_form_slug_conflict_check( '_bbp_user_favs_slug', 'favorites' );
1245 }
1246
1247 /**
1248 * Subscriptions slug setting field
1249 *
1250 * @since 2.4.0 bbPress (r4932)
1251 */
1252 function bbp_admin_setting_callback_user_subs_slug() {
1253 ?>
1254
1255 <input name="_bbp_user_subs_slug" id="_bbp_user_subs_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_subs_slug', 'subscriptions', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_subs_slug' ); ?> />
1256
1257 <?php
1258 // Slug Check
1259 bbp_form_slug_conflict_check( '_bbp_user_subs_slug', 'subscriptions' );
1260 }
1261
1262 /**
1263 * Engagements slug setting field
1264 *
1265 * @since 2.6.0 bbPress (r6320)
1266 */
1267 function bbp_admin_setting_callback_user_engagements_slug() {
1268 ?>
1269
1270 <input name="_bbp_user_engs_slug" id="_bbp_user_engs_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_engs_slug', 'engagements', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_engs_slug' ); ?> />
1271
1272 <?php
1273 // Slug Check
1274 bbp_form_slug_conflict_check( '_bbp_user_engs_slug', 'engagements' );
1275 }
1276
1277 /** Single Slugs **************************************************************/
1278
1279 /**
1280 * Slugs settings section description for the settings page
1281 *
1282 * @since 2.0.0 bbPress (r2786)
1283 */
1284 function bbp_admin_setting_callback_single_slug_section() {
1285 ?>
1286
1287 <p><?php printf( esc_html__( 'Custom slugs for single forums, topics, replies, tags, views, edit, and search.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p>
1288
1289 <?php
1290 }
1291
1292 /**
1293 * Forum slug setting field
1294 *
1295 * @since 2.0.0 bbPress (r2786)
1296 */
1297 function bbp_admin_setting_callback_forum_slug() {
1298 ?>
1299
1300 <input name="_bbp_forum_slug" id="_bbp_forum_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_forum_slug', 'forum', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_forum_slug' ); ?> />
1301
1302 <?php
1303 // Slug Check
1304 bbp_form_slug_conflict_check( '_bbp_forum_slug', 'forum' );
1305 }
1306
1307 /**
1308 * Topic slug setting field
1309 *
1310 * @since 2.0.0 bbPress (r2786)
1311 */
1312 function bbp_admin_setting_callback_topic_slug() {
1313 ?>
1314
1315 <input name="_bbp_topic_slug" id="_bbp_topic_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_slug', 'topic', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_slug' ); ?> />
1316
1317 <?php
1318 // Slug Check
1319 bbp_form_slug_conflict_check( '_bbp_topic_slug', 'topic' );
1320 }
1321
1322 /**
1323 * Reply slug setting field
1324 *
1325 * @since 2.0.0 bbPress (r2786)
1326 */
1327 function bbp_admin_setting_callback_reply_slug() {
1328 ?>
1329
1330 <input name="_bbp_reply_slug" id="_bbp_reply_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_reply_slug', 'reply', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_reply_slug' ); ?> />
1331
1332 <?php
1333 // Slug Check
1334 bbp_form_slug_conflict_check( '_bbp_reply_slug', 'reply' );
1335 }
1336
1337 /**
1338 * Topic tag slug setting field
1339 *
1340 * @since 2.0.0 bbPress (r2786)
1341 */
1342 function bbp_admin_setting_callback_topic_tag_slug() {
1343 ?>
1344
1345 <input name="_bbp_topic_tag_slug" id="_bbp_topic_tag_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_tag_slug', 'topic-tag', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_tag_slug' ); ?> />
1346
1347 <?php
1348
1349 // Slug Check
1350 bbp_form_slug_conflict_check( '_bbp_topic_tag_slug', 'topic-tag' );
1351 }
1352
1353 /**
1354 * View slug setting field
1355 *
1356 * @since 2.0.0 bbPress (r2789)
1357 */
1358 function bbp_admin_setting_callback_view_slug() {
1359 ?>
1360
1361 <input name="_bbp_view_slug" id="_bbp_view_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_view_slug', 'view', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_view_slug' ); ?> />
1362
1363 <?php
1364 // Slug Check
1365 bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' );
1366 }
1367
1368 /**
1369 * Search slug setting field
1370 *
1371 * @since 2.3.0 bbPress (r4579)
1372 */
1373 function bbp_admin_setting_callback_search_slug() {
1374 ?>
1375
1376 <input name="_bbp_search_slug" id="_bbp_search_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_search_slug', 'search', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_search_slug' ); ?> />
1377
1378 <?php
1379 // Slug Check
1380 bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' );
1381 }
1382
1383 /**
1384 * Edit slug setting field
1385 *
1386 * @since 2.6.2 bbPress (r6965)
1387 */
1388 function bbp_admin_setting_callback_edit_slug() {
1389 ?>
1390
1391 <input name="_bbp_edit_slug" id="_bbp_edit_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_edit_slug', 'edit', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_slug' ); ?> />
1392
1393 <?php
1394 // Slug Check
1395 bbp_form_slug_conflict_check( '_bbp_edit_slug', 'edit' );
1396 }
1397
1398 /** BuddyPress ****************************************************************/
1399
1400 /**
1401 * Extension settings section description for the settings page
1402 *
1403 * @since 2.1.0 bbPress (r3575)
1404 */
1405 function bbp_admin_setting_callback_buddypress_section() {
1406 ?>
1407
1408 <p><?php esc_html_e( 'Forum settings for BuddyPress', 'bbpress' ); ?></p>
1409
1410 <?php
1411 }
1412
1413 /**
1414 * Allow BuddyPress group forums setting field
1415 *
1416 * @since 2.1.0 bbPress (r3575)
1417 */
1418 function bbp_admin_setting_callback_group_forums() {
1419 ?>
1420
1421 <input name="_bbp_enable_group_forums" id="_bbp_enable_group_forums" type="checkbox" value="1" <?php checked( bbp_is_group_forums_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_group_forums' ); ?> />
1422 <label for="_bbp_enable_group_forums"><?php esc_html_e( 'Allow BuddyPress Groups to have their own forums', 'bbpress' ); ?></label>
1423
1424 <?php
1425 }
1426
1427 /**
1428 * Replies per page setting field
1429 *
1430 * @since 2.1.0 bbPress (r3575)
1431 */
1432 function bbp_admin_setting_callback_group_forums_root_id() {
1433
1434 // Group root ID
1435 $group_root = bbp_get_group_forums_root_id();
1436 if ( ! bbp_get_forum( $group_root ) ) {
1437 delete_option( '_bbp_group_forums_root_id' );
1438 $group_root = 0;
1439 }
1440
1441 // Output the dropdown for all forums
1442 $select = bbp_get_dropdown( array(
1443 'selected' => $group_root,
1444 'show_none' => esc_html__( '&mdash; No parent &mdash;', 'bbpress' ),
1445 'orderby' => 'title',
1446 'order' => 'ASC',
1447 'select_id' => '_bbp_group_forums_root_id',
1448 'disable_categories' => false,
1449 'disabled' => '_bbp_group_forums_root_id'
1450 ) );
1451
1452 // Check cap one time
1453 $can_add_new = current_user_can( 'publish_forums' );
1454 $button = '';
1455
1456 // Text variations based on configuration
1457 if ( empty( $group_root ) && ( true === $can_add_new ) ) {
1458
1459 // New URL
1460 $new_url = wp_nonce_url( add_query_arg( array(
1461 'page' => 'bbpress',
1462 'create' => 'bbp-group-forum-root'
1463 ), admin_url( 'options-general.php' ) ), '_bbp_group_forums_root_id' );
1464
1465 // Button & text
1466 $button = '<a href="' . esc_url( $new_url ) . '">' . esc_html__( 'create a new one', 'bbpress' ) . '</a>';
1467 $text = esc_html__( 'Use %s to contain your group forums, or %s', 'bbpress' );
1468 } else {
1469 $text = esc_html__( 'Use %s to contain your group forums', 'bbpress' );
1470 }
1471
1472 // Output
1473 printf( $text, $select, $button ); ?>
1474 <p class="description"><?php esc_html_e( 'Changing this will not move existing forums.', 'bbpress' ); ?></p>
1475
1476 <?php
1477 }
1478
1479 /** Akismet *******************************************************************/
1480
1481 /**
1482 * Extension settings section description for the settings page
1483 *
1484 * @since 2.1.0 bbPress (r3575)
1485 */
1486 function bbp_admin_setting_callback_akismet_section() {
1487 ?>
1488
1489 <p><?php esc_html_e( 'Forum settings for Akismet', 'bbpress' ); ?></p>
1490
1491 <?php
1492 }
1493
1494
1495 /**
1496 * Allow Akismet setting field
1497 *
1498 * @since 2.1.0 bbPress (r3575)
1499 */
1500 function bbp_admin_setting_callback_akismet() {
1501 ?>
1502
1503 <input name="_bbp_enable_akismet" id="_bbp_enable_akismet" type="checkbox" value="1" <?php checked( bbp_is_akismet_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_akismet' ); ?> />
1504 <label for="_bbp_enable_akismet"><?php esc_html_e( 'Allow Akismet to actively prevent forum spam.', 'bbpress' ); ?></label>
1505
1506 <?php
1507 }
1508
1509 /** Settings Page *************************************************************/
1510
1511 /**
1512 * The main settings page
1513 *
1514 * @since 2.0.0 bbPress (r2643)
1515 */
1516 function bbp_admin_settings() {
1517 ?>
1518
1519 <div class="wrap">
1520 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forums Settings', 'bbpress' ) ?></h1>
1521 <hr class="wp-header-end">
1522
1523 <form action="options.php" method="post">
1524
1525 <?php settings_fields( 'bbpress' ); ?>
1526
1527 <?php do_settings_sections( 'bbpress' ); ?>
1528
1529 <p class="submit">
1530 <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'bbpress' ); ?>" />
1531 </p>
1532 </form>
1533 </div>
1534
1535 <?php
1536 }
1537
1538 /** Converter Section *********************************************************/
1539
1540 /**
1541 * Main settings section description for the settings page
1542 *
1543 * @since 2.1.0 bbPress (r3813)
1544 */
1545 function bbp_converter_setting_callback_main_section() {
1546 ?>
1547
1548 <p><?php _e( 'Information about the database for your previous forums so they can be converted.', 'bbpress' ); ?></p>
1549
1550 <?php
1551 }
1552
1553 /**
1554 * Edit Platform setting field
1555 *
1556 * @since 2.1.0 bbPress (r3813)
1557 */
1558 function bbp_converter_setting_callback_platform() {
1559
1560 // Converters
1561 $current = get_option( '_bbp_converter_platform' );
1562 $converters = bbp_get_converters();
1563 $options = '';
1564
1565 // Put options together
1566 foreach ( $converters as $name => $file ) {
1567 $options .= '<option value="' . esc_attr( $name ) . '"' . selected( $name, $current, false ) . '>' . esc_html( $name ) . '</option>';
1568 } ?>
1569
1570 <select name="_bbp_converter_platform" id="_bbp_converter_platform"><?php echo $options ?></select>
1571 <p class="description"><?php esc_html_e( 'The previous forum software', 'bbpress' ); ?></p>
1572
1573 <?php
1574 }
1575
1576 /**
1577 * Edit Database Server setting field
1578 *
1579 * @since 2.1.0 bbPress (r3813)
1580 */
1581 function bbp_converter_setting_callback_dbserver() {
1582 ?>
1583
1584 <input name="_bbp_converter_db_server" id="_bbp_converter_db_server" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_server', 'localhost' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_server' ); ?> />
1585 <p class="description"><?php printf( esc_html__( 'Use default %s if same server, or IP or hostname', 'bbpress' ), '<code>localhost</code>' ); ?></p>
1586
1587 <?php
1588 }
1589
1590 /**
1591 * Edit Database Server Port setting field
1592 *
1593 * @since 2.1.0 bbPress (r3813)
1594 */
1595 function bbp_converter_setting_callback_dbport() {
1596 ?>
1597
1598 <input name="_bbp_converter_db_port" id="_bbp_converter_db_port" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_port', '3306' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_port' ); ?> />
1599 <p class="description"><?php printf( esc_html__( 'Use default %s if unsure', 'bbpress' ), '<code>3306</code>' ); ?></p>
1600
1601 <?php
1602 }
1603
1604 /**
1605 * Edit Database User setting field
1606 *
1607 * @since 2.1.0 bbPress (r3813)
1608 */
1609 function bbp_converter_setting_callback_dbuser() {
1610 ?>
1611
1612 <input name="_bbp_converter_db_user" id="_bbp_converter_db_user" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_user' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_user' ); ?> />
1613 <p class="description"><?php esc_html_e( 'User to access the database', 'bbpress' ); ?></p>
1614
1615 <?php
1616 }
1617
1618 /**
1619 * Edit Database Pass setting field
1620 *
1621 * @since 2.1.0 bbPress (r3813)
1622 */
1623 function bbp_converter_setting_callback_dbpass() {
1624 ?>
1625
1626 <span class="bbp-converter-db-password-wrapper">
1627 <input name="_bbp_converter_db_pass" id="_bbp_converter_db_pass" class="bbp-converter-db-pass code" type="password" value="<?php bbp_form_option( '_bbp_converter_db_pass' ); ?>" autocomplete="off" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_pass' ); ?> />
1628 <button type="button" class="bbp-db-pass-toggle password">
1629 <span class="screen-reader-text"><?php esc_html_e( 'Toggle', 'bbpress' ); ?></span>
1630 <span class="toggle-indicator" aria-hidden="true"></span>
1631 </button>
1632 </span>
1633 <p class="description"><?php esc_html_e( 'Password for the above database user', 'bbpress' ); ?></p>
1634
1635 <?php
1636 }
1637
1638 /**
1639 * Edit Database Name setting field
1640 *
1641 * @since 2.1.0 bbPress (r3813)
1642 */
1643 function bbp_converter_setting_callback_dbname() {
1644 ?>
1645
1646 <input name="_bbp_converter_db_name" id="_bbp_converter_db_name" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_name' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_name' ); ?> />
1647 <p class="description"><?php esc_html_e( 'Name of the database with your old forum data', 'bbpress' ); ?></p>
1648
1649 <?php
1650 }
1651
1652 /**
1653 * Main settings section description for the settings page
1654 *
1655 * @since 2.1.0 bbPress (r3813)
1656 */
1657 function bbp_converter_setting_callback_options_section() {
1658 ?>
1659
1660 <p><?php esc_html_e( 'Some optional parameters to help tune the conversion process.', 'bbpress' ); ?></p>
1661
1662 <?php
1663 }
1664
1665 /**
1666 * Edit Table Prefix setting field
1667 *
1668 * @since 2.1.0 bbPress (r3813)
1669 */
1670 function bbp_converter_setting_callback_dbprefix() {
1671 ?>
1672
1673 <input name="_bbp_converter_db_prefix" id="_bbp_converter_db_prefix" type="text" class="code" value="<?php bbp_form_option( '_bbp_converter_db_prefix' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_db_prefix' ); ?> />
1674 <p class="description"><?php printf( esc_html__( 'Use %s if converting from BuddyPress Legacy', 'bbpress' ), '<code>wp_bb_</code>' ); ?></p>
1675
1676 <?php
1677 }
1678
1679 /**
1680 * Edit Rows Limit setting field
1681 *
1682 * @since 2.1.0 bbPress (r3813)
1683 */
1684 function bbp_converter_setting_callback_rows() {
1685 ?>
1686
1687 <input name="_bbp_converter_rows" id="_bbp_converter_rows" type="number" min="1" max="5000" value="<?php bbp_form_option( '_bbp_converter_rows', '100' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_rows' ); ?> />
1688 <label for="_bbp_converter_rows"><?php esc_html_e( 'entry maximum when querying for data to convert', 'bbpress' ); ?></label>
1689 <p class="description"><?php esc_html_e( 'Keep this low if you experience out-of-memory issues.', 'bbpress' ); ?></p>
1690
1691 <?php
1692 }
1693
1694 /**
1695 * Edit Delay Time setting field
1696 *
1697 * @since 2.1.0 bbPress (r3813)
1698 */
1699 function bbp_converter_setting_callback_delay_time() {
1700 ?>
1701
1702 <input name="_bbp_converter_delay_time" id="_bbp_converter_delay_time" type="number" min="2" max="3600" value="<?php bbp_form_option( '_bbp_converter_delay_time', '2' ); ?>" <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_delay_time' ); ?> />
1703 <label for="_bbp_converter_delay_time"><?php esc_html_e( 'second delay between each query of rows above', 'bbpress' ); ?></label>
1704 <p class="description"><?php esc_html_e( 'Keep this high to prevent too-many-connection issues.', 'bbpress' ); ?></p>
1705
1706 <?php
1707 }
1708
1709 /**
1710 * Edit Halt setting field
1711 *
1712 * @since 2.6.0 bbPress (r6599)
1713 */
1714 function bbp_converter_setting_callback_halt() {
1715 ?>
1716
1717 <input name="_bbp_converter_halt" id="_bbp_converter_halt" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_halt', false ) ); ?> />
1718 <label for="_bbp_converter_halt"><?php esc_html_e( 'Halt the conversion if an error occurs', 'bbpress' ); ?></label>
1719 <p class="description"><?php esc_html_e( 'This is helpful if you want to debug problems.', 'bbpress' ); ?></p>
1720
1721 <?php
1722 }
1723
1724
1725 /**
1726 * Edit Restart setting field
1727 *
1728 * @since 2.1.0 bbPress (r3813)
1729 */
1730 function bbp_converter_setting_callback_restart() {
1731 ?>
1732
1733 <input name="_bbp_converter_restart" id="_bbp_converter_restart" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> />
1734 <label for="_bbp_converter_restart"><?php esc_html_e( 'Restart the converter from the beginning', 'bbpress' ); ?></label>
1735 <p class="description"><?php esc_html_e( 'This forces all steps back to 0. Avoid duplicate data by purging or resetting first.', 'bbpress' ); ?></p>
1736
1737 <?php
1738 }
1739
1740 /**
1741 * Edit Clean setting field
1742 *
1743 * @since 2.1.0 bbPress (r3813)
1744 */
1745 function bbp_converter_setting_callback_clean() {
1746 ?>
1747
1748 <input name="_bbp_converter_clean" id="_bbp_converter_clean" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_clean', false ) ); ?> />
1749 <label for="_bbp_converter_clean"><?php esc_html_e( 'Purge all meta-data from a previous import', 'bbpress' ); ?></label>
1750 <p class="description"><?php esc_html_e( 'Use this if an import failed, or you just want to remove the relationship data.', 'bbpress' ); ?></p>
1751
1752 <?php
1753 }
1754
1755 /**
1756 * Edit Convert Users setting field
1757 *
1758 * @since 2.1.0 bbPress (r3813)
1759 */
1760 function bbp_converter_setting_callback_convert_users() {
1761 ?>
1762
1763 <input name="_bbp_converter_convert_users" id="_bbp_converter_convert_users" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_convert_users', false ) ); ?> <?php bbp_maybe_admin_setting_disabled( '_bbp_converter_convert_users' ); ?> />
1764 <label for="_bbp_converter_convert_users"><?php esc_html_e( 'Import user accounts from previous forums', 'bbpress' ); ?></label>
1765 <p class="description"><?php esc_html_e( 'Passwords remain encrypted, and are converted as individual users log in.', 'bbpress' ); ?></p>
1766
1767 <?php
1768 }
1769
1770 /** Converter Page ************************************************************/
1771
1772 /**
1773 * The main settings page
1774 *
1775 * @since 2.1.0 bbPress (r3186)
1776 */
1777 function bbp_converter_settings_page() {
1778
1779 // Status
1780 $step = (int) get_option( '_bbp_converter_step', 0 );
1781 $max = (int) bbp_admin()->converter->max_steps;
1782
1783 // Starting or continuing?
1784 $status_text = ! empty( $step )
1785 ? sprintf( esc_html__( 'Up next: step %s', 'bbpress' ), $step )
1786 : esc_html__( 'Ready', 'bbpress' );
1787
1788 // Starting or continuing?
1789 $start_text = ! empty( $step )
1790 ? esc_html__( 'Resume', 'bbpress' )
1791 : esc_html__( 'Start', 'bbpress' );
1792
1793 // Starting or continuing?
1794 $progress_text = ! empty( $step )
1795 ? sprintf( esc_html__( 'Previously stopped at step %d of %d', 'bbpress' ), $step, $max )
1796 : esc_html__( 'Ready to go.', 'bbpress' ); ?>
1797
1798 <div class="wrap">
1799 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1>
1800 <hr class="wp-header-end">
1801 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( 'bbp-converter' ); ?></h2>
1802
1803 <div class="bbp-converter-wrap">
1804 <div id="poststuff" class="bbp-converter-monitor-wrap">
1805 <div id="post-body" class="metabox-holder columns-1">
1806 <div id="postbox-container-1" class="postbox-container">
1807 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
1808 <div id="bbp-converter-monitor" class="postbox">
1809 <button type="button" class="handlediv" aria-expanded="true">
1810 <span class="screen-reader-text"><?php esc_html_e( 'Toggle panel: Import Status', 'bbpress' ); ?></span>
1811 <span class="toggle-indicator" aria-hidden="true"></span>
1812 </button>
1813 <h2 class="hndle ui-sortable-handle">
1814 <span><?php esc_html_e( 'Import Monitor', 'bbpress' ); ?></span>
1815 <span id="bbp-converter-status"><?php echo esc_html( $status_text ); ?></span>
1816 <span id="bbp-converter-step-percentage" class="bbp-progress-bar"></span>
1817 <span id="bbp-converter-total-percentage" class="bbp-progress-bar"></span>
1818 </h2>
1819 <div class="inside">
1820 <div id="bbp-converter-message" class="bbp-converter-log">
1821 <p><?php echo esc_html( $progress_text ); ?></p>
1822 </div>
1823 </div>
1824 <div class="actions">
1825 <input type="button" name="submit" class="button-primary" id="bbp-converter-start" value="<?php echo esc_attr( $start_text ); ?>" />
1826 <input type="button" name="submit" class="button-primary" id="bbp-converter-stop" value="<?php esc_attr_e( 'Pause', 'bbpress' ); ?>" />
1827 <span class="spinner" id="bbp-converter-spinner"></span>
1828 </div>
1829 </div>
1830 </div>
1831 </div>
1832 </div>
1833 </div>
1834
1835 <form action="#" method="post" id="bbp-converter-settings" class="bbp-converter-settings-wrap"><?php
1836
1837 // Fields
1838 settings_fields( 'converter' );
1839
1840 // Sections
1841 do_settings_sections( 'converter' );
1842
1843 ?></form>
1844 </div>
1845 </div>
1846 <?php
1847 }
1848
1849 /** Helpers *******************************************************************/
1850
1851 /**
1852 * Contextual help for Forums settings page
1853 *
1854 * @since 2.0.0 bbPress (r3119)
1855 */
1856 function bbp_admin_settings_help() {
1857
1858 $current_screen = get_current_screen();
1859
1860 // Bail if current screen could not be found
1861 if ( empty( $current_screen ) ) {
1862 return;
1863 }
1864
1865 // Overview
1866 $current_screen->add_help_tab( array(
1867 'id' => 'overview',
1868 'title' => esc_html__( 'Overview', 'bbpress' ),
1869 'content' => '<p>' . esc_html__( 'This screen provides access to all of the Forums settings.', 'bbpress' ) . '</p>' .
1870 '<p>' . esc_html__( 'Please see the additional help tabs for more information on each individual section.', 'bbpress' ) . '</p>'
1871 ) );
1872
1873 // Main Settings
1874 $current_screen->add_help_tab( array(
1875 'id' => 'main_settings',
1876 'title' => esc_html__( 'Main Settings', 'bbpress' ),
1877 'content' => '<p>' . esc_html__( 'The "Main Settings" section includes a number of options:', 'bbpress' ) . '</p>' .
1878 '<p>' .
1879 '<ul>' .
1880 '<li>' . esc_html__( 'You can choose to lock a post after a certain number of minutes. "Locking post editing" will prevent the author from editing some amount of time after saving a post.', 'bbpress' ) . '</li>' .
1881 '<li>' . esc_html__( '"Throttle time" is the amount of time required between posts from a single author. The higher the throttle time, the longer a user will need to wait between posting to the forum.', 'bbpress' ) . '</li>' .
1882 '<li>' . esc_html__( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.', 'bbpress' ) . '</li>' .
1883 '<li>' . esc_html__( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.', 'bbpress' ) . '</li>' .
1884 '<li>' . esc_html__( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.', 'bbpress' ) . '</li>' .
1885 '<li>' . esc_html__( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.', 'bbpress' ) . '</li>' .
1886 '<li>' . esc_html__( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.', 'bbpress' ) . '</li>' .
1887 '<li>' . esc_html__( 'Auto-embed will embed the media content from a URL directly into the replies. For example: links to Flickr and YouTube.', 'bbpress' ) . '</li>' .
1888 '</ul>' .
1889 '</p>' .
1890 '<p>' . esc_html__( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>'
1891 ) );
1892
1893 // Theme Package
1894 $current_screen->add_help_tab( array(
1895 'id' => 'theme_packages',
1896 'title' => esc_html__( 'Theme Packages', 'bbpress' ),
1897 'content' => '<p>' . esc_html__( 'The "Theme Packages" section allows you to choose which theme package should be used.', 'bbpress' ) . '</p>' .
1898 '<p>' .
1899 '<ul>' .
1900 '<li>' . esc_html__( 'The "bbPress Default" package is installed by default.', 'bbpress' ) . '</li>' .
1901 '<li>' . esc_html__( 'Some themes may choose to ignore this setting entirely.', 'bbpress' ) . '</li>' .
1902 '<li>' . esc_html__( 'Packages can be stacked to allow for intelligent fallbacks.', 'bbpress' ) . '</li>' .
1903 '</ul>' .
1904 '</p>'
1905 ) );
1906
1907 // Per Page
1908 $current_screen->add_help_tab( array(
1909 'id' => 'per_page',
1910 'title' => esc_html__( 'Per Page', 'bbpress' ),
1911 'content' => '<p>' . esc_html__( 'The "Per Page" section allows you to control the number of topics and replies appear on each page.', 'bbpress' ) . '</p>' .
1912 '<ul>' .
1913 '<li>' . esc_html__( 'This is comparable to the WordPress "Reading Settings" page, where you can set the number of posts that should show on blog pages and in feeds.', 'bbpress' ) . '</li>' .
1914 '<li>' . esc_html__( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.', 'bbpress' ) . '</li>' .
1915 '</ul>' .
1916 '<p>'
1917 ) );
1918
1919 // Slugs
1920 $current_screen->add_help_tab( array(
1921 'id' => 'slugs',
1922 'title' => esc_html__( 'Slugs', 'bbpress' ),
1923 'content' => '<p>' . esc_html__( 'The "Slugs" section allows you to control the permalink structure for your forums.', 'bbpress' ) . '</p>' .
1924 '<ul>' .
1925 '<li>' . esc_html__( '"Archive Slugs" are used as the "root" for your forums and topics. If you combine these values with existing page slugs, bbPress will attempt to output the most correct title and content.', 'bbpress' ) . '</li>' .
1926 '<li>' . esc_html__( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.', 'bbpress' ) . '</li>' .
1927 '<li>' . esc_html__( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</li>' .
1928 '</ul>' .
1929 '<p>'
1930 ) );
1931
1932 // Help Sidebar
1933 $current_screen->set_help_sidebar(
1934 '<p><strong>' . esc_html__( 'For more information:', 'bbpress' ) . '</strong></p>' .
1935 '<p>' . __( '<a href="https://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' .
1936 '<p>' . __( '<a href="https://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>'
1937 );
1938 }
1939
1940 /**
1941 * Disable a settings field if it is forcibly set in the global options array.
1942 *
1943 * @since 2.2.0 bbPress (r4347)
1944 *
1945 * @param string $option_key
1946 */
1947 function bbp_maybe_admin_setting_disabled( $option_key = '' ) {
1948 disabled( isset( bbpress()->options[ $option_key ] ) );
1949 }
1950
1951 /**
1952 * Output settings API option
1953 *
1954 * @since 2.0.0 bbPress (r3203)
1955 *
1956 * @param string $option
1957 * @param string $default
1958 * @param bool $slug
1959 */
1960 function bbp_form_option( $option, $default = '' , $slug = false ) {
1961 echo bbp_get_form_option( $option, $default, $slug );
1962 }
1963 /**
1964 * Return settings API option
1965 *
1966 * @since 2.0.0 bbPress (r3203)
1967 *
1968 * @param string $option
1969 * @param string $default
1970 * @param bool $is_slug
1971 *
1972 * @return mixed
1973 */
1974 function bbp_get_form_option( $option, $default = '', $is_slug = false ) {
1975
1976 // Get the option and sanitize it
1977 $value = get_option( $option, $default );
1978
1979 // Slug?
1980 if ( true === $is_slug ) {
1981 $value = esc_attr( apply_filters( 'editable_slug', $value ) );
1982
1983 // Not a slug
1984 } else {
1985 $value = esc_attr( $value );
1986 }
1987
1988 // Fallback to default
1989 if ( empty( $value ) ) {
1990 $value = $default;
1991 }
1992
1993 // Filter & return
1994 return apply_filters( 'bbp_get_form_option', $value, $option, $default, $is_slug );
1995 }
1996
1997 /**
1998 * Used to check if a bbPress slug conflicts with an existing known slug.
1999 *
2000 * @since 2.0.0 bbPress (r3306)
2001 *
2002 * @param string $slug
2003 * @param string $default
2004 */
2005 function bbp_form_slug_conflict_check( $slug, $default ) {
2006
2007 // Only set the slugs once ver page load
2008 static $the_core_slugs = array();
2009
2010 // Get the form value
2011 $this_slug = bbp_get_form_option( $slug, $default, true );
2012
2013 if ( empty( $the_core_slugs ) ) {
2014
2015 // Slugs to check
2016 $core_slugs = apply_filters( 'bbp_slug_conflict_check', array(
2017
2018 /** WordPress Core ****************************************************/
2019
2020 // Core Post Types
2021 'post_base' => array( 'name' => esc_html__( 'Posts', 'bbpress' ), 'default' => 'post', 'context' => 'WordPress' ),
2022 'page_base' => array( 'name' => esc_html__( 'Pages', 'bbpress' ), 'default' => 'page', 'context' => 'WordPress' ),
2023 'revision_base' => array( 'name' => esc_html__( 'Revisions', 'bbpress' ), 'default' => 'revision', 'context' => 'WordPress' ),
2024 'attachment_base' => array( 'name' => esc_html__( 'Attachments', 'bbpress' ), 'default' => 'attachment', 'context' => 'WordPress' ),
2025 'nav_menu_base' => array( 'name' => esc_html__( 'Menus', 'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),
2026
2027 // Post Tags
2028 'tag_base' => array( 'name' => esc_html__( 'Tag base', 'bbpress' ), 'default' => 'tag', 'context' => 'WordPress' ),
2029
2030 // Post Categories
2031 'category_base' => array( 'name' => esc_html__( 'Category base', 'bbpress' ), 'default' => 'category', 'context' => 'WordPress' ),
2032
2033 /** bbPress Core ******************************************************/
2034
2035 // Forum archive slug
2036 '_bbp_root_slug' => array( 'name' => esc_html__( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ),
2037
2038 // Topic archive slug
2039 '_bbp_topic_archive_slug' => array( 'name' => esc_html__( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ),
2040
2041 // Forum slug
2042 '_bbp_forum_slug' => array( 'name' => esc_html__( 'Forum slug', 'bbpress' ), 'default' => 'forum', 'context' => 'bbPress' ),
2043
2044 // Topic slug
2045 '_bbp_topic_slug' => array( 'name' => esc_html__( 'Topic slug', 'bbpress' ), 'default' => 'topic', 'context' => 'bbPress' ),
2046
2047 // Reply slug
2048 '_bbp_reply_slug' => array( 'name' => esc_html__( 'Reply slug', 'bbpress' ), 'default' => 'reply', 'context' => 'bbPress' ),
2049
2050 // Edit slug
2051 '_bbp_edit_slug' => array( 'name' => esc_html__( 'Edit slug', 'bbpress' ), 'default' => 'edit', 'context' => 'bbPress' ),
2052
2053 // User profile slug
2054 '_bbp_user_slug' => array( 'name' => esc_html__( 'User base', 'bbpress' ), 'default' => 'users', 'context' => 'bbPress' ),
2055
2056 // View slug
2057 '_bbp_view_slug' => array( 'name' => esc_html__( 'View base', 'bbpress' ), 'default' => 'view', 'context' => 'bbPress' ),
2058
2059 // Topic tag slug
2060 '_bbp_topic_tag_slug' => array( 'name' => esc_html__( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ),
2061 ) );
2062
2063 /** BuddyPress Core *******************************************************/
2064
2065 if ( defined( 'BP_VERSION' ) ) {
2066 $bp = buddypress();
2067
2068 // Loop through root slugs and check for conflict
2069 if ( ! empty( $bp->pages ) ) {
2070 foreach ( $bp->pages as $page => $page_data ) {
2071 $page_base = $page . '_base';
2072 $page_title = sprintf( esc_html__( '%s page', 'bbpress' ), $page_data->title );
2073 $core_slugs[ $page_base ] = array(
2074 'name' => $page_title,
2075 'default' => $page_data->slug,
2076 'context' => 'BuddyPress'
2077 );
2078 }
2079 }
2080 }
2081
2082 // Set the static
2083 $the_core_slugs = apply_filters( 'bbp_slug_conflict', $core_slugs );
2084 }
2085
2086 // Loop through slugs to check
2087 foreach ( $the_core_slugs as $key => $value ) {
2088
2089 // Get the slug
2090 $slug_check = bbp_get_form_option( $key, $value['default'], true );
2091
2092 // Compare
2093 if ( ( $slug !== $key ) && ( $slug_check === $this_slug ) ) : ?>
2094
2095 <span class="attention"><?php printf( esc_html__( 'Possible %1$s conflict: %2$s', 'bbpress' ), $value['context'], '<strong>' . $value['name'] . '</strong>' ); ?></span>
2096
2097 <?php endif;
2098 }
2099 }
2100