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

bbp-core-hooks.php in bbPress 2.0.2, at bbp-includes/bbp-core-hooks.php

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