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