PluginProbe
bbPress / 2.0-rc-5
bbPress v2.0-rc-5
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
bbpress / bbp-includes / bbp-core-hooks.php

bbp-core-hooks.php in bbPress 2.0-rc-5, at bbp-includes/bbp-core-hooks.php

713 lines 23.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress Filters & Actions
5 *
6 * @package bbPress
7 * @subpackage Hooks
8 *
9 * This file contains the actions and filters that are used through-out bbPress.
10 * They are consolidated here to make searching for them easier, and to help
11 * developers understand at a glance the order in which things occur.
12 *
13 * There are a few common places that additional actions can currently be found
14 *
15 * - bbPress: In {@link bbPress::setup_actions()} in bbpress.php
16 * - Component: In {@link BBP_Component::setup_actions()} in
17 * bbp-includes/bbp-classes.php
18 * - Admin: More in {@link BBP_Admin::setup_actions()} in
19 * bbp-admin/bbp-admin.php
20 */
21
22 // Exit if accessed directly
23 if ( !defined( 'ABSPATH' ) ) exit;
24
25 /** ACTIONS *******************************************************************/
26
27 /**
28 * Attach bbPress to WordPress
29 *
30 * bbPress uses its own internal actions to help aid in additional plugin
31 * development, and to limit the amount of potential future code changes when
32 * updates to WordPress occur.
33 */
34 add_action( 'plugins_loaded', 'bbp_loaded', 10 );
35 add_action( 'init', 'bbp_init', 10 );
36 add_action( 'widgets_init', 'bbp_widgets_init', 10 );
37 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 );
38 add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 );
39 add_filter( 'template_include', 'bbp_template_include', 10 );
40
41 /**
42 * bbp_loaded - Attached to 'plugins_loaded' above
43 *
44 * Attach various loader actions to the bbp_loaded action.
45 * The load order helps to execute code at the correct time.
46 * v---Load order
47 */
48 add_action( 'bbp_loaded', 'bbp_constants', 2 );
49 add_action( 'bbp_loaded', 'bbp_boot_strap_globals', 4 );
50 add_action( 'bbp_loaded', 'bbp_includes', 6 );
51 add_action( 'bbp_loaded', 'bbp_setup_globals', 8 );
52 add_action( 'bbp_loaded', 'bbp_register_theme_directory', 10 );
53
54 /**
55 * bbp_init - Attached to 'init' above
56 *
57 * Attach various initialization actions to the init action.
58 * The load order helps to execute code at the correct time.
59 * v---Load order
60 */
61 add_action( 'bbp_init', 'bbp_load_textdomain', 2 );
62 add_action( 'bbp_init', 'bbp_setup_option_filters', 4 );
63 add_action( 'bbp_init', 'bbp_setup_current_user', 6 );
64 add_action( 'bbp_init', 'bbp_setup_theme_compat', 8 );
65 add_action( 'bbp_init', 'bbp_register_post_types', 10 );
66 add_action( 'bbp_init', 'bbp_register_post_statuses', 12 );
67 add_action( 'bbp_init', 'bbp_register_taxonomies', 14 );
68 add_action( 'bbp_init', 'bbp_register_views', 16 );
69 add_action( 'bbp_init', 'bbp_register_shortcodes', 18 );
70 add_action( 'bbp_init', 'bbp_add_rewrite_tags', 20 );
71 add_action( 'bbp_init', 'bbp_ready', 999 );
72
73 /**
74 * bbp_ready - attached to end 'bbp_init' above
75 *
76 * Attach actions to the ready action after bbPress has fully initialized.
77 * The load order helps to execute code at the correct time.
78 * v---Load order
79 */
80 add_action( 'bbp_ready', 'bbp_setup_akismet', 2 ); // Spam prevention for topics and replies
81 add_action( 'bbp_ready', 'bbp_setup_buddypress', 4 ); // Social network integration
82 add_action( 'bbp_ready', 'bbp_setup_genesis', 6 ); // Popular theme framework
83
84 // Multisite Global Forum Access
85 add_action( 'bbp_setup_current_user', 'bbp_global_access_role_mask', 10 );
86
87 // Theme Compat
88 add_action( 'bbp_enqueue_scripts', 'bbp_theme_compat_enqueue_css', 10 );
89
90 // Widgets
91 add_action( 'bbp_widgets_init', array( 'BBP_Login_Widget', 'register_widget' ), 10 );
92 add_action( 'bbp_widgets_init', array( 'BBP_Views_Widget', 'register_widget' ), 10 );
93 add_action( 'bbp_widgets_init', array( 'BBP_Forums_Widget', 'register_widget' ), 10 );
94 add_action( 'bbp_widgets_init', array( 'BBP_Topics_Widget', 'register_widget' ), 10 );
95 add_action( 'bbp_widgets_init', array( 'BBP_Replies_Widget', 'register_widget' ), 10 );
96
97 // Template - Head, foot, errors and messages
98 add_action( 'wp_head', 'bbp_head' );
99 add_filter( 'wp_title', 'bbp_title', 10, 3 );
100 add_action( 'wp_footer', 'bbp_footer' );
101 add_action( 'bbp_loaded', 'bbp_login_notices' );
102 add_action( 'bbp_head', 'bbp_topic_notices' );
103 add_action( 'bbp_template_notices', 'bbp_template_notices' );
104
105 // Add to body class
106 add_filter( 'body_class', 'bbp_body_class', 10, 2 );
107
108 // Caps & Roles
109 add_filter( 'map_meta_cap', 'bbp_map_meta_caps', 10, 4 );
110 add_action( 'bbp_activation', 'bbp_add_roles', 1 );
111 add_action( 'bbp_activation', 'bbp_add_caps', 2 );
112 add_action( 'bbp_deactivation', 'bbp_remove_caps', 1 );
113 add_action( 'bbp_deactivation', 'bbp_remove_roles', 2 );
114
115 // Options & Settings
116 add_action( 'bbp_activation', 'bbp_add_options', 1 );
117
118 // Multisite
119 add_action( 'bbp_new_site', 'bbp_add_roles', 2 );
120 add_action( 'bbp_new_site', 'bbp_add_caps', 4 );
121 add_action( 'bbp_new_site', 'bbp_add_options', 6 );
122
123 // Topic Tag Page
124 add_action( 'template_redirect', 'bbp_manage_topic_tag_handler', 1 );
125
126 // Before and After the Query
127 add_action( 'pre_get_posts', 'bbp_pre_get_posts', 2 );
128 add_action( 'pre_get_posts', 'bbp_pre_get_posts_exclude_forums', 4 );
129
130 // Restrict forum access
131 add_action( 'template_redirect', 'bbp_forum_enforce_hidden', -1 );
132 add_action( 'template_redirect', 'bbp_forum_enforce_private', -1 );
133
134 // Profile Edit
135 add_action( 'template_redirect', 'bbp_edit_user_handler', 1 );
136
137 // Profile Page Messages
138 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_success' );
139 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_is_super_admin', 2 );
140
141 // Update forum branch
142 add_action( 'bbp_trashed_forum', 'bbp_update_forum_walker' );
143 add_action( 'bbp_untrashed_forum', 'bbp_update_forum_walker' );
144 add_action( 'bbp_deleted_forum', 'bbp_update_forum_walker' );
145 add_action( 'bbp_spammed_forum', 'bbp_update_forum_walker' );
146 add_action( 'bbp_unspammed_forum', 'bbp_update_forum_walker' );
147
148 // New/Edit Reply
149 add_action( 'template_redirect', 'bbp_new_reply_handler' );
150 add_action( 'template_redirect', 'bbp_edit_reply_handler', 1 );
151 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 6 );
152 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 6 );
153
154 // Before Delete/Trash/Untrash Reply
155 add_action( 'trash_post', 'bbp_trash_reply' );
156 add_action( 'untrash_post', 'bbp_untrash_reply' );
157 add_action( 'delete_post', 'bbp_delete_reply' );
158
159 // After Deleted/Trashed/Untrashed Reply
160 add_action( 'trashed_post', 'bbp_trashed_reply' );
161 add_action( 'untrashed_post', 'bbp_untrashed_reply' );
162 add_action( 'deleted_post', 'bbp_deleted_reply' );
163
164 // New/Edit Topic
165 add_action( 'template_redirect', 'bbp_new_topic_handler' );
166 add_action( 'template_redirect', 'bbp_edit_topic_handler', 1 );
167 add_action( 'bbp_new_topic', 'bbp_update_topic', 10, 5 );
168 add_action( 'bbp_edit_topic', 'bbp_update_topic', 10, 5 );
169
170 // Split/Merge Topic
171 add_action( 'template_redirect', 'bbp_merge_topic_handler', 1 );
172 add_action( 'template_redirect', 'bbp_split_topic_handler', 1 );
173 add_action( 'bbp_merged_topic', 'bbp_merge_topic_count', 1, 3 );
174 add_action( 'bbp_post_split_topic', 'bbp_split_topic_count', 1, 3 );
175
176 // Before Delete/Trash/Untrash Topic
177 add_action( 'trash_post', 'bbp_trash_topic' );
178 add_action( 'untrash_post', 'bbp_untrash_topic' );
179 add_action( 'delete_post', 'bbp_delete_topic' );
180
181 // After Deleted/Trashed/Untrashed Topic
182 add_action( 'trashed_post', 'bbp_trashed_topic' );
183 add_action( 'untrashed_post', 'bbp_untrashed_topic' );
184 add_action( 'deleted_post', 'bbp_deleted_topic' );
185
186 // Topic/Reply Actions
187 add_action( 'template_redirect', 'bbp_toggle_topic_handler', 1 );
188 add_action( 'template_redirect', 'bbp_toggle_reply_handler', 1 );
189
190 // Favorites
191 add_action( 'template_redirect', 'bbp_favorites_handler', 1 );
192 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_favorites' );
193 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_favorites' );
194
195 // Subscriptions
196 add_action( 'template_redirect', 'bbp_subscriptions_handler', 1 );
197 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_subscriptions' );
198 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_subscriptions' );
199 add_action( 'bbp_new_reply', 'bbp_notify_subscribers', 1, 1 );
200
201 // Sticky
202 add_action( 'bbp_trash_topic', 'bbp_unstick_topic' );
203 add_action( 'bbp_delete_topic', 'bbp_unstick_topic' );
204
205 // Update topic branch
206 add_action( 'bbp_trashed_topic', 'bbp_update_topic_walker' );
207 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_walker' );
208 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' );
209 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' );
210 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' );
211
212 // Update reply branch
213 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' );
214 add_action( 'bbp_untrashed_reply', 'bbp_update_reply_walker' );
215 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' );
216 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' );
217 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' );
218
219 // User status
220 add_action( 'make_ham_user', 'bbp_make_ham_user' );
221 add_action( 'make_spam_user', 'bbp_make_spam_user' );
222
223 // User role
224 add_action( 'bbp_new_topic', 'bbp_global_access_auto_role' );
225 add_action( 'bbp_new_reply', 'bbp_global_access_auto_role' );
226
227 // Flush rewrite rules
228 add_action( 'bbp_activation', 'flush_rewrite_rules' );
229 add_action( 'bbp_deactivation', 'flush_rewrite_rules' );
230
231 /**
232 * When a new site is created in a multisite installation, run the activation
233 * routine on that site
234 *
235 * @since bbPress (r3283)
236 *
237 * @param int $blog_id
238 * @param int $user_id
239 * @param string $domain
240 * @param string $path
241 * @param int $site_id
242 * @param array() $meta
243 */
244 function bbp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
245
246 // Switch to the new blog
247 switch_to_blog( $blog_id );
248
249 // Do the bbPress activation routine
250 do_action( 'bbp_new_site' );
251
252 // restore original blog
253 restore_current_blog();
254 }
255 add_action( 'wpmu_new_blog', 'bbp_new_site', 10, 6 );
256
257 /** FILTERS *******************************************************************/
258
259 /**
260 * Template Compatibility
261 *
262 * If you want to completely bypass this and manage your own custom bbPress
263 * template hierarchy, start here by removing this filter, then look at how
264 * bbp_template_include() works and do something similar. :)
265 */
266 add_filter( 'bbp_template_include', 'bbp_template_include_theme_supports', 2, 1 );
267 add_filter( 'bbp_template_include', 'bbp_template_include_theme_compat', 4, 2 );
268
269 /**
270 * Feeds
271 *
272 * bbPress comes with a number of custom RSS2 feeds that get handled outside
273 * the normal scope of feeds that WordPress would normally serve. To do this,
274 * we filter every page request, listen for a feed request, and trap it.
275 */
276 add_filter( 'request', 'bbp_request_feed_trap' );
277
278 // Links
279 add_filter( 'paginate_links', 'bbp_add_view_all' );
280 add_filter( 'bbp_get_topic_permalink', 'bbp_add_view_all' );
281 add_filter( 'bbp_get_reply_permalink', 'bbp_add_view_all' );
282 add_filter( 'bbp_get_forum_permalink', 'bbp_add_view_all' );
283
284 // wp_filter_kses on new/edit topic/reply title
285 add_filter( 'bbp_new_reply_pre_title', 'wp_filter_kses' );
286 add_filter( 'bbp_new_topic_pre_title', 'wp_filter_kses' );
287 add_filter( 'bbp_edit_reply_pre_title', 'wp_filter_kses' );
288 add_filter( 'bbp_edit_topic_pre_title', 'wp_filter_kses' );
289
290 // balanceTags, wp_filter_kses and wp_rel_nofollow on new/edit topic/reply text
291 add_filter( 'bbp_new_reply_pre_content', 'balanceTags' );
292 add_filter( 'bbp_new_reply_pre_content', 'wp_rel_nofollow' );
293 add_filter( 'bbp_new_reply_pre_content', 'wp_filter_kses' );
294 add_filter( 'bbp_new_topic_pre_content', 'balanceTags' );
295 add_filter( 'bbp_new_topic_pre_content', 'wp_rel_nofollow' );
296 add_filter( 'bbp_new_topic_pre_content', 'wp_filter_kses' );
297 add_filter( 'bbp_edit_reply_pre_content', 'balanceTags' );
298 add_filter( 'bbp_edit_reply_pre_content', 'wp_rel_nofollow' );
299 add_filter( 'bbp_edit_reply_pre_content', 'wp_filter_kses' );
300 add_filter( 'bbp_edit_topic_pre_content', 'balanceTags' );
301 add_filter( 'bbp_edit_topic_pre_content', 'wp_rel_nofollow' );
302 add_filter( 'bbp_edit_topic_pre_content', 'wp_filter_kses' );
303
304 // Add number format filter to functions requiring numeric output
305 add_filter( 'bbp_get_forum_topic_count', 'bbp_number_format' );
306 add_filter( 'bbp_get_forum_topic_reply_count', 'bbp_number_format' );
307
308 // No follow and stripslashes on user profile links
309 add_filter( 'bbp_get_reply_author_link', 'wp_rel_nofollow' );
310 add_filter( 'bbp_get_reply_author_link', 'stripslashes' );
311 add_filter( 'bbp_get_topic_author_link', 'wp_rel_nofollow' );
312 add_filter( 'bbp_get_topic_author_link', 'stripslashes' );
313 add_filter( 'bbp_get_user_favorites_link', 'wp_rel_nofollow' );
314 add_filter( 'bbp_get_user_favorites_link', 'stripslashes' );
315 add_filter( 'bbp_get_user_subscribe_link', 'wp_rel_nofollow' );
316 add_filter( 'bbp_get_user_subscribe_link', 'stripslashes' );
317 add_filter( 'bbp_get_user_profile_link', 'wp_rel_nofollow' );
318 add_filter( 'bbp_get_user_profile_link', 'stripslashes' );
319 add_filter( 'bbp_get_user_profile_edit_link', 'wp_rel_nofollow' );
320 add_filter( 'bbp_get_user_profile_edit_link', 'stripslashes' );
321
322 // Run filters on reply content
323 add_filter( 'bbp_get_reply_content', 'capital_P_dangit' );
324 add_filter( 'bbp_get_reply_content', 'wptexturize', 3 );
325 add_filter( 'bbp_get_reply_content', 'convert_chars', 5 );
326 add_filter( 'bbp_get_reply_content', 'make_clickable', 9 );
327 add_filter( 'bbp_get_reply_content', 'force_balance_tags', 25 );
328 add_filter( 'bbp_get_reply_content', 'convert_smilies', 20 );
329 add_filter( 'bbp_get_reply_content', 'wpautop', 30 );
330
331 // Run filters on topic content
332 add_filter( 'bbp_get_topic_content', 'capital_P_dangit' );
333 add_filter( 'bbp_get_topic_content', 'wptexturize', 3 );
334 add_filter( 'bbp_get_topic_content', 'convert_chars', 5 );
335 add_filter( 'bbp_get_topic_content', 'make_clickable', 9 );
336 add_filter( 'bbp_get_topic_content', 'force_balance_tags', 25 );
337 add_filter( 'bbp_get_topic_content', 'convert_smilies', 20 );
338 add_filter( 'bbp_get_topic_content', 'wpautop', 30 );
339
340 // Revisions
341 add_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_revisions', 1, 2 );
342 add_filter( 'bbp_get_topic_content', 'bbp_topic_content_append_revisions', 1, 2 );
343
344 // Canonical
345 add_filter( 'redirect_canonical', 'bbp_redirect_canonical' );
346
347 // Login/Register/Lost Password
348 add_filter( 'login_redirect', 'bbp_redirect_login', 2, 3 );
349 add_filter( 'logout_url', 'bbp_logout_url', 2, 2 );
350
351 // Fix post author id for anonymous posts (set it back to 0) when the post status is changed
352 add_filter( 'wp_insert_post_data', 'bbp_fix_post_author', 30, 2 );
353
354 // Suppress private forum details
355 add_filter( 'bbp_get_forum_topic_count', 'bbp_suppress_private_forum_meta', 10, 2 );
356 add_filter( 'bbp_get_forum_reply_count', 'bbp_suppress_private_forum_meta', 10, 2 );
357 add_filter( 'bbp_get_forum_post_count', 'bbp_suppress_private_forum_meta', 10, 2 );
358 add_filter( 'bbp_get_forum_freshness_link', 'bbp_suppress_private_forum_meta', 10, 2 );
359 add_filter( 'bbp_get_author_link', 'bbp_suppress_private_author_link', 10, 2 );
360 add_filter( 'bbp_get_topic_author_link', 'bbp_suppress_private_author_link', 10, 2 );
361 add_filter( 'bbp_get_reply_author_link', 'bbp_suppress_private_author_link', 10, 2 );
362
363 /**
364 * Add filters to anonymous post author data
365 *
366 * This is used to clean-up any anonymous user data that is submitted via the
367 * new topic and new reply forms.
368 *
369 * @uses add_filter() To add filters
370 */
371 function bbp_pre_anonymous_filters () {
372
373 // Post author name
374 $filters = array(
375 'trim' => 10,
376 'sanitize_text_field' => 10,
377 'wp_filter_kses' => 10,
378 '_wp_specialchars' => 30
379 );
380 foreach ( $filters as $filter => $priority )
381 add_filter( 'bbp_pre_anonymous_post_author_name', $filter, $priority );
382
383 // Email saves
384 foreach ( array( 'trim', 'sanitize_email', 'wp_filter_kses' ) as $filter )
385 add_filter( 'bbp_pre_anonymous_post_author_email', $filter );
386
387 // Save URL
388 foreach ( array( 'trim', 'wp_strip_all_tags', 'esc_url_raw', 'wp_filter_kses' ) as $filter )
389 add_filter( 'bbp_pre_anonymous_post_author_website', $filter );
390 }
391 bbp_pre_anonymous_filters();
392
393 /**
394 * On multisite installations you must first allow themes to be activated and
395 * show up on the theme selection screen. This function will let the bbPress
396 * bundled themes show up and bypass this step.
397 *
398 * @since bbPress (r2944)
399 *
400 * @uses apply_filters() Calls 'bbp_allowed_themes' with the allowed themes list
401 */
402 function bbp_allowed_themes( $themes ) {
403 $themes['bbp-twentyten'] = 1;
404
405 return apply_filters( 'bbp_allowed_themes', $themes );
406 }
407 add_filter( 'allowed_themes', 'bbp_allowed_themes' );
408
409 /** Admin *********************************************************************/
410
411 if ( is_admin() ) {
412
413 /** Actions ***************************************************************/
414
415 add_action( 'bbp_init', 'bbp_admin' );
416 add_action( 'bbp_admin_init', 'bbp_admin_forums', 9 );
417 add_action( 'bbp_admin_init', 'bbp_admin_topics', 9 );
418 add_action( 'bbp_admin_init', 'bbp_admin_replies', 9 );
419 add_action( 'bbp_admin_init', 'bbp_admin_settings_help' );
420 add_action( 'admin_menu', 'bbp_admin_separator' );
421 add_action( 'custom_menu_order', 'bbp_admin_custom_menu_order' );
422 add_action( 'menu_order', 'bbp_admin_menu_order' );
423
424 /**
425 * Run the updater late on 'bbp_admin_init' to ensure that all alterations
426 * to the permalink structure have taken place. This fixes the issue of
427 * permalinks not being flushed properly when a bbPress update occurs.
428 */
429 add_action( 'bbp_admin_init', 'bbp_setup_updater', 999 );
430
431 /** Filters ***************************************************************/
432
433 // Run wp_kses_data on topic/reply content in admin section
434 add_filter( 'bbp_get_reply_content', 'wp_kses_data' );
435 add_filter( 'bbp_get_topic_content', 'wp_kses_data' );
436 }
437
438 /**
439 * Plugin Dependency
440 *
441 * The purpose of the following actions is to mimic the behavior of something
442 * called 'plugin dependency' which enables a plugin to have plugins of their
443 * own in a safe and reliable way.
444 *
445 * We do this in bbPress by mirroring existing WordPress actions in many places
446 * allowing dependant plugins to hook into the bbPress specific ones, thus
447 * guaranteeing proper code execution only when bbPress is active.
448 *
449 * The following functions are wrappers for their actions, allowing them to be
450 * manually called and/or piggy-backed on top of other actions if needed.
451 */
452
453 /** Activation Actions ********************************************************/
454
455 /**
456 * Runs on bbPress activation
457 *
458 * @since bbPress (r2509)
459 *
460 * @uses register_uninstall_hook() To register our own uninstall hook
461 * @uses do_action() Calls 'bbp_activation' hook
462 */
463 function bbp_activation() {
464 do_action( 'bbp_activation' );
465 }
466
467 /**
468 * Runs on bbPress deactivation
469 *
470 * @since bbPress (r2509)
471 *
472 * @uses do_action() Calls 'bbp_deactivation' hook
473 */
474 function bbp_deactivation() {
475 do_action( 'bbp_deactivation' );
476 }
477
478 /**
479 * Runs when uninstalling bbPress
480 *
481 * @since bbPress (r2509)
482 *
483 * @uses do_action() Calls 'bbp_uninstall' hook
484 */
485 function bbp_uninstall() {
486 do_action( 'bbp_uninstall' );
487 }
488
489 /** Main Actions **************************************************************/
490
491 /**
492 * Main action responsible for constants, globals, and includes
493 *
494 * @since bbPress (r2599)
495 *
496 * @uses do_action() Calls 'bbp_loaded'
497 */
498 function bbp_loaded() {
499 do_action( 'bbp_loaded' );
500 }
501
502 /**
503 * Setup constants
504 *
505 * @since bbPress (r2599)
506 *
507 * @uses do_action() Calls 'bbp_constants'
508 */
509 function bbp_constants() {
510 do_action( 'bbp_constants' );
511 }
512
513 /**
514 * Setup globals BEFORE includes
515 *
516 * @since bbPress (r2599)
517 *
518 * @uses do_action() Calls 'bbp_boot_strap_globals'
519 */
520 function bbp_boot_strap_globals() {
521 do_action( 'bbp_boot_strap_globals' );
522 }
523
524 /**
525 * Include files
526 *
527 * @since bbPress (r2599)
528 *
529 * @uses do_action() Calls 'bbp_includes'
530 */
531 function bbp_includes() {
532 do_action( 'bbp_includes' );
533 }
534
535 /**
536 * Setup globals AFTER includes
537 *
538 * @since bbPress (r2599)
539 *
540 * @uses do_action() Calls 'bbp_setup_globals'
541 */
542 function bbp_setup_globals() {
543 do_action( 'bbp_setup_globals' );
544 }
545
546 /**
547 * Initialize any code after everything has been loaded
548 *
549 * @since bbPress (r2599)
550 *
551 * @uses do_action() Calls 'bbp_init'
552 */
553 function bbp_init() {
554 do_action ( 'bbp_init' );
555 }
556
557 /**
558 * Initialize widgets
559 *
560 * @since bbPress (r3389)
561 *
562 * @uses do_action() Calls 'bbp_widgets_init'
563 */
564 function bbp_widgets_init() {
565 do_action ( 'bbp_widgets_init' );
566 }
567
568 /** Supplemental Actions ******************************************************/
569
570 /**
571 * Setup the currently logged-in user
572 *
573 * @since bbPress (r2695)
574 *
575 * @uses do_action() Calls 'bbp_setup_current_user'
576 */
577 function bbp_setup_current_user() {
578 do_action ( 'bbp_setup_current_user' );
579 }
580
581 /**
582 * Load translations for current language
583 *
584 * @since bbPress (r2599)
585 *
586 * @uses do_action() Calls 'bbp_load_textdomain'
587 */
588 function bbp_load_textdomain() {
589 do_action( 'bbp_load_textdomain' );
590 }
591
592 /**
593 * Sets up the theme directory
594 *
595 * @since bbPress (r2507)
596 *
597 * @uses do_action() Calls 'bbp_register_theme_directory'
598 */
599 function bbp_register_theme_directory() {
600 do_action( 'bbp_register_theme_directory' );
601 }
602
603 /**
604 * Setup the post types
605 *
606 * @since bbPress (r2464)
607 *
608 * @uses do_action() Calls 'bbp_register_post_type'
609 */
610 function bbp_register_post_types() {
611 do_action ( 'bbp_register_post_types' );
612 }
613
614 /**
615 * Setup the post statuses
616 *
617 * @since bbPress (r2727)
618 *
619 * @uses do_action() Calls 'bbp_register_post_statuses'
620 */
621 function bbp_register_post_statuses() {
622 do_action ( 'bbp_register_post_statuses' );
623 }
624
625 /**
626 * Register the built in bbPress taxonomies
627 *
628 * @since bbPress (r2464)
629 *
630 * @uses do_action() Calls 'bbp_register_taxonomies'
631 */
632 function bbp_register_taxonomies() {
633 do_action ( 'bbp_register_taxonomies' );
634 }
635
636 /**
637 * Register the default bbPress views
638 *
639 * @since bbPress (r2789)
640 *
641 * @uses do_action() Calls 'bbp_register_views'
642 */
643 function bbp_register_views() {
644 do_action ( 'bbp_register_views' );
645 }
646
647 /**
648 * Enqueue bbPress specific CSS and JS
649 *
650 * @since bbPress (r3373)
651 *
652 * @uses do_action() Calls 'bbp_enqueue_scripts'
653 */
654 function bbp_enqueue_scripts() {
655 do_action ( 'bbp_enqueue_scripts' );
656 }
657
658 /**
659 * Add the bbPress-specific rewrite tags
660 *
661 * @since bbPress (r2753)
662 *
663 * @uses do_action() Calls 'bbp_add_rewrite_tags'
664 */
665 function bbp_add_rewrite_tags() {
666 do_action ( 'bbp_add_rewrite_tags' );
667 }
668
669 /**
670 * Generate bbPress-specific rewrite rules
671 *
672 * @since bbPress (r2688)
673 *
674 * @param WP_Rewrite $wp_rewrite
675 *
676 * @uses do_action() Calls 'bbp_generate_rewrite_rules' with {@link WP_Rewrite}
677 */
678 function bbp_generate_rewrite_rules( $wp_rewrite ) {
679 do_action_ref_array( 'bbp_generate_rewrite_rules', array( &$wp_rewrite ) );
680 }
681
682 /** Final Action **************************************************************/
683
684 /**
685 * bbPress has loaded and initialized everything, and is okay to go
686 *
687 * @since bbPress (r2618)
688 *
689 * @uses do_action() Calls 'bbp_ready'
690 */
691 function bbp_ready() {
692 do_action( 'bbp_ready' );
693 }
694
695 /** Theme Compatibility Filter ************************************************/
696
697 /**
698 * The main filter used for theme compatibility and displaying custom bbPress
699 * theme files.
700 *
701 * @since bbPress (r3311)
702 *
703 * @uses apply_filters()
704 *
705 * @param string $template
706 * @return string Template file to use
707 */
708 function bbp_template_include( $template = '' ) {
709 return apply_filters( 'bbp_template_include', $template );
710 }
711
712 ?>
713