/includes/admin/settings.php

  1. <?php 
  2.  
  3. /** 
  4. * bbPress Admin Settings 
  5. * 
  6. * @package bbPress 
  7. * @subpackage Administration 
  8. */ 
  9.  
  10. // Exit if accessed directly 
  11. if ( !defined( 'ABSPATH' ) ) exit; 
  12.  
  13. /** Sections ******************************************************************/ 
  14.  
  15. /** 
  16. * Get the Forums settings sections. 
  17. * 
  18. * @since bbPress (r4001) 
  19. * @return array 
  20. */ 
  21. function bbp_admin_get_settings_sections() { 
  22. return (array) apply_filters( 'bbp_admin_get_settings_sections', array( 
  23. 'bbp_settings_users' => array( 
  24. 'title' => __( 'Forum User Settings', 'bbpress' ),  
  25. 'callback' => 'bbp_admin_setting_callback_user_section',  
  26. 'page' => 'discussion' 
  27. ),  
  28. 'bbp_settings_features' => array( 
  29. 'title' => __( 'Forum Features', 'bbpress' ),  
  30. 'callback' => 'bbp_admin_setting_callback_features_section',  
  31. 'page' => 'discussion' 
  32. ),  
  33. 'bbp_settings_theme_compat' => array( 
  34. 'title' => __( 'Forum Theme Packages', 'bbpress' ),  
  35. 'callback' => 'bbp_admin_setting_callback_subtheme_section',  
  36. 'page' => 'general' 
  37. ),  
  38. 'bbp_settings_per_page' => array( 
  39. 'title' => __( 'Topics and Replies Per Page', 'bbpress' ),  
  40. 'callback' => 'bbp_admin_setting_callback_per_page_section',  
  41. 'page' => 'reading' 
  42. ),  
  43. 'bbp_settings_per_rss_page' => array( 
  44. 'title' => __( 'Topics and Replies Per RSS Page', 'bbpress' ),  
  45. 'callback' => 'bbp_admin_setting_callback_per_rss_page_section',  
  46. 'page' => 'reading',  
  47. ),  
  48. 'bbp_settings_root_slugs' => array( 
  49. 'title' => __( 'Forum Root Slug', 'bbpress' ),  
  50. 'callback' => 'bbp_admin_setting_callback_root_slug_section',  
  51. 'page' => 'permalink' 
  52. ),  
  53. 'bbp_settings_single_slugs' => array( 
  54. 'title' => __( 'Single Forum Slugs', 'bbpress' ),  
  55. 'callback' => 'bbp_admin_setting_callback_single_slug_section',  
  56. 'page' => 'permalink',  
  57. ),  
  58. 'bbp_settings_user_slugs' => array( 
  59. 'title' => __( 'Forum User Slugs', 'bbpress' ),  
  60. 'callback' => 'bbp_admin_setting_callback_user_slug_section',  
  61. 'page' => 'permalink',  
  62. ),  
  63. 'bbp_settings_buddypress' => array( 
  64. 'title' => __( 'BuddyPress Integration', 'bbpress' ),  
  65. 'callback' => 'bbp_admin_setting_callback_buddypress_section',  
  66. 'page' => 'buddypress',  
  67. ),  
  68. 'bbp_settings_akismet' => array( 
  69. 'title' => __( 'Akismet Integration', 'bbpress' ),  
  70. 'callback' => 'bbp_admin_setting_callback_akismet_section',  
  71. 'page' => 'discussion' 
  72. ) ); 
  73.  
  74. /** 
  75. * Get all of the settings fields. 
  76. * 
  77. * @since bbPress (r4001) 
  78. * @return type 
  79. */ 
  80. function bbp_admin_get_settings_fields() { 
  81. return (array) apply_filters( 'bbp_admin_get_settings_fields', array( 
  82.  
  83. /** User Section ******************************************************/ 
  84.  
  85. 'bbp_settings_users' => array( 
  86.  
  87. // Edit lock setting 
  88. '_bbp_edit_lock' => array( 
  89. 'title' => __( 'Disallow editing after', 'bbpress' ),  
  90. 'callback' => 'bbp_admin_setting_callback_editlock',  
  91. 'sanitize_callback' => 'intval',  
  92. 'args' => array() 
  93. ),  
  94.  
  95. // Throttle setting 
  96. '_bbp_throttle_time' => array( 
  97. 'title' => __( 'Throttle posting every', 'bbpress' ),  
  98. 'callback' => 'bbp_admin_setting_callback_throttle',  
  99. 'sanitize_callback' => 'intval',  
  100. 'args' => array() 
  101. ),  
  102.  
  103. // Allow anonymous posting setting 
  104. '_bbp_allow_anonymous' => array( 
  105. 'title' => __( 'Anonymous posting', 'bbpress' ),  
  106. 'callback' => 'bbp_admin_setting_callback_anonymous',  
  107. 'sanitize_callback' => 'intval',  
  108. 'args' => array() 
  109. ),  
  110.  
  111. // Allow global access (on multisite) 
  112. '_bbp_allow_global_access' => array( 
  113. 'title' => __( 'Auto role', 'bbpress' ),  
  114. 'callback' => 'bbp_admin_setting_callback_global_access',  
  115. 'sanitize_callback' => 'intval',  
  116. 'args' => array() 
  117. ),  
  118.  
  119. // Allow global access (on multisite) 
  120. '_bbp_default_role' => array( 
  121. 'sanitize_callback' => 'sanitize_text_field',  
  122. 'args' => array() 
  123. ),  
  124.  
  125. /** Features Section **************************************************/ 
  126.  
  127. 'bbp_settings_features' => array( 
  128.  
  129. // Allow topic and reply revisions 
  130. '_bbp_allow_revisions' => array( 
  131. 'title' => __( 'Revisions', 'bbpress' ),  
  132. 'callback' => 'bbp_admin_setting_callback_revisions',  
  133. 'sanitize_callback' => 'intval',  
  134. 'args' => array() 
  135. ),  
  136.  
  137. // Allow favorites setting 
  138. '_bbp_enable_favorites' => array( 
  139. 'title' => __( 'Favorites', 'bbpress' ),  
  140. 'callback' => 'bbp_admin_setting_callback_favorites',  
  141. 'sanitize_callback' => 'intval',  
  142. 'args' => array() 
  143. ),  
  144.  
  145. // Allow subscriptions setting 
  146. '_bbp_enable_subscriptions' => array( 
  147. 'title' => __( 'Subscriptions', 'bbpress' ),  
  148. 'callback' => 'bbp_admin_setting_callback_subscriptions',  
  149. 'sanitize_callback' => 'intval',  
  150. 'args' => array() 
  151. ),  
  152.  
  153. // Allow topic tags 
  154. '_bbp_allow_topic_tags' => array( 
  155. 'title' => __( 'Topic tags', 'bbpress' ),  
  156. 'callback' => 'bbp_admin_setting_callback_topic_tags',  
  157. 'sanitize_callback' => 'intval',  
  158. 'args' => array() 
  159. ),  
  160.  
  161. // Allow topic tags 
  162. '_bbp_allow_search' => array( 
  163. 'title' => __( 'Search', 'bbpress' ),  
  164. 'callback' => 'bbp_admin_setting_callback_search',  
  165. 'sanitize_callback' => 'intval',  
  166. 'args' => array() 
  167. ),  
  168.  
  169. // Allow fancy editor setting 
  170. '_bbp_use_wp_editor' => array( 
  171. 'title' => __( 'Post Formatting', 'bbpress' ),  
  172. 'callback' => 'bbp_admin_setting_callback_use_wp_editor',  
  173. 'args' => array(),  
  174. 'sanitize_callback' => 'intval' 
  175. ),  
  176.  
  177. // Allow auto embedding setting 
  178. '_bbp_use_autoembed' => array( 
  179. 'title' => __( 'Auto-embed links', 'bbpress' ),  
  180. 'callback' => 'bbp_admin_setting_callback_use_autoembed',  
  181. 'sanitize_callback' => 'intval',  
  182. 'args' => array() 
  183. ),  
  184.  
  185. // Set reply threading level 
  186. '_bbp_thread_replies_depth' => array( 
  187. 'title' => __( 'Reply Threading', 'bbpress' ),  
  188. 'callback' => 'bbp_admin_setting_callback_thread_replies_depth',  
  189. 'sanitize_callback' => 'intval',  
  190. 'args' => array() 
  191. ),  
  192.  
  193. // Allow threaded replies 
  194. '_bbp_allow_threaded_replies' => array( 
  195. 'sanitize_callback' => 'intval',  
  196. 'args' => array() 
  197. ),  
  198.  
  199. /** Theme Packages ****************************************************/ 
  200.  
  201. 'bbp_settings_theme_compat' => array( 
  202.  
  203. // Theme package setting 
  204. '_bbp_theme_package_id' => array( 
  205. 'title' => __( 'Current Package', 'bbpress' ),  
  206. 'callback' => 'bbp_admin_setting_callback_subtheme_id',  
  207. 'sanitize_callback' => 'esc_sql',  
  208. 'args' => array() 
  209. ),  
  210.  
  211. /** Per Page Section **************************************************/ 
  212.  
  213. 'bbp_settings_per_page' => array( 
  214.  
  215. // Replies per page setting 
  216. '_bbp_topics_per_page' => array( 
  217. 'title' => __( 'Topics', 'bbpress' ),  
  218. 'callback' => 'bbp_admin_setting_callback_topics_per_page',  
  219. 'sanitize_callback' => 'intval',  
  220. 'args' => array() 
  221. ),  
  222.  
  223. // Replies per page setting 
  224. '_bbp_replies_per_page' => array( 
  225. 'title' => __( 'Replies', 'bbpress' ),  
  226. 'callback' => 'bbp_admin_setting_callback_replies_per_page',  
  227. 'sanitize_callback' => 'intval',  
  228. 'args' => array() 
  229. ),  
  230.  
  231. /** Per RSS Page Section **********************************************/ 
  232.  
  233. 'bbp_settings_per_rss_page' => array( 
  234.  
  235. // Replies per page setting 
  236. '_bbp_topics_per_rss_page' => array( 
  237. 'title' => __( 'Topics', 'bbpress' ),  
  238. 'callback' => 'bbp_admin_setting_callback_topics_per_rss_page',  
  239. 'sanitize_callback' => 'intval',  
  240. 'args' => array() 
  241. ),  
  242.  
  243. // Replies per page setting 
  244. '_bbp_replies_per_rss_page' => array( 
  245. 'title' => __( 'Replies', 'bbpress' ),  
  246. 'callback' => 'bbp_admin_setting_callback_replies_per_rss_page',  
  247. 'sanitize_callback' => 'intval',  
  248. 'args' => array() 
  249. ),  
  250.  
  251. /** Front Slugs *******************************************************/ 
  252.  
  253. 'bbp_settings_root_slugs' => array( 
  254.  
  255. // Root slug setting 
  256. '_bbp_root_slug' => array( 
  257. 'title' => __( 'Forum Root', 'bbpress' ),  
  258. 'callback' => 'bbp_admin_setting_callback_root_slug',  
  259. 'sanitize_callback' => 'bbp_sanitize_slug',  
  260. 'args' => array() 
  261. ),  
  262.  
  263. // Include root setting 
  264. '_bbp_include_root' => array( 
  265. 'title' => __( 'Forum Prefix', 'bbpress' ),  
  266. 'callback' => 'bbp_admin_setting_callback_include_root',  
  267. 'sanitize_callback' => 'intval',  
  268. 'args' => array() 
  269. ),  
  270.  
  271. // What to show on Forum Root 
  272. '_bbp_show_on_root' => array( 
  273. 'title' => __( 'Forum root should show', 'bbpress' ),  
  274. 'callback' => 'bbp_admin_setting_callback_show_on_root',  
  275. 'sanitize_callback' => 'sanitize_text_field',  
  276. 'args' => array() 
  277. ),  
  278. ),  
  279.  
  280. /** Single Slugs ******************************************************/ 
  281.  
  282. 'bbp_settings_single_slugs' => array( 
  283.  
  284. // Forum slug setting 
  285. '_bbp_forum_slug' => array( 
  286. 'title' => __( 'Forum', 'bbpress' ),  
  287. 'callback' => 'bbp_admin_setting_callback_forum_slug',  
  288. 'sanitize_callback' => 'bbp_sanitize_slug',  
  289. 'args' => array() 
  290. ),  
  291.  
  292. // Topic slug setting 
  293. '_bbp_topic_slug' => array( 
  294. 'title' => __( 'Topic', 'bbpress' ),  
  295. 'callback' => 'bbp_admin_setting_callback_topic_slug',  
  296. 'sanitize_callback' => 'bbp_sanitize_slug',  
  297. 'args' => array() 
  298. ),  
  299.  
  300. // Topic tag slug setting 
  301. '_bbp_topic_tag_slug' => array( 
  302. 'title' => __( 'Topic Tag', 'bbpress' ),  
  303. 'callback' => 'bbp_admin_setting_callback_topic_tag_slug',  
  304. 'sanitize_callback' => 'bbp_sanitize_slug',  
  305. 'args' => array() 
  306. ),  
  307.  
  308. // View slug setting 
  309. '_bbp_view_slug' => array( 
  310. 'title' => __( 'Topic View', 'bbpress' ),  
  311. 'callback' => 'bbp_admin_setting_callback_view_slug',  
  312. 'sanitize_callback' => 'bbp_sanitize_slug',  
  313. 'args' => array() 
  314. ),  
  315.  
  316. // Reply slug setting 
  317. '_bbp_reply_slug' => array( 
  318. 'title' => __( 'Reply', 'bbpress' ),  
  319. 'callback' => 'bbp_admin_setting_callback_reply_slug',  
  320. 'sanitize_callback' => 'bbp_sanitize_slug',  
  321. 'args' => array() 
  322. ),  
  323.  
  324. // Search slug setting 
  325. '_bbp_search_slug' => array( 
  326. 'title' => __( 'Search', 'bbpress' ),  
  327. 'callback' => 'bbp_admin_setting_callback_search_slug',  
  328. 'sanitize_callback' => 'bbp_sanitize_slug',  
  329. 'args' => array() 
  330. ),  
  331.  
  332. /** User Slugs ********************************************************/ 
  333.  
  334. 'bbp_settings_user_slugs' => array( 
  335.  
  336. // User slug setting 
  337. '_bbp_user_slug' => array( 
  338. 'title' => __( 'User Base', 'bbpress' ),  
  339. 'callback' => 'bbp_admin_setting_callback_user_slug',  
  340. 'sanitize_callback' => 'bbp_sanitize_slug',  
  341. 'args' => array() 
  342. ),  
  343.  
  344. // Topics slug setting 
  345. '_bbp_topic_archive_slug' => array( 
  346. 'title' => __( 'Topics Started', 'bbpress' ),  
  347. 'callback' => 'bbp_admin_setting_callback_topic_archive_slug',  
  348. 'sanitize_callback' => 'bbp_sanitize_slug',  
  349. 'args' => array() 
  350. ),  
  351.  
  352. // Replies slug setting 
  353. '_bbp_reply_archive_slug' => array( 
  354. 'title' => __( 'Replies Created', 'bbpress' ),  
  355. 'callback' => 'bbp_admin_setting_callback_reply_archive_slug',  
  356. 'sanitize_callback' => 'bbp_sanitize_slug',  
  357. 'args' => array() 
  358. ),  
  359.  
  360. // Favorites slug setting 
  361. '_bbp_user_favs_slug' => array( 
  362. 'title' => __( 'Favorite Topics', 'bbpress' ),  
  363. 'callback' => 'bbp_admin_setting_callback_user_favs_slug',  
  364. 'sanitize_callback' => 'bbp_sanitize_slug',  
  365. 'args' => array() 
  366. ),  
  367.  
  368. // Subscriptions slug setting 
  369. '_bbp_user_subs_slug' => array( 
  370. 'title' => __( 'Topic Subscriptions', 'bbpress' ),  
  371. 'callback' => 'bbp_admin_setting_callback_user_subs_slug',  
  372. 'sanitize_callback' => 'bbp_sanitize_slug',  
  373. 'args' => array() 
  374. ),  
  375.  
  376. /** BuddyPress ********************************************************/ 
  377.  
  378. 'bbp_settings_buddypress' => array( 
  379.  
  380. // Are group forums enabled? 
  381. '_bbp_enable_group_forums' => array( 
  382. 'title' => __( 'Enable Group Forums', 'bbpress' ),  
  383. 'callback' => 'bbp_admin_setting_callback_group_forums',  
  384. 'sanitize_callback' => 'intval',  
  385. 'args' => array() 
  386. ),  
  387.  
  388. // Group forums parent forum ID 
  389. '_bbp_group_forums_root_id' => array( 
  390. 'title' => __( 'Group Forums Parent', 'bbpress' ),  
  391. 'callback' => 'bbp_admin_setting_callback_group_forums_root_id',  
  392. 'sanitize_callback' => 'intval',  
  393. 'args' => array() 
  394. ),  
  395.  
  396. /** Akismet ***********************************************************/ 
  397.  
  398. 'bbp_settings_akismet' => array( 
  399.  
  400. // Should we use Akismet 
  401. '_bbp_enable_akismet' => array( 
  402. 'title' => __( 'Use Akismet', 'bbpress' ),  
  403. 'callback' => 'bbp_admin_setting_callback_akismet',  
  404. 'sanitize_callback' => 'intval',  
  405. 'args' => array() 
  406. ) ); 
  407.  
  408. /** 
  409. * Get settings fields by section. 
  410. * 
  411. * @since bbPress (r4001) 
  412. * @param string $section_id 
  413. * @return mixed False if section is invalid, array of fields otherwise. 
  414. */ 
  415. function bbp_admin_get_settings_fields_for_section( $section_id = '' ) { 
  416.  
  417. // Bail if section is empty 
  418. if ( empty( $section_id ) ) 
  419. return false; 
  420.  
  421. $fields = bbp_admin_get_settings_fields(); 
  422. $retval = isset( $fields[$section_id] ) ? $fields[$section_id] : false; 
  423.  
  424. return (array) apply_filters( 'bbp_admin_get_settings_fields_for_section', $retval, $section_id ); 
  425.  
  426. /** User Section **************************************************************/ 
  427.  
  428. /** 
  429. * User settings section description for the settings page 
  430. * 
  431. * @since bbPress (r2786) 
  432. */ 
  433. function bbp_admin_setting_callback_user_section() { 
  434. ?> 
  435.  
  436. <p><?php esc_html_e( 'Setting time limits and other user posting capabilities', 'bbpress' ); ?></p> 
  437.  
  438. <?php 
  439.  
  440.  
  441. /** 
  442. * Edit lock setting field 
  443. * 
  444. * @since bbPress (r2737) 
  445. * 
  446. * @uses bbp_form_option() To output the option value 
  447. */ 
  448. function bbp_admin_setting_callback_editlock() { 
  449. ?> 
  450.  
  451. <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' ); ?> /> 
  452. <label for="_bbp_edit_lock"><?php esc_html_e( 'minutes', 'bbpress' ); ?></label> 
  453.  
  454. <?php 
  455.  
  456. /** 
  457. * Throttle setting field 
  458. * 
  459. * @since bbPress (r2737) 
  460. * 
  461. * @uses bbp_form_option() To output the option value 
  462. */ 
  463. function bbp_admin_setting_callback_throttle() { 
  464. ?> 
  465.  
  466. <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' ); ?> /> 
  467. <label for="_bbp_throttle_time"><?php esc_html_e( 'seconds', 'bbpress' ); ?></label> 
  468.  
  469. <?php 
  470.  
  471. /** 
  472. * Allow anonymous posting setting field 
  473. * 
  474. * @since bbPress (r2737) 
  475. * 
  476. * @uses checked() To display the checked attribute 
  477. */ 
  478. function bbp_admin_setting_callback_anonymous() { 
  479. ?> 
  480.  
  481. <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' ); ?> /> 
  482. <label for="_bbp_allow_anonymous"><?php esc_html_e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label> 
  483.  
  484. <?php 
  485.  
  486. /** 
  487. * Allow global access setting field 
  488. * 
  489. * @since bbPress (r3378) 
  490. * 
  491. * @uses checked() To display the checked attribute 
  492. */ 
  493. function bbp_admin_setting_callback_global_access() { 
  494.  
  495. // Get the default role once rather than loop repeatedly below 
  496. $default_role = bbp_get_default_role(); 
  497.  
  498. // Start the output buffer for the select dropdown 
  499. ob_start(); ?> 
  500.  
  501. </label> 
  502. <label for="_bbp_default_role"> 
  503. <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>> 
  504. <?php foreach ( bbp_get_dynamic_roles() as $role => $details ) : ?> 
  505.  
  506. <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option> 
  507.  
  508. <?php endforeach; ?> 
  509. </select> 
  510.  
  511. <?php $select = ob_get_clean(); ?> 
  512.  
  513. <label for="_bbp_allow_global_access"> 
  514. <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' ); ?> /> 
  515. <?php printf( esc_html__( 'Automatically give registered visitors the %s forum role', 'bbpress' ), $select ); ?> 
  516. </label> 
  517.  
  518. <?php 
  519.  
  520. /** Features Section **********************************************************/ 
  521.  
  522. /** 
  523. * Features settings section description for the settings page 
  524. * 
  525. * @since bbPress (r2786) 
  526. */ 
  527. function bbp_admin_setting_callback_features_section() { 
  528. ?> 
  529.  
  530. <p><?php esc_html_e( 'Forum features that can be toggled on and off', 'bbpress' ); ?></p> 
  531.  
  532. <?php 
  533.  
  534. /** 
  535. * Allow favorites setting field 
  536. * 
  537. * @since bbPress (r2786) 
  538. * 
  539. * @uses checked() To display the checked attribute 
  540. */ 
  541. function bbp_admin_setting_callback_favorites() { 
  542. ?> 
  543.  
  544. <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' ); ?> /> 
  545. <label for="_bbp_enable_favorites"><?php esc_html_e( 'Allow users to mark topics as favorites', 'bbpress' ); ?></label> 
  546.  
  547. <?php 
  548.  
  549. /** 
  550. * Allow subscriptions setting field 
  551. * 
  552. * @since bbPress (r2737) 
  553. * 
  554. * @uses checked() To display the checked attribute 
  555. */ 
  556. function bbp_admin_setting_callback_subscriptions() { 
  557. ?> 
  558.  
  559. <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' ); ?> /> 
  560. <label for="_bbp_enable_subscriptions"><?php esc_html_e( 'Allow users to subscribe to forums and topics', 'bbpress' ); ?></label> 
  561.  
  562. <?php 
  563.  
  564. /** 
  565. * Allow topic tags setting field 
  566. * 
  567. * @since bbPress (r4944) 
  568. * 
  569. * @uses checked() To display the checked attribute 
  570. */ 
  571. function bbp_admin_setting_callback_topic_tags() { 
  572. ?> 
  573.  
  574. <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' ); ?> /> 
  575. <label for="_bbp_allow_topic_tags"><?php esc_html_e( 'Allow topics to have tags', 'bbpress' ); ?></label> 
  576.  
  577. <?php 
  578.  
  579. /** 
  580. * Allow forum wide search 
  581. * 
  582. * @since bbPress (r4970) 
  583. * 
  584. * @uses checked() To display the checked attribute 
  585. */ 
  586. function bbp_admin_setting_callback_search() { 
  587. ?> 
  588.  
  589. <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' ); ?> /> 
  590. <label for="_bbp_allow_search"><?php esc_html_e( 'Allow forum wide search', 'bbpress' ); ?></label> 
  591.  
  592. <?php 
  593.  
  594. /** 
  595. * Hierarchical reply maximum depth level setting field 
  596. * 
  597. * Replies will be threaded if depth is 2 or greater 
  598. * 
  599. * @since bbPress (r4944) 
  600. * 
  601. * @uses apply_filters() Calls 'bbp_thread_replies_depth_max' to set a 
  602. * maximum displayed level 
  603. * @uses selected() To display the selected attribute 
  604. */ 
  605. function bbp_admin_setting_callback_thread_replies_depth() { 
  606.  
  607. // Set maximum depth for dropdown 
  608. $max_depth = (int) apply_filters( 'bbp_thread_replies_depth_max', 10 ); 
  609. $current_depth = bbp_thread_replies_depth(); 
  610.  
  611. // Start an output buffer for the select dropdown 
  612. ob_start(); ?> 
  613.  
  614. </label> 
  615. <label for="_bbp_thread_replies_depth"> 
  616. <select name="_bbp_thread_replies_depth" id="_bbp_thread_replies_depth" <?php bbp_maybe_admin_setting_disabled( '_bbp_thread_replies_depth' ); ?>> 
  617. <?php for ( $i = 2; $i <= $max_depth; $i++ ) : ?> 
  618.  
  619. <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $current_depth ); ?>><?php echo esc_html( $i ); ?></option> 
  620.  
  621. <?php endfor; ?> 
  622. </select> 
  623.  
  624. <?php $select = ob_get_clean(); ?> 
  625.  
  626. <label for="_bbp_allow_threaded_replies"> 
  627. <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' ); ?> /> 
  628. <?php printf( esc_html__( 'Enable threaded (nested) replies %s levels deep', 'bbpress' ), $select ); ?> 
  629. </label> 
  630.  
  631. <?php 
  632.  
  633. /** 
  634. * Allow topic and reply revisions 
  635. * 
  636. * @since bbPress (r3412) 
  637. * 
  638. * @uses checked() To display the checked attribute 
  639. */ 
  640. function bbp_admin_setting_callback_revisions() { 
  641. ?> 
  642.  
  643. <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' ); ?> /> 
  644. <label for="_bbp_allow_revisions"><?php esc_html_e( 'Allow topic and reply revision logging', 'bbpress' ); ?></label> 
  645.  
  646. <?php 
  647.  
  648. /** 
  649. * Use the WordPress editor setting field 
  650. * 
  651. * @since bbPress (r3586) 
  652. * 
  653. * @uses checked() To display the checked attribute 
  654. */ 
  655. function bbp_admin_setting_callback_use_wp_editor() { 
  656. ?> 
  657.  
  658. <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' ); ?> /> 
  659. <label for="_bbp_use_wp_editor"><?php esc_html_e( 'Add toolbar & buttons to textareas to help with HTML formatting', 'bbpress' ); ?></label> 
  660.  
  661. <?php 
  662.  
  663. /** 
  664. * Main subtheme section 
  665. * 
  666. * @since bbPress (r2786) 
  667. */ 
  668. function bbp_admin_setting_callback_subtheme_section() { 
  669. ?> 
  670.  
  671. <p><?php esc_html_e( 'How your forum content is displayed within your existing theme.', 'bbpress' ); ?></p> 
  672.  
  673. <?php 
  674.  
  675. /** 
  676. * Use the WordPress editor setting field 
  677. * 
  678. * @since bbPress (r3586) 
  679. * 
  680. * @uses checked() To display the checked attribute 
  681. */ 
  682. function bbp_admin_setting_callback_subtheme_id() { 
  683.  
  684. // Declare locale variable 
  685. $theme_options = ''; 
  686. $current_package = bbp_get_theme_package_id( 'default' ); 
  687.  
  688. // Note: This should never be empty. /templates/ is the 
  689. // canonical backup if no other packages exist. If there's an error here,  
  690. // something else is wrong. 
  691. // 
  692. // @see bbPress::register_theme_packages() 
  693. foreach ( (array) bbpress()->theme_compat->packages as $id => $theme ) { 
  694. $theme_options .= '<option value="' . esc_attr( $id ) . '"' . selected( $theme->id, $current_package, false ) . '>' . sprintf( esc_html__( '%1$s - %2$s', 'bbpress' ), esc_html( $theme->name ), esc_html( str_replace( WP_CONTENT_DIR, '', $theme->dir ) ) ) . '</option>'; 
  695.  
  696. if ( !empty( $theme_options ) ) : ?> 
  697.  
  698. <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> 
  699. <label for="_bbp_theme_package_id"><?php esc_html_e( 'will serve all bbPress templates', 'bbpress' ); ?></label> 
  700.  
  701. <?php else : ?> 
  702.  
  703. <p><?php esc_html_e( 'No template packages available.', 'bbpress' ); ?></p> 
  704.  
  705. <?php endif; 
  706.  
  707. /** 
  708. * Allow oEmbed in replies 
  709. * 
  710. * @since bbPress (r3752) 
  711. * 
  712. * @uses checked() To display the checked attribute 
  713. */ 
  714. function bbp_admin_setting_callback_use_autoembed() { 
  715. ?> 
  716.  
  717. <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' ); ?> /> 
  718. <label for="_bbp_use_autoembed"><?php esc_html_e( 'Embed media (YouTube, Twitter, Flickr, etc...) directly into topics and replies', 'bbpress' ); ?></label> 
  719.  
  720. <?php 
  721.  
  722. /** Per Page Section **********************************************************/ 
  723.  
  724. /** 
  725. * Per page settings section description for the settings page 
  726. * 
  727. * @since bbPress (r2786) 
  728. */ 
  729. function bbp_admin_setting_callback_per_page_section() { 
  730. ?> 
  731.  
  732. <p><?php esc_html_e( 'How many topics and replies to show per page', 'bbpress' ); ?></p> 
  733.  
  734. <?php 
  735.  
  736. /** 
  737. * Topics per page setting field 
  738. * 
  739. * @since bbPress (r2786) 
  740. * 
  741. * @uses bbp_form_option() To output the option value 
  742. */ 
  743. function bbp_admin_setting_callback_topics_per_page() { 
  744. ?> 
  745.  
  746. <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' ); ?> /> 
  747. <label for="_bbp_topics_per_page"><?php esc_html_e( 'per page', 'bbpress' ); ?></label> 
  748.  
  749. <?php 
  750.  
  751. /** 
  752. * Replies per page setting field 
  753. * 
  754. * @since bbPress (r2786) 
  755. * 
  756. * @uses bbp_form_option() To output the option value 
  757. */ 
  758. function bbp_admin_setting_callback_replies_per_page() { 
  759. ?> 
  760.  
  761. <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' ); ?> /> 
  762. <label for="_bbp_replies_per_page"><?php esc_html_e( 'per page', 'bbpress' ); ?></label> 
  763.  
  764. <?php 
  765.  
  766. /** Per RSS Page Section ******************************************************/ 
  767.  
  768. /** 
  769. * Per page settings section description for the settings page 
  770. * 
  771. * @since bbPress (r2786) 
  772. */ 
  773. function bbp_admin_setting_callback_per_rss_page_section() { 
  774. ?> 
  775.  
  776. <p><?php esc_html_e( 'How many topics and replies to show per RSS page', 'bbpress' ); ?></p> 
  777.  
  778. <?php 
  779.  
  780. /** 
  781. * Topics per RSS page setting field 
  782. * 
  783. * @since bbPress (r2786) 
  784. * 
  785. * @uses bbp_form_option() To output the option value 
  786. */ 
  787. function bbp_admin_setting_callback_topics_per_rss_page() { 
  788. ?> 
  789.  
  790. <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' ); ?> /> 
  791. <label for="_bbp_topics_per_rss_page"><?php esc_html_e( 'per page', 'bbpress' ); ?></label> 
  792.  
  793. <?php 
  794.  
  795. /** 
  796. * Replies per RSS page setting field 
  797. * 
  798. * @since bbPress (r2786) 
  799. * 
  800. * @uses bbp_form_option() To output the option value 
  801. */ 
  802. function bbp_admin_setting_callback_replies_per_rss_page() { 
  803. ?> 
  804.  
  805. <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' ); ?> /> 
  806. <label for="_bbp_replies_per_rss_page"><?php esc_html_e( 'per page', 'bbpress' ); ?></label> 
  807.  
  808. <?php 
  809.  
  810. /** Slug Section **************************************************************/ 
  811.  
  812. /** 
  813. * Slugs settings section description for the settings page 
  814. * 
  815. * @since bbPress (r2786) 
  816. */ 
  817. function bbp_admin_setting_callback_root_slug_section() { 
  818.  
  819. // Flush rewrite rules when this section is saved 
  820. if ( isset( $_GET['settings-updated'] ) && isset( $_GET['page'] ) ) 
  821. flush_rewrite_rules(); ?> 
  822.  
  823. <p><?php esc_html_e( 'Customize your Forums root. Partner with a WordPress Page and use Shortcodes for more flexibility.', 'bbpress' ); ?></p> 
  824.  
  825. <?php 
  826.  
  827. /** 
  828. * Root slug setting field 
  829. * 
  830. * @since bbPress (r2786) 
  831. * 
  832. * @uses bbp_form_option() To output the option value 
  833. */ 
  834. function bbp_admin_setting_callback_root_slug() { 
  835. ?> 
  836.  
  837. <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' ); ?> /> 
  838.  
  839. <?php 
  840. // Slug Check 
  841. bbp_form_slug_conflict_check( '_bbp_root_slug', 'forums' ); 
  842.  
  843. /** 
  844. * Include root slug setting field 
  845. * 
  846. * @since bbPress (r2786) 
  847. * 
  848. * @uses checked() To display the checked attribute 
  849. */ 
  850. function bbp_admin_setting_callback_include_root() { 
  851. ?> 
  852.  
  853. <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' ); ?> /> 
  854. <label for="_bbp_include_root"><?php esc_html_e( 'Prefix all forum content with the Forum Root slug (Recommended)', 'bbpress' ); ?></label> 
  855.  
  856. <?php 
  857.  
  858. /** 
  859. * Include root slug setting field 
  860. * 
  861. * @since bbPress (r2786) 
  862. * 
  863. * @uses checked() To display the checked attribute 
  864. */ 
  865. function bbp_admin_setting_callback_show_on_root() { 
  866.  
  867. // Current setting 
  868. $show_on_root = bbp_show_on_root(); 
  869.  
  870. // Options for forum root output 
  871. $root_options = array( 
  872. 'forums' => array( 
  873. 'name' => __( 'Forum Index', 'bbpress' ) 
  874. ),  
  875. 'topics' => array( 
  876. 'name' => __( 'Topics by Freshness', 'bbpress' ) 
  877. ); ?> 
  878.  
  879. <select name="_bbp_show_on_root" id="_bbp_show_on_root" <?php bbp_maybe_admin_setting_disabled( '_bbp_show_on_root' ); ?>> 
  880.  
  881. <?php foreach ( $root_options as $option_id => $details ) : ?> 
  882.  
  883. <option <?php selected( $show_on_root, $option_id ); ?> value="<?php echo esc_attr( $option_id ); ?>"><?php echo esc_html( $details['name'] ); ?></option> 
  884.  
  885. <?php endforeach; ?> 
  886.  
  887. </select> 
  888.  
  889. <?php 
  890.  
  891. /** User Slug Section *********************************************************/ 
  892.  
  893. /** 
  894. * Slugs settings section description for the settings page 
  895. * 
  896. * @since bbPress (r2786) 
  897. */ 
  898. function bbp_admin_setting_callback_user_slug_section() { 
  899. ?> 
  900.  
  901. <p><?php esc_html_e( 'Customize your user profile slugs.', 'bbpress' ); ?></p> 
  902.  
  903. <?php 
  904.  
  905. /** 
  906. * User slug setting field 
  907. * 
  908. * @since bbPress (r2786) 
  909. * 
  910. * @uses bbp_form_option() To output the option value 
  911. */ 
  912. function bbp_admin_setting_callback_user_slug() { 
  913. ?> 
  914.  
  915. <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' ); ?> /> 
  916.  
  917. <?php 
  918. // Slug Check 
  919. bbp_form_slug_conflict_check( '_bbp_user_slug', 'users' ); 
  920.  
  921. /** 
  922. * Topic archive slug setting field 
  923. * 
  924. * @since bbPress (r2786) 
  925. * 
  926. * @uses bbp_form_option() To output the option value 
  927. */ 
  928. function bbp_admin_setting_callback_topic_archive_slug() { 
  929. ?> 
  930.  
  931. <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' ); ?> /> 
  932.  
  933. <?php 
  934. // Slug Check 
  935. bbp_form_slug_conflict_check( '_bbp_topic_archive_slug', 'topics' ); 
  936.  
  937. /** 
  938. * Reply archive slug setting field 
  939. * 
  940. * @since bbPress (r4932) 
  941. * 
  942. * @uses bbp_form_option() To output the option value 
  943. */ 
  944. function bbp_admin_setting_callback_reply_archive_slug() { 
  945. ?> 
  946.  
  947. <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' ); ?> /> 
  948.  
  949. <?php 
  950. // Slug Check 
  951. bbp_form_slug_conflict_check( '_bbp_reply_archive_slug', 'replies' ); 
  952.  
  953. /** 
  954. * Favorites slug setting field 
  955. * 
  956. * @since bbPress (r4932) 
  957. * 
  958. * @uses bbp_form_option() To output the option value 
  959. */ 
  960. function bbp_admin_setting_callback_user_favs_slug() { 
  961. ?> 
  962.  
  963. <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' ); ?> /> 
  964.  
  965. <?php 
  966. // Slug Check 
  967. bbp_form_slug_conflict_check( '_bbp_reply_archive_slug', 'favorites' ); 
  968.  
  969. /** 
  970. * Favorites slug setting field 
  971. * 
  972. * @since bbPress (r4932) 
  973. * 
  974. * @uses bbp_form_option() To output the option value 
  975. */ 
  976. function bbp_admin_setting_callback_user_subs_slug() { 
  977. ?> 
  978.  
  979. <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' ); ?> /> 
  980.  
  981. <?php 
  982. // Slug Check 
  983. bbp_form_slug_conflict_check( '_bbp_user_subs_slug', 'subscriptions' ); 
  984.  
  985. /** Single Slugs **************************************************************/ 
  986.  
  987. /** 
  988. * Slugs settings section description for the settings page 
  989. * 
  990. * @since bbPress (r2786) 
  991. */ 
  992. function bbp_admin_setting_callback_single_slug_section() { 
  993. ?> 
  994.  
  995. <p><?php printf( esc_html__( 'Custom slugs for single forums, topics, replies, tags, views, and search.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p> 
  996.  
  997. <?php 
  998.  
  999. /** 
  1000. * Forum slug setting field 
  1001. * 
  1002. * @since bbPress (r2786) 
  1003. * 
  1004. * @uses bbp_form_option() To output the option value 
  1005. */ 
  1006. function bbp_admin_setting_callback_forum_slug() { 
  1007. ?> 
  1008.  
  1009. <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' ); ?> /> 
  1010.  
  1011. <?php 
  1012. // Slug Check 
  1013. bbp_form_slug_conflict_check( '_bbp_forum_slug', 'forum' ); 
  1014.  
  1015. /** 
  1016. * Topic slug setting field 
  1017. * 
  1018. * @since bbPress (r2786) 
  1019. * 
  1020. * @uses bbp_form_option() To output the option value 
  1021. */ 
  1022. function bbp_admin_setting_callback_topic_slug() { 
  1023. ?> 
  1024.  
  1025. <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' ); ?> /> 
  1026.  
  1027. <?php 
  1028. // Slug Check 
  1029. bbp_form_slug_conflict_check( '_bbp_topic_slug', 'topic' ); 
  1030.  
  1031. /** 
  1032. * Reply slug setting field 
  1033. * 
  1034. * @since bbPress (r2786) 
  1035. * 
  1036. * @uses bbp_form_option() To output the option value 
  1037. */ 
  1038. function bbp_admin_setting_callback_reply_slug() { 
  1039. ?> 
  1040.  
  1041. <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' ); ?> /> 
  1042.  
  1043. <?php 
  1044. // Slug Check 
  1045. bbp_form_slug_conflict_check( '_bbp_reply_slug', 'reply' ); 
  1046.  
  1047. /** 
  1048. * Topic tag slug setting field 
  1049. * 
  1050. * @since bbPress (r2786) 
  1051. * 
  1052. * @uses bbp_form_option() To output the option value 
  1053. */ 
  1054. function bbp_admin_setting_callback_topic_tag_slug() { 
  1055. ?> 
  1056.  
  1057. <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' ); ?> /> 
  1058.  
  1059. <?php 
  1060.  
  1061. // Slug Check 
  1062. bbp_form_slug_conflict_check( '_bbp_topic_tag_slug', 'topic-tag' ); 
  1063.  
  1064. /** 
  1065. * View slug setting field 
  1066. * 
  1067. * @since bbPress (r2789) 
  1068. * 
  1069. * @uses bbp_form_option() To output the option value 
  1070. */ 
  1071. function bbp_admin_setting_callback_view_slug() { 
  1072. ?> 
  1073.  
  1074. <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' ); ?> /> 
  1075.  
  1076. <?php 
  1077. // Slug Check 
  1078. bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' ); 
  1079.  
  1080. /** 
  1081. * Search slug setting field 
  1082. * 
  1083. * @since bbPress (r4579) 
  1084. * 
  1085. * @uses bbp_form_option() To output the option value 
  1086. */ 
  1087. function bbp_admin_setting_callback_search_slug() { 
  1088. ?> 
  1089.  
  1090. <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' ); ?> /> 
  1091.  
  1092. <?php 
  1093. // Slug Check 
  1094. bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' ); 
  1095.  
  1096. /** BuddyPress ****************************************************************/ 
  1097.  
  1098. /** 
  1099. * Extension settings section description for the settings page 
  1100. * 
  1101. * @since bbPress (r3575) 
  1102. */ 
  1103. function bbp_admin_setting_callback_buddypress_section() { 
  1104. ?> 
  1105.  
  1106. <p><?php esc_html_e( 'Forum settings for BuddyPress', 'bbpress' ); ?></p> 
  1107.  
  1108. <?php 
  1109.  
  1110. /** 
  1111. * Allow BuddyPress group forums setting field 
  1112. * 
  1113. * @since bbPress (r3575) 
  1114. * 
  1115. * @uses checked() To display the checked attribute 
  1116. */ 
  1117. function bbp_admin_setting_callback_group_forums() { 
  1118. ?> 
  1119.  
  1120. <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' ); ?> /> 
  1121. <label for="_bbp_enable_group_forums"><?php esc_html_e( 'Allow BuddyPress Groups to have their own forums', 'bbpress' ); ?></label> 
  1122.  
  1123. <?php 
  1124.  
  1125. /** 
  1126. * Replies per page setting field 
  1127. * 
  1128. * @since bbPress (r3575) 
  1129. * 
  1130. * @uses bbp_form_option() To output the option value 
  1131. */ 
  1132. function bbp_admin_setting_callback_group_forums_root_id() { 
  1133.  
  1134. // Output the dropdown for all forums 
  1135. bbp_dropdown( array( 
  1136. 'selected' => bbp_get_group_forums_root_id(),  
  1137. 'show_none' => __( '— Forum root —', 'bbpress' ),  
  1138. 'orderby' => 'title',  
  1139. 'order' => 'ASC',  
  1140. 'select_id' => '_bbp_group_forums_root_id',  
  1141. 'disable_categories' => false,  
  1142. 'disabled' => '_bbp_group_forums_root_id' 
  1143. ) ); ?> 
  1144.  
  1145. <label for="_bbp_group_forums_root_id"><?php esc_html_e( 'is the parent for all group forums', 'bbpress' ); ?></label> 
  1146. <p class="description"><?php esc_html_e( 'Using the Forum Root is not recommended. Changing this does not move existing forums.', 'bbpress' ); ?></p> 
  1147.  
  1148. <?php 
  1149.  
  1150. /** Akismet *******************************************************************/ 
  1151.  
  1152. /** 
  1153. * Extension settings section description for the settings page 
  1154. * 
  1155. * @since bbPress (r3575) 
  1156. */ 
  1157. function bbp_admin_setting_callback_akismet_section() { 
  1158. ?> 
  1159.  
  1160. <p><?php esc_html_e( 'Forum settings for Akismet', 'bbpress' ); ?></p> 
  1161.  
  1162. <?php 
  1163.  
  1164.  
  1165. /** 
  1166. * Allow Akismet setting field 
  1167. * 
  1168. * @since bbPress (r3575) 
  1169. * 
  1170. * @uses checked() To display the checked attribute 
  1171. */ 
  1172. function bbp_admin_setting_callback_akismet() { 
  1173. ?> 
  1174.  
  1175. <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' ); ?> /> 
  1176. <label for="_bbp_enable_akismet"><?php esc_html_e( 'Allow Akismet to actively prevent forum spam.', 'bbpress' ); ?></label> 
  1177.  
  1178. <?php 
  1179.  
  1180. /** Settings Page *************************************************************/ 
  1181.  
  1182. /** 
  1183. * The main settings page 
  1184. * 
  1185. * @since bbPress (r2643) 
  1186. * 
  1187. * @uses screen_icon() To display the screen icon 
  1188. * @uses settings_fields() To output the hidden fields for the form 
  1189. * @uses do_settings_sections() To output the settings sections 
  1190. */ 
  1191. function bbp_admin_settings() { 
  1192. ?> 
  1193.  
  1194. <div class="wrap"> 
  1195.  
  1196. <?php screen_icon(); ?> 
  1197.  
  1198. <h2><?php esc_html_e( 'Forums Settings', 'bbpress' ) ?></h2> 
  1199.  
  1200. <form action="options.php" method="post"> 
  1201.  
  1202. <?php settings_fields( 'bbpress' ); ?> 
  1203.  
  1204. <?php do_settings_sections( 'bbpress' ); ?> 
  1205.  
  1206. <p class="submit"> 
  1207. <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'bbpress' ); ?>" /> 
  1208. </p> 
  1209. </form> 
  1210. </div> 
  1211.  
  1212. <?php 
  1213.  
  1214.  
  1215. /** Converter Section *********************************************************/ 
  1216.  
  1217. /** 
  1218. * Main settings section description for the settings page 
  1219. * 
  1220. * @since bbPress (r3813) 
  1221. */ 
  1222. function bbp_converter_setting_callback_main_section() { 
  1223. ?> 
  1224.  
  1225. <p><?php _e( 'Information about your previous forums database so that they can be converted. <strong>Backup your database before proceeding.</strong>', 'bbpress' ); ?></p> 
  1226.  
  1227. <?php 
  1228.  
  1229. /** 
  1230. * Edit Platform setting field 
  1231. * 
  1232. * @since bbPress (r3813) 
  1233. */ 
  1234. function bbp_converter_setting_callback_platform() { 
  1235.  
  1236. $platform_options = ''; 
  1237. $curdir = opendir( bbpress()->admin->admin_dir . 'converters/' ); 
  1238.  
  1239. // Bail if no directory was found (how did this happen?) 
  1240. if ( empty( $curdir ) ) 
  1241. return; 
  1242.  
  1243. // Loop through files in the converters folder and assemble some options 
  1244. while ( $file = readdir( $curdir ) ) { 
  1245. if ( ( stristr( $file, '.php' ) ) && ( stristr( $file, 'index' ) === false ) ) { 
  1246. $file = preg_replace( '/.php/', '', $file ); 
  1247. $platform_options .= '<option value="' . $file . '">' . esc_html( $file ) . '</option>'; 
  1248.  
  1249. closedir( $curdir ); ?> 
  1250.  
  1251. <select name="_bbp_converter_platform" id="_bbp_converter_platform" /><?php echo $platform_options ?></select> 
  1252. <label for="_bbp_converter_platform"><?php esc_html_e( 'is the previous forum software', 'bbpress' ); ?></label> 
  1253.  
  1254. <?php 
  1255.  
  1256. /** 
  1257. * Edit Database Server setting field 
  1258. * 
  1259. * @since bbPress (r3813) 
  1260. */ 
  1261. function bbp_converter_setting_callback_dbserver() { 
  1262. ?> 
  1263.  
  1264. <input name="_bbp_converter_db_server" id="_bbp_converter_db_server" type="text" value="<?php bbp_form_option( '_bbp_converter_db_server', 'localhost' ); ?>" class="medium-text" /> 
  1265. <label for="_bbp_converter_db_server"><?php esc_html_e( 'IP or hostname', 'bbpress' ); ?></label> 
  1266.  
  1267. <?php 
  1268.  
  1269. /** 
  1270. * Edit Database Server Port setting field 
  1271. * 
  1272. * @since bbPress (r3813) 
  1273. */ 
  1274. function bbp_converter_setting_callback_dbport() { 
  1275. ?> 
  1276.  
  1277. <input name="_bbp_converter_db_port" id="_bbp_converter_db_port" type="text" value="<?php bbp_form_option( '_bbp_converter_db_port', '3306' ); ?>" class="small-text" /> 
  1278. <label for="_bbp_converter_db_port"><?php esc_html_e( 'Use default 3306 if unsure', 'bbpress' ); ?></label> 
  1279.  
  1280. <?php 
  1281.  
  1282. /** 
  1283. * Edit Database User setting field 
  1284. * 
  1285. * @since bbPress (r3813) 
  1286. */ 
  1287. function bbp_converter_setting_callback_dbuser() { 
  1288. ?> 
  1289.  
  1290. <input name="_bbp_converter_db_user" id="_bbp_converter_db_user" type="text" value="<?php bbp_form_option( '_bbp_converter_db_user' ); ?>" class="medium-text" /> 
  1291. <label for="_bbp_converter_db_user"><?php esc_html_e( 'User for your database connection', 'bbpress' ); ?></label> 
  1292.  
  1293. <?php 
  1294.  
  1295. /** 
  1296. * Edit Database Pass setting field 
  1297. * 
  1298. * @since bbPress (r3813) 
  1299. */ 
  1300. function bbp_converter_setting_callback_dbpass() { 
  1301. ?> 
  1302.  
  1303. <input name="_bbp_converter_db_pass" id="_bbp_converter_db_pass" type="password" value="<?php bbp_form_option( '_bbp_converter_db_pass' ); ?>" class="medium-text" /> 
  1304. <label for="_bbp_converter_db_pass"><?php esc_html_e( 'Password to access the database', 'bbpress' ); ?></label> 
  1305.  
  1306. <?php 
  1307.  
  1308. /** 
  1309. * Edit Database Name setting field 
  1310. * 
  1311. * @since bbPress (r3813) 
  1312. */ 
  1313. function bbp_converter_setting_callback_dbname() { 
  1314. ?> 
  1315.  
  1316. <input name="_bbp_converter_db_name" id="_bbp_converter_db_name" type="text" value="<?php bbp_form_option( '_bbp_converter_db_name' ); ?>" class="medium-text" /> 
  1317. <label for="_bbp_converter_db_name"><?php esc_html_e( 'Name of the database with your old forum data', 'bbpress' ); ?></label> 
  1318.  
  1319. <?php 
  1320.  
  1321. /** 
  1322. * Main settings section description for the settings page 
  1323. * 
  1324. * @since bbPress (r3813) 
  1325. */ 
  1326. function bbp_converter_setting_callback_options_section() { 
  1327. ?> 
  1328.  
  1329. <p><?php esc_html_e( 'Some optional parameters to help tune the conversion process.', 'bbpress' ); ?></p> 
  1330.  
  1331. <?php 
  1332.  
  1333. /** 
  1334. * Edit Table Prefix setting field 
  1335. * 
  1336. * @since bbPress (r3813) 
  1337. */ 
  1338. function bbp_converter_setting_callback_dbprefix() { 
  1339. ?> 
  1340.  
  1341. <input name="_bbp_converter_db_prefix" id="_bbp_converter_db_prefix" type="text" value="<?php bbp_form_option( '_bbp_converter_db_prefix' ); ?>" class="medium-text" /> 
  1342. <label for="_bbp_converter_db_prefix"><?php esc_html_e( '(If converting from BuddyPress Forums, use "wp_bb_" or your custom prefix)', 'bbpress' ); ?></label> 
  1343.  
  1344. <?php 
  1345.  
  1346. /** 
  1347. * Edit Rows Limit setting field 
  1348. * 
  1349. * @since bbPress (r3813) 
  1350. */ 
  1351. function bbp_converter_setting_callback_rows() { 
  1352. ?> 
  1353.  
  1354. <input name="_bbp_converter_rows" id="_bbp_converter_rows" type="text" value="<?php bbp_form_option( '_bbp_converter_rows', '100' ); ?>" class="small-text" /> 
  1355. <label for="_bbp_converter_rows"><?php esc_html_e( 'rows to process at a time', 'bbpress' ); ?></label> 
  1356. <p class="description"><?php esc_html_e( 'Keep this low if you experience out-of-memory issues.', 'bbpress' ); ?></p> 
  1357.  
  1358. <?php 
  1359.  
  1360. /** 
  1361. * Edit Delay Time setting field 
  1362. * 
  1363. * @since bbPress (r3813) 
  1364. */ 
  1365. function bbp_converter_setting_callback_delay_time() { 
  1366. ?> 
  1367.  
  1368. <input name="_bbp_converter_delay_time" id="_bbp_converter_delay_time" type="text" value="<?php bbp_form_option( '_bbp_converter_delay_time', '1' ); ?>" class="small-text" /> 
  1369. <label for="_bbp_converter_delay_time"><?php esc_html_e( 'second(s) delay between each group of rows', 'bbpress' ); ?></label> 
  1370. <p class="description"><?php esc_html_e( 'Keep this high to prevent too-many-connection issues.', 'bbpress' ); ?></p> 
  1371.  
  1372. <?php 
  1373.  
  1374. /** 
  1375. * Edit Restart setting field 
  1376. * 
  1377. * @since bbPress (r3813) 
  1378. */ 
  1379. function bbp_converter_setting_callback_restart() { 
  1380. ?> 
  1381.  
  1382. <input name="_bbp_converter_restart" id="_bbp_converter_restart" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> /> 
  1383. <label for="_bbp_converter_restart"><?php esc_html_e( 'Start a fresh conversion from the beginning', 'bbpress' ); ?></label> 
  1384. <p class="description"><?php esc_html_e( 'You should clean old conversion information before starting over.', 'bbpress' ); ?></p> 
  1385.  
  1386. <?php 
  1387.  
  1388. /** 
  1389. * Edit Clean setting field 
  1390. * 
  1391. * @since bbPress (r3813) 
  1392. */ 
  1393. function bbp_converter_setting_callback_clean() { 
  1394. ?> 
  1395.  
  1396. <input name="_bbp_converter_clean" id="_bbp_converter_clean" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_clean', false ) ); ?> /> 
  1397. <label for="_bbp_converter_clean"><?php esc_html_e( 'Purge all information from a previously attempted import', 'bbpress' ); ?></label> 
  1398. <p class="description"><?php esc_html_e( 'Use this if an import failed and you want to remove that incomplete data.', 'bbpress' ); ?></p> 
  1399.  
  1400. <?php 
  1401.  
  1402. /** 
  1403. * Edit Convert Users setting field 
  1404. * 
  1405. * @since bbPress (r3813) 
  1406. */ 
  1407. function bbp_converter_setting_callback_convert_users() { 
  1408. ?> 
  1409.  
  1410. <input name="_bbp_converter_convert_users" id="_bbp_converter_convert_users" type="checkbox" value="1" <?php checked( get_option( '_bbp_converter_convert_users', false ) ); ?> /> 
  1411. <label for="_bbp_converter_convert_users"><?php esc_html_e( 'Attempt to import user accounts from previous forums', 'bbpress' ); ?></label> 
  1412. <p class="description"><?php esc_html_e( 'Non-bbPress passwords cannot be automatically converted. They will be converted as each user logs in.', 'bbpress' ); ?></p> 
  1413.  
  1414. <?php 
  1415.  
  1416. /** Converter Page ************************************************************/ 
  1417.  
  1418. /** 
  1419. * The main settings page 
  1420. * 
  1421. * @uses screen_icon() To display the screen icon 
  1422. * @uses settings_fields() To output the hidden fields for the form 
  1423. * @uses do_settings_sections() To output the settings sections 
  1424. */ 
  1425. function bbp_converter_settings() { 
  1426. ?> 
  1427.  
  1428. <div class="wrap"> 
  1429.  
  1430. <?php screen_icon( 'tools' ); ?> 
  1431.  
  1432. <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( esc_html__( 'Import Forums', 'bbpress' ) ); ?></h2> 
  1433.  
  1434. <form action="#" method="post" id="bbp-converter-settings"> 
  1435.  
  1436. <?php settings_fields( 'bbpress_converter' ); ?> 
  1437.  
  1438. <?php do_settings_sections( 'bbpress_converter' ); ?> 
  1439.  
  1440. <p class="submit"> 
  1441. <input type="button" name="submit" class="button-primary" id="bbp-converter-start" value="<?php esc_attr_e( 'Start', 'bbpress' ); ?>" onclick="bbconverter_start();" /> 
  1442. <input type="button" name="submit" class="button-primary" id="bbp-converter-stop" value="<?php esc_attr_e( 'Stop', 'bbpress' ); ?>" onclick="bbconverter_stop();" /> 
  1443. <img id="bbp-converter-progress" src=""> 
  1444. </p> 
  1445.  
  1446. <div class="bbp-converter-updated" id="bbp-converter-message"></div> 
  1447. </form> 
  1448. </div> 
  1449.  
  1450. <?php 
  1451.  
  1452. /** Helpers *******************************************************************/ 
  1453.  
  1454. /** 
  1455. * Contextual help for Forums settings page 
  1456. * 
  1457. * @since bbPress (r3119) 
  1458. * @uses get_current_screen() 
  1459. */ 
  1460. function bbp_admin_settings_help() { 
  1461.  
  1462. $current_screen = get_current_screen(); 
  1463.  
  1464. // Bail if current screen could not be found 
  1465. if ( empty( $current_screen ) ) 
  1466. return; 
  1467.  
  1468. // Overview 
  1469. $current_screen->add_help_tab( array( 
  1470. 'id' => 'overview',  
  1471. 'title' => __( 'Overview', 'bbpress' ),  
  1472. 'content' => '<p>' . __( 'This screen provides access to all of the Forums settings.', 'bbpress' ) . '</p>' . 
  1473. '<p>' . __( 'Please see the additional help tabs for more information on each indiviual section.', 'bbpress' ) . '</p>' 
  1474. ) ); 
  1475.  
  1476. // Main Settings 
  1477. $current_screen->add_help_tab( array( 
  1478. 'id' => 'main_settings',  
  1479. 'title' => __( 'Main Settings', 'bbpress' ),  
  1480. 'content' => '<p>' . __( 'In the Main Settings you have a number of options:', 'bbpress' ) . '</p>' . 
  1481. '<p>' . 
  1482. '<ul>' . 
  1483. '<li>' . __( '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>' . 
  1484. '<li>' . __( '"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>' . 
  1485. '<li>' . __( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.', 'bbpress' ) . '</li>' . 
  1486. '<li>' . __( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.', 'bbpress' ) . '</li>' . 
  1487. '<li>' . __( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.', 'bbpress' ) . '</li>' . 
  1488. '<li>' . __( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.', 'bbpress' ) . '</li>' . 
  1489. '<li>' . __( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.', 'bbpress' ) . '</li>' . 
  1490. '<li>' . __( 'Auto-embed will embed the media content from a URL directly into the replies. For example: links to Flickr and YouTube.', 'bbpress' ) . '</li>' . 
  1491. '</ul>' . 
  1492. '</p>' . 
  1493. '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>' 
  1494. ) ); 
  1495.  
  1496. // Per Page 
  1497. $current_screen->add_help_tab( array( 
  1498. 'id' => 'per_page',  
  1499. 'title' => __( 'Per Page', 'bbpress' ),  
  1500. 'content' => '<p>' . __( 'Per Page settings allow you to control the number of topics and replies appear on each page.', 'bbpress' ) . '</p>' . 
  1501. '<p>' . __( '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' ) . '</p>' . 
  1502. '<p>' . __( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.', 'bbpress' ) . '</p>' 
  1503. ) ); 
  1504.  
  1505. // Slugs 
  1506. $current_screen->add_help_tab( array( 
  1507. 'id' => 'slus',  
  1508. 'title' => __( 'Slugs', 'bbpress' ),  
  1509. 'content' => '<p>' . __( 'The Slugs section allows you to control the permalink structure for your forums.', 'bbpress' ) . '</p>' . 
  1510. '<p>' . __( '"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' ) . '</p>' . 
  1511. '<p>' . __( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.', 'bbpress' ) . '</p>' . 
  1512. '<p>' . __( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</p>' 
  1513. ) ); 
  1514.  
  1515. // Help Sidebar 
  1516. $current_screen->set_help_sidebar( 
  1517. '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' . 
  1518. '<p>' . __( '<a href="http://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' . 
  1519. '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>' 
  1520. ); 
  1521.  
  1522. /** 
  1523. * Disable a settings field if the value is forcibly set in bbPress's global 
  1524. * options array. 
  1525. * 
  1526. * @since bbPress (r4347) 
  1527. * 
  1528. * @param string $option_key 
  1529. */ 
  1530. function bbp_maybe_admin_setting_disabled( $option_key = '' ) { 
  1531. disabled( isset( bbpress()->options[$option_key] ) ); 
  1532.  
  1533. /** 
  1534. * Output settings API option 
  1535. * 
  1536. * @since bbPress (r3203) 
  1537. * 
  1538. * @uses bbp_get_bbp_form_option() 
  1539. * 
  1540. * @param string $option 
  1541. * @param string $default 
  1542. * @param bool $slug 
  1543. */ 
  1544. function bbp_form_option( $option, $default = '' , $slug = false ) { 
  1545. echo bbp_get_form_option( $option, $default, $slug ); 
  1546. /** 
  1547. * Return settings API option 
  1548. * 
  1549. * @since bbPress (r3203) 
  1550. * 
  1551. * @uses get_option() 
  1552. * @uses esc_attr() 
  1553. * @uses apply_filters() 
  1554. * 
  1555. * @param string $option 
  1556. * @param string $default 
  1557. * @param bool $slug 
  1558. */ 
  1559. function bbp_get_form_option( $option, $default = '', $slug = false ) { 
  1560.  
  1561. // Get the option and sanitize it 
  1562. $value = get_option( $option, $default ); 
  1563.  
  1564. // Slug? 
  1565. if ( true === $slug ) { 
  1566. $value = esc_attr( apply_filters( 'editable_slug', $value ) ); 
  1567.  
  1568. // Not a slug 
  1569. } else { 
  1570. $value = esc_attr( $value ); 
  1571.  
  1572. // Fallback to default 
  1573. if ( empty( $value ) ) 
  1574. $value = $default; 
  1575.  
  1576. // Allow plugins to further filter the output 
  1577. return apply_filters( 'bbp_get_form_option', $value, $option ); 
  1578.  
  1579. /** 
  1580. * Used to check if a bbPress slug conflicts with an existing known slug. 
  1581. * 
  1582. * @since bbPress (r3306) 
  1583. * 
  1584. * @param string $slug 
  1585. * @param string $default 
  1586. * 
  1587. * @uses bbp_get_form_option() To get a sanitized slug string 
  1588. */ 
  1589. function bbp_form_slug_conflict_check( $slug, $default ) { 
  1590.  
  1591. // Only set the slugs once ver page load 
  1592. static $the_core_slugs = array(); 
  1593.  
  1594. // Get the form value 
  1595. $this_slug = bbp_get_form_option( $slug, $default, true ); 
  1596.  
  1597. if ( empty( $the_core_slugs ) ) { 
  1598.  
  1599. // Slugs to check 
  1600. $core_slugs = apply_filters( 'bbp_slug_conflict_check', array( 
  1601.  
  1602. /** WordPress Core ****************************************************/ 
  1603.  
  1604. // Core Post Types 
  1605. 'post_base' => array( 'name' => __( 'Posts', 'bbpress' ), 'default' => 'post', 'context' => 'WordPress' ),  
  1606. 'page_base' => array( 'name' => __( 'Pages', 'bbpress' ), 'default' => 'page', 'context' => 'WordPress' ),  
  1607. 'revision_base' => array( 'name' => __( 'Revisions', 'bbpress' ), 'default' => 'revision', 'context' => 'WordPress' ),  
  1608. 'attachment_base' => array( 'name' => __( 'Attachments', 'bbpress' ), 'default' => 'attachment', 'context' => 'WordPress' ),  
  1609. 'nav_menu_base' => array( 'name' => __( 'Menus', 'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),  
  1610.  
  1611. // Post Tags 
  1612. 'tag_base' => array( 'name' => __( 'Tag base', 'bbpress' ), 'default' => 'tag', 'context' => 'WordPress' ),  
  1613.  
  1614. // Post Categories 
  1615. 'category_base' => array( 'name' => __( 'Category base', 'bbpress' ), 'default' => 'category', 'context' => 'WordPress' ),  
  1616.  
  1617. /** bbPress Core ******************************************************/ 
  1618.  
  1619. // Forum archive slug 
  1620. '_bbp_root_slug' => array( 'name' => __( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ),  
  1621.  
  1622. // Topic archive slug 
  1623. '_bbp_topic_archive_slug' => array( 'name' => __( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ),  
  1624.  
  1625. // Forum slug 
  1626. '_bbp_forum_slug' => array( 'name' => __( 'Forum slug', 'bbpress' ), 'default' => 'forum', 'context' => 'bbPress' ),  
  1627.  
  1628. // Topic slug 
  1629. '_bbp_topic_slug' => array( 'name' => __( 'Topic slug', 'bbpress' ), 'default' => 'topic', 'context' => 'bbPress' ),  
  1630.  
  1631. // Reply slug 
  1632. '_bbp_reply_slug' => array( 'name' => __( 'Reply slug', 'bbpress' ), 'default' => 'reply', 'context' => 'bbPress' ),  
  1633.  
  1634. // User profile slug 
  1635. '_bbp_user_slug' => array( 'name' => __( 'User base', 'bbpress' ), 'default' => 'users', 'context' => 'bbPress' ),  
  1636.  
  1637. // View slug 
  1638. '_bbp_view_slug' => array( 'name' => __( 'View base', 'bbpress' ), 'default' => 'view', 'context' => 'bbPress' ),  
  1639.  
  1640. // Topic tag slug 
  1641. '_bbp_topic_tag_slug' => array( 'name' => __( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ),  
  1642. ) ); 
  1643.  
  1644. /** BuddyPress Core *******************************************************/ 
  1645.  
  1646. if ( defined( 'BP_VERSION' ) ) { 
  1647. $bp = buddypress(); 
  1648.  
  1649. // Loop through root slugs and check for conflict 
  1650. if ( !empty( $bp->pages ) ) { 
  1651. foreach ( $bp->pages as $page => $page_data ) { 
  1652. $page_base = $page . '_base'; 
  1653. $page_title = sprintf( __( '%s page', 'bbpress' ), $page_data->title ); 
  1654. $core_slugs[$page_base] = array( 'name' => $page_title, 'default' => $page_data->slug, 'context' => 'BuddyPress' ); 
  1655.  
  1656. // Set the static 
  1657. $the_core_slugs = apply_filters( 'bbp_slug_conflict', $core_slugs ); 
  1658.  
  1659. // Loop through slugs to check 
  1660. foreach ( $the_core_slugs as $key => $value ) { 
  1661.  
  1662. // Get the slug 
  1663. $slug_check = bbp_get_form_option( $key, $value['default'], true ); 
  1664.  
  1665. // Compare 
  1666. if ( ( $slug !== $key ) && ( $slug_check === $this_slug ) ) : ?> 
  1667.  
  1668. <span class="attention"><?php printf( esc_html__( 'Possible %1$s conflict: %2$s', 'bbpress' ), $value['context'], '<strong>' . $value['name'] . '</strong>' ); ?></span> 
  1669.  
  1670. <?php endif; 
.