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

actions.php in bbPress trunk, at includes/core/actions.php

475 lines 23.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress Actions.
5 *
6 * This file contains the actions that are used through-out bbPress. They are
7 * consolidated here to make searching for them easier, and to help developers
8 * understand at a glance the order in which things occur.
9 *
10 * There are a few common places that additional actions can currently be found
11 *
12 * - bbPress: In {@link bbPress::setup_actions()} in bbpress.php
13 * - Admin: More in {@link BBP_Admin::setup_actions()} in admin.php
14 *
15 * @package bbPress
16 * @subpackage Core
17 *
18 * @see /core/filters.php
19 */
20
21 // Exit if accessed directly
22 defined( 'ABSPATH' ) || exit;
23
24 /**
25 * Attach bbPress to WordPress.
26 *
27 * bbPress uses its own internal actions to help aid in third-party plugin
28 * development, and to limit the amount of potential future code changes when
29 * updates to WordPress core occur.
30 *
31 * These actions exist to create the concept of 'plugin dependencies'. They
32 * provide a safe way for plugins to execute code *only* when bbPress is
33 * installed and activated, without needing to do complicated guesswork.
34 *
35 * For more information on how this works, see the 'Plugin Dependency' section
36 * near the bottom of this file.
37 *
38 * v--WordPress Actions v--bbPress Sub-actions
39 */
40 add_action( 'plugins_loaded', 'bbp_loaded', 10 );
41 add_action( 'init', 'bbp_init', 0 ); // Early for bbp_register
42 add_action( 'parse_query', 'bbp_parse_query', 2 ); // Early for overrides
43 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 );
44 add_action( 'after_setup_theme', 'bbp_after_setup_theme', 10 );
45 add_action( 'setup_theme', 'bbp_setup_theme', 10 );
46 add_action( 'set_current_user', 'bbp_setup_current_user', 10 );
47 add_action( 'profile_update', 'bbp_profile_update', 10, 2 ); // user_id and old_user_data
48 add_action( 'user_register', 'bbp_user_register', 10 );
49 add_action( 'login_form_login', 'bbp_login_form_login', 10 );
50 add_action( 'template_redirect', 'bbp_template_redirect', 8 ); // Before BuddyPress's 10 [BB2225]
51 add_action( 'widgets_init', 'bbp_widgets_init', 10 );
52 add_action( 'wp_roles_init', 'bbp_roles_init', 10 );
53 add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 );
54 add_action( 'wp_head', 'bbp_head', 10 );
55 add_action( 'wp_footer', 'bbp_footer', 10 );
56 add_action( 'transition_post_status', 'bbp_transition_post_status', 10, 3 );
57
58 /**
59 * bbp_loaded - Attached to 'plugins_loaded' above.
60 *
61 * Attach various loader actions to the bbp_loaded action.
62 * The load order helps to execute code at the correct time.
63 * v---Load order
64 */
65 add_action( 'bbp_loaded', 'bbp_constants', 2 );
66 add_action( 'bbp_loaded', 'bbp_boot_strap_globals', 4 );
67 add_action( 'bbp_loaded', 'bbp_includes', 6 );
68 add_action( 'bbp_loaded', 'bbp_setup_globals', 8 );
69 add_action( 'bbp_loaded', 'bbp_setup_option_filters', 10 );
70 add_action( 'bbp_loaded', 'bbp_setup_user_option_filters', 12 );
71 add_action( 'bbp_loaded', 'bbp_pre_load_options', 14 );
72
73 /**
74 * bbp_init - Attached to 'init' above.
75 *
76 * Attach various initialization actions to the init action.
77 * The load order helps to execute code at the correct time.
78 * v---Load order
79 */
80 add_action( 'bbp_init', 'bbp_load_textdomain', 0 );
81 add_action( 'bbp_init', 'bbp_register', 10 );
82 add_action( 'bbp_init', 'bbp_add_rewrite_tags', 20 );
83 add_action( 'bbp_init', 'bbp_add_rewrite_rules', 30 );
84 add_action( 'bbp_init', 'bbp_add_permastructs', 40 );
85 add_action( 'bbp_init', 'bbp_setup_engagements', 50 );
86 add_action( 'bbp_init', 'bbp_ready', 999 );
87
88 /**
89 * bbp_setup_theme - Attached to 'setup_theme' above.
90 *
91 * Attach various theme related actions to the setup_theme action.
92 * The load order helps to execute code at the correct time.
93 * v---Load order
94 */
95 add_action( 'bbp_setup_theme', 'bbp_register_theme_packages', 2 ); // Lower than 5
96
97 /**
98 * bbp_roles_init - Attached to 'wp_roles_init' above.
99 *
100 * Attach various role related actions to the wp_roles_init action.
101 * The load order helps to execute code at the correct time.
102 * v---Load order
103 */
104 add_action( 'bbp_roles_init', 'bbp_add_forums_roles', 8 );
105
106 /**
107 * When setting up the current user, make sure they have a role for the forums.
108 *
109 * This is multisite aware, thanks to bbp_filter_user_roles_option(), hooked to
110 * the 'bbp_loaded' action above.
111 */
112 add_action( 'bbp_setup_current_user', 'bbp_set_current_user_default_role' );
113
114 /**
115 * bbp_register - Attached to 'init' above on 0 priority.
116 *
117 * Attach various initialization actions early to the init action.
118 * The load order helps to execute code at the correct time.
119 * v---Load order
120 */
121 add_action( 'bbp_register', 'bbp_register_post_types', 2 );
122 add_action( 'bbp_register', 'bbp_register_post_statuses', 4 );
123 add_action( 'bbp_register', 'bbp_register_taxonomies', 6 );
124 add_action( 'bbp_register', 'bbp_register_views', 8 );
125 add_action( 'bbp_register', 'bbp_register_shortcodes', 10 );
126 add_action( 'bbp_register', 'bbp_register_blocks', 10 );
127 add_action( 'bbp_register', 'bbp_register_meta', 12 );
128
129 // Autoembeds
130 add_action( 'bbp_init', 'bbp_reply_content_autoembed', 8 );
131 add_action( 'bbp_init', 'bbp_topic_content_autoembed', 8 );
132
133 // <body> class swap from "bbp-no-js" to "bbp-js"
134 add_action( 'wp_body_open', 'bbp_swap_no_js_body_class' );
135 add_action( 'bbp_footer', 'bbp_swap_no_js_body_class' );
136
137 /**
138 * bbp_ready - attached to end 'bbp_init' above.
139 *
140 * Attach actions to the ready action after bbPress has fully initialized.
141 * The load order helps to execute code at the correct time.
142 * v---Load order
143 */
144 add_action( 'bbp_ready', 'bbp_setup_akismet', 2 ); // Spam prevention for topics and replies
145
146 // Setup BuddyPress using its own hook
147 add_action( 'bp_include', 'bbp_setup_buddypress', 10 ); // Social network integration
148
149 // Try to load the bbpress-functions.php file from the active themes
150 add_action( 'bbp_after_setup_theme', 'bbp_load_theme_functions', 10 );
151
152 // Widgets
153 // phpcs:disable Universal.WhiteSpace.CommaSpacing.TooMuchSpaceAfter
154 add_action( 'bbp_widgets_init', array( 'BBP_Login_Widget', 'register_widget' ), 10 );
155 add_action( 'bbp_widgets_init', array( 'BBP_Views_Widget', 'register_widget' ), 10 );
156 add_action( 'bbp_widgets_init', array( 'BBP_Search_Widget', 'register_widget' ), 10 );
157 add_action( 'bbp_widgets_init', array( 'BBP_Forums_Widget', 'register_widget' ), 10 );
158 add_action( 'bbp_widgets_init', array( 'BBP_Topics_Widget', 'register_widget' ), 10 );
159 add_action( 'bbp_widgets_init', array( 'BBP_Replies_Widget', 'register_widget' ), 10 );
160 add_action( 'bbp_widgets_init', array( 'BBP_Stats_Widget', 'register_widget' ), 10 );
161 // phpcs:enable
162
163 // Notices
164 add_action( 'bbp_template_notices', 'bbp_template_notices', 20 );
165 add_action( 'bbp_template_notices', 'bbp_login_notices' );
166 add_action( 'bbp_template_notices', 'bbp_topic_notices' );
167 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_success' );
168 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_pending_email' );
169 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_is_super_admin', 2 );
170
171 // Always exclude private/hidden forums if needed
172 add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 );
173
174 // Before Delete/Trash/Untrash Forum
175 add_action( 'wp_trash_post', 'bbp_trash_forum' );
176 add_action( 'trash_post', 'bbp_trash_forum' );
177 add_action( 'untrash_post', 'bbp_untrash_forum' );
178 add_action( 'before_delete_post', 'bbp_delete_forum' );
179
180 // After Deleted/Trashed/Untrashed Forum
181 add_action( 'trashed_post', 'bbp_trashed_forum' );
182 add_action( 'untrashed_post', 'bbp_untrashed_forum' );
183 add_action( 'deleted_post', 'bbp_deleted_forum' );
184
185 // Auto trash/untrash/delete a forums topics
186 add_action( 'bbp_delete_forum', 'bbp_delete_forum_topics', 10 );
187 add_action( 'bbp_trash_forum', 'bbp_trash_forum_topics', 10 );
188 add_action( 'bbp_untrash_forum', 'bbp_untrash_forum_topics', 10 );
189
190 // New/Edit Forum
191 add_action( 'bbp_new_forum', 'bbp_update_forum', 10 );
192 add_action( 'bbp_edit_forum', 'bbp_update_forum', 10 );
193
194 // Save forum extra metadata
195 add_action( 'bbp_new_forum_post_extras', 'bbp_save_forum_extras', 2 );
196 add_action( 'bbp_edit_forum_post_extras', 'bbp_save_forum_extras', 2 );
197 add_action( 'bbp_forum_attributes_metabox_save', 'bbp_save_forum_extras', 2 );
198
199 // New/Edit Reply
200 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 7 );
201 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 7 );
202
203 // Before Delete/Trash/Untrash Reply
204 add_action( 'wp_trash_post', 'bbp_trash_reply' );
205 add_action( 'trash_post', 'bbp_trash_reply' );
206 add_action( 'untrash_post', 'bbp_untrash_reply' );
207 add_action( 'before_delete_post', 'bbp_delete_reply' );
208
209 // After Deleted/Trashed/Untrashed Reply
210 add_action( 'trashed_post', 'bbp_trashed_reply' );
211 add_action( 'untrashed_post', 'bbp_untrashed_reply' );
212 add_action( 'deleted_post', 'bbp_deleted_reply' );
213
214 // New/Edit Topic
215 add_action( 'bbp_new_topic', 'bbp_update_topic', 10, 5 );
216 add_action( 'bbp_edit_topic', 'bbp_update_topic', 10, 5 );
217
218 // Split/Merge Topic
219 add_action( 'bbp_merged_topic', 'bbp_merge_topic_count', 1, 3 );
220 add_action( 'bbp_post_split_topic', 'bbp_split_topic_count', 1, 3 );
221
222 // Move Reply
223 add_action( 'bbp_post_move_reply', 'bbp_move_reply_count', 1, 3 );
224
225 // Before Delete/Trash/Untrash Topic
226 add_action( 'wp_trash_post', 'bbp_trash_topic' );
227 add_action( 'trash_post', 'bbp_trash_topic' );
228 add_action( 'untrash_post', 'bbp_untrash_topic' );
229 add_action( 'before_delete_post', 'bbp_delete_topic' );
230
231 // After Deleted/Trashed/Untrashed Topic
232 add_action( 'trashed_post', 'bbp_trashed_topic' );
233 add_action( 'untrashed_post', 'bbp_untrashed_topic' );
234 add_action( 'deleted_post', 'bbp_deleted_topic' );
235
236 // Favorites
237 add_action( 'bbp_spam_topic', 'bbp_remove_topic_from_all_favorites' );
238 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_favorites' );
239 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_favorites' );
240
241 // Subscriptions
242 add_action( 'bbp_spam_topic', 'bbp_remove_topic_from_all_subscriptions' );
243 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_subscriptions' );
244 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_subscriptions' );
245 add_action( 'bbp_trash_forum', 'bbp_remove_forum_from_all_subscriptions' );
246 add_action( 'bbp_delete_forum', 'bbp_remove_forum_from_all_subscriptions' );
247
248 // Subscription notifications
249 add_action( 'bbp_new_reply', 'bbp_notify_topic_subscribers', 11, 5 );
250 add_action( 'bbp_new_topic', 'bbp_notify_forum_subscribers', 11, 4 );
251
252 // Sticky
253 add_action( 'bbp_stick_topic', 'bbp_unstick_topic' );
254 add_action( 'bbp_unapprove_topic', 'bbp_unstick_topic' );
255 add_action( 'bbp_spam_topic', 'bbp_unstick_topic' );
256 add_action( 'bbp_trash_topic', 'bbp_unstick_topic' );
257 add_action( 'bbp_delete_topic', 'bbp_unstick_topic' );
258
259 // Update topic branch
260 add_action( 'bbp_trashed_topic', 'bbp_update_topic_walker' );
261 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_walker' );
262 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' );
263 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' );
264 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' );
265 add_action( 'bbp_approved_topic', 'bbp_update_topic_walker' );
266 add_action( 'bbp_unapproved_topic', 'bbp_update_topic_walker' );
267
268 // Update reply branch
269 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' );
270 add_action( 'bbp_untrashed_reply', 'bbp_update_reply_walker' );
271 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' );
272 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' );
273 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' );
274 add_action( 'bbp_approved_reply', 'bbp_update_reply_walker' );
275 add_action( 'bbp_unapproved_reply', 'bbp_update_reply_walker' );
276
277 // Update forum reply counts
278 add_action( 'bbp_new_reply', 'bbp_increase_forum_reply_count' );
279 add_action( 'bbp_untrashed_reply', 'bbp_increase_forum_reply_count' );
280 add_action( 'bbp_unspammed_reply', 'bbp_increase_forum_reply_count' );
281 add_action( 'bbp_approved_reply', 'bbp_increase_forum_reply_count' );
282 add_action( 'bbp_trash_reply', 'bbp_decrease_forum_reply_count' );
283 add_action( 'bbp_spam_reply', 'bbp_decrease_forum_reply_count' );
284 add_action( 'bbp_unapprove_reply', 'bbp_decrease_forum_reply_count' );
285
286 // Update forum hidden reply counts
287 add_action( 'bbp_trashed_reply', 'bbp_increase_forum_reply_count_hidden' );
288 add_action( 'bbp_spammed_reply', 'bbp_increase_forum_reply_count_hidden' );
289 add_action( 'bbp_unapproved_reply', 'bbp_increase_forum_reply_count_hidden' );
290 add_action( 'bbp_untrash_reply', 'bbp_decrease_forum_reply_count_hidden' );
291 add_action( 'bbp_unspam_reply', 'bbp_decrease_forum_reply_count_hidden' );
292 add_action( 'bbp_approve_reply', 'bbp_decrease_forum_reply_count_hidden' );
293 add_action( 'bbp_delete_reply', 'bbp_decrease_forum_reply_count_hidden' );
294
295 // Update forum topic counts
296 add_action( 'bbp_new_topic', 'bbp_increase_forum_topic_count' );
297 add_action( 'bbp_untrashed_topic', 'bbp_increase_forum_topic_count' );
298 add_action( 'bbp_unspammed_topic', 'bbp_increase_forum_topic_count' );
299 add_action( 'bbp_approved_topic', 'bbp_increase_forum_topic_count' );
300 add_action( 'bbp_trash_topic', 'bbp_decrease_forum_topic_count' );
301 add_action( 'bbp_spam_topic', 'bbp_decrease_forum_topic_count' );
302 add_action( 'bbp_unapprove_topic', 'bbp_decrease_forum_topic_count' );
303
304 // Update forum hidden topic counts
305 add_action( 'bbp_trashed_topic', 'bbp_increase_forum_topic_count_hidden' );
306 add_action( 'bbp_spammed_topic', 'bbp_increase_forum_topic_count_hidden' );
307 add_action( 'bbp_unapproved_topic', 'bbp_increase_forum_topic_count_hidden' );
308 add_action( 'bbp_untrash_topic', 'bbp_decrease_forum_topic_count_hidden' );
309 add_action( 'bbp_unspam_topic', 'bbp_decrease_forum_topic_count_hidden' );
310 add_action( 'bbp_approve_topic', 'bbp_decrease_forum_topic_count_hidden' );
311 add_action( 'bbp_delete_topic', 'bbp_decrease_forum_topic_count_hidden' );
312
313 // Update topic reply counts
314 add_action( 'bbp_new_reply', 'bbp_increase_topic_reply_count' );
315 add_action( 'bbp_untrashed_reply', 'bbp_increase_topic_reply_count' );
316 add_action( 'bbp_unspammed_reply', 'bbp_increase_topic_reply_count' );
317 add_action( 'bbp_approved_reply', 'bbp_increase_topic_reply_count' );
318 add_action( 'bbp_trash_reply', 'bbp_decrease_topic_reply_count' );
319 add_action( 'bbp_spam_reply', 'bbp_decrease_topic_reply_count' );
320 add_action( 'bbp_unapprove_reply', 'bbp_decrease_topic_reply_count' );
321
322 // Update topic hidden reply counts
323 add_action( 'bbp_trashed_reply', 'bbp_increase_topic_reply_count_hidden' );
324 add_action( 'bbp_unapproved_reply', 'bbp_increase_topic_reply_count_hidden' );
325 add_action( 'bbp_spammed_reply', 'bbp_increase_topic_reply_count_hidden' );
326 add_action( 'bbp_untrash_reply', 'bbp_decrease_topic_reply_count_hidden' );
327 add_action( 'bbp_unspam_reply', 'bbp_decrease_topic_reply_count_hidden' );
328 add_action( 'bbp_approve_reply', 'bbp_decrease_topic_reply_count_hidden' );
329 add_action( 'bbp_delete_reply', 'bbp_decrease_topic_reply_count_hidden' );
330
331 // Update forum reply counts for approved/unapproved topics
332 add_action( 'bbp_approved_topic', 'bbp_approved_unapproved_topic_update_forum_reply_count' );
333 add_action( 'bbp_unapproved_topic', 'bbp_approved_unapproved_topic_update_forum_reply_count' );
334
335 // Users topic & reply counts
336 add_action( 'bbp_new_topic', 'bbp_increase_user_topic_count' );
337 add_action( 'bbp_new_reply', 'bbp_increase_user_reply_count' );
338 add_action( 'bbp_untrash_topic', 'bbp_increase_user_topic_count' );
339 add_action( 'bbp_untrash_reply', 'bbp_increase_user_reply_count' );
340 add_action( 'bbp_unspam_topic', 'bbp_increase_user_topic_count' );
341 add_action( 'bbp_unspam_reply', 'bbp_increase_user_reply_count' );
342 add_action( 'bbp_trash_topic', 'bbp_decrease_user_topic_count' );
343 add_action( 'bbp_trash_reply', 'bbp_decrease_user_reply_count' );
344 add_action( 'bbp_spam_topic', 'bbp_decrease_user_topic_count' );
345 add_action( 'bbp_spam_reply', 'bbp_decrease_user_reply_count' );
346
347 // Topic status transition helpers for replies
348 add_action( 'bbp_trash_topic', 'bbp_trash_topic_replies' );
349 add_action( 'bbp_untrash_topic', 'bbp_untrash_topic_replies' );
350 add_action( 'bbp_delete_topic', 'bbp_delete_topic_replies' );
351 add_action( 'bbp_spam_topic', 'bbp_spam_topic_replies' );
352 add_action( 'bbp_unspam_topic', 'bbp_unspam_topic_replies' );
353
354 // Topic engagements on user creation
355 add_action( 'bbp_new_topic', 'bbp_update_topic_engagements', 20 );
356 add_action( 'bbp_new_reply', 'bbp_update_topic_engagements', 20 );
357
358 add_action( 'bbp_new_reply', 'bbp_update_topic_voice_count', 30 );
359 add_action( 'bbp_new_topic', 'bbp_update_topic_voice_count', 30 );
360
361 // Topic/reply counts on code insert (unit tests)
362 add_action( 'bbp_insert_topic', 'bbp_insert_topic_update_counts', 10, 2 );
363 add_action( 'bbp_insert_reply', 'bbp_insert_reply_update_counts', 10, 3 );
364
365 // Topic engagements on code insert (unit tests)
366 add_action( 'bbp_insert_topic', 'bbp_update_topic_engagements', 20 );
367 add_action( 'bbp_insert_reply', 'bbp_update_topic_engagements', 20 );
368
369 // Topic engagement counts on code insert (unit tests)
370 add_action( 'bbp_insert_topic', 'bbp_update_topic_voice_count', 30 );
371 add_action( 'bbp_insert_reply', 'bbp_update_topic_voice_count', 30 );
372
373 // Recalculate engagements
374 add_action( 'bbp_trashed_reply', 'bbp_recalculate_topic_engagements' );
375 add_action( 'bbp_untrashed_reply', 'bbp_recalculate_topic_engagements' );
376 add_action( 'bbp_spammed_reply', 'bbp_recalculate_topic_engagements' );
377 add_action( 'bbp_unspammed_reply', 'bbp_recalculate_topic_engagements' );
378 add_action( 'bbp_approved_reply', 'bbp_recalculate_topic_engagements' );
379 add_action( 'bbp_unapproved_reply', 'bbp_recalculate_topic_engagements' );
380 add_action( 'bbp_deleted_reply', 'bbp_recalculate_topic_engagements' );
381 add_action( 'bbp_trashed_topic', 'bbp_recalculate_topic_engagements' );
382 add_action( 'bbp_untrashed_topic', 'bbp_recalculate_topic_engagements' );
383 add_action( 'bbp_spammed_topic', 'bbp_recalculate_topic_engagements' );
384 add_action( 'bbp_unspammed_topic', 'bbp_recalculate_topic_engagements' );
385 add_action( 'bbp_approved_topic', 'bbp_recalculate_topic_engagements' );
386 add_action( 'bbp_unapproved_topic', 'bbp_recalculate_topic_engagements' );
387 add_action( 'bbp_deleted_topic', 'bbp_recalculate_topic_engagements' );
388
389 // Update engagement counts
390 add_action( 'bbp_trashed_reply', 'bbp_update_topic_voice_count', 30 );
391 add_action( 'bbp_untrashed_reply', 'bbp_update_topic_voice_count', 30 );
392 add_action( 'bbp_spammed_reply', 'bbp_update_topic_voice_count', 30 );
393 add_action( 'bbp_unspammed_reply', 'bbp_update_topic_voice_count', 30 );
394 add_action( 'bbp_approved_reply', 'bbp_update_topic_voice_count', 30 );
395 add_action( 'bbp_unapproved_reply', 'bbp_update_topic_voice_count', 30 );
396 add_action( 'bbp_deleted_reply', 'bbp_update_topic_voice_count', 30 );
397 add_action( 'bbp_trashed_topic', 'bbp_update_topic_voice_count', 30 );
398 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_voice_count', 30 );
399 add_action( 'bbp_spammed_topic', 'bbp_update_topic_voice_count', 30 );
400 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_voice_count', 30 );
401 add_action( 'bbp_approved_topic', 'bbp_update_topic_voice_count', 30 );
402 add_action( 'bbp_unapproved_topic', 'bbp_update_topic_voice_count', 30 );
403 add_action( 'bbp_deleted_topic', 'bbp_update_topic_voice_count', 30 );
404
405 // User status
406 // @todo make these sub-actions
407 add_action( 'make_ham_user', 'bbp_make_ham_user' );
408 add_action( 'make_spam_user', 'bbp_make_spam_user' );
409
410 // User role
411 add_action( 'bbp_profile_update', 'bbp_profile_update_role' );
412
413 // Hook WordPress admin actions to bbPress profiles on save
414 add_action( 'bbp_user_edit_after', 'bbp_user_edit_after' );
415
416 // Clean bbPress post caches when WordPress's is cleaned
417 add_action( 'clean_post_cache', 'bbp_clean_post_cache', 10, 2 );
418
419 // User Registration
420 add_action( 'added_existing_user', 'bbp_user_add_role_on_register', 10, 1 );
421 add_action( 'bbp_user_register', 'bbp_user_add_role_on_register', 10, 1 );
422
423 // Invite a New User
424 add_action( 'invite_user', 'bbp_user_add_role_on_invite', 10, 3 );
425
426 // Multisite Activation (does not work in wp-activate.php)
427 add_action( 'wpmu_activate_user', 'bbp_user_add_role_on_activate', 10, 3 );
428
429 /**
430 * bbPress needs to redirect the user around in a few different circumstances:
431 *
432 * 1. POST and GET requests
433 * 2. Accessing private or hidden content (forums/topics/replies)
434 * 3. Editing forums, topics, replies, users, and tags
435 * 4. bbPress specific AJAX requests
436 */
437 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_blocked', 1 );
438 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_hidden', 1 );
439 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_private', 1 );
440 add_action( 'bbp_template_redirect', 'bbp_post_request', 10 );
441 add_action( 'bbp_template_redirect', 'bbp_get_request', 10 );
442 add_action( 'bbp_template_redirect', 'bbp_check_user_edit', 10 );
443 add_action( 'bbp_template_redirect', 'bbp_check_forum_edit', 10 );
444 add_action( 'bbp_template_redirect', 'bbp_check_topic_edit', 10 );
445 add_action( 'bbp_template_redirect', 'bbp_check_reply_edit', 10 );
446 add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 );
447
448 // Must be after bbp_template_include_theme_compat
449 add_action( 'bbp_template_redirect', 'bbp_remove_adjacent_posts', 10 );
450
451 // Theme-side POST requests
452 add_action( 'bbp_post_request', 'bbp_do_ajax', 1 );
453 add_action( 'bbp_post_request', 'bbp_edit_topic_tag_handler', 1 );
454 add_action( 'bbp_post_request', 'bbp_edit_user_handler', 1 );
455 add_action( 'bbp_post_request', 'bbp_edit_forum_handler', 1 );
456 add_action( 'bbp_post_request', 'bbp_edit_reply_handler', 1 );
457 add_action( 'bbp_post_request', 'bbp_edit_topic_handler', 1 );
458 add_action( 'bbp_post_request', 'bbp_merge_topic_handler', 1 );
459 add_action( 'bbp_post_request', 'bbp_split_topic_handler', 1 );
460 add_action( 'bbp_post_request', 'bbp_move_reply_handler', 1 );
461 add_action( 'bbp_post_request', 'bbp_new_forum_handler', 10 );
462 add_action( 'bbp_post_request', 'bbp_new_reply_handler', 10 );
463 add_action( 'bbp_post_request', 'bbp_new_topic_handler', 10 );
464
465 // Theme-side GET requests
466 add_action( 'bbp_get_request', 'bbp_toggle_topic_handler', 1 );
467 add_action( 'bbp_get_request', 'bbp_toggle_reply_handler', 1 );
468 add_action( 'bbp_get_request', 'bbp_favorites_handler', 1 );
469 add_action( 'bbp_get_request', 'bbp_subscriptions_handler', 1 );
470 add_action( 'bbp_get_request', 'bbp_user_email_change_handler', 1 );
471 add_action( 'bbp_get_request', 'bbp_search_results_redirect', 10 );
472
473 // Maybe convert the users password
474 add_action( 'bbp_login_form_login', 'bbp_user_maybe_convert_pass' );
475