PluginProbe
bbPress / 2.6.6
bbPress v2.6.6
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 2.6.6, at includes/core/actions.php

466 lines 22.9 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_meta', 12 );
127
128 // Autoembeds
129 add_action( 'bbp_init', 'bbp_reply_content_autoembed', 8 );
130 add_action( 'bbp_init', 'bbp_topic_content_autoembed', 8 );
131
132 /**
133 * bbp_ready - attached to end 'bbp_init' above
134 *
135 * Attach actions to the ready action after bbPress has fully initialized.
136 * The load order helps to execute code at the correct time.
137 * v---Load order
138 */
139 add_action( 'bbp_ready', 'bbp_setup_akismet', 2 ); // Spam prevention for topics and replies
140 add_action( 'bp_include', 'bbp_setup_buddypress', 10 ); // Social network integration
141
142 // Try to load the bbpress-functions.php file from the active themes
143 add_action( 'bbp_after_setup_theme', 'bbp_load_theme_functions', 10 );
144
145 // Widgets
146 add_action( 'bbp_widgets_init', array( 'BBP_Login_Widget', 'register_widget' ), 10 );
147 add_action( 'bbp_widgets_init', array( 'BBP_Views_Widget', 'register_widget' ), 10 );
148 add_action( 'bbp_widgets_init', array( 'BBP_Search_Widget', 'register_widget' ), 10 );
149 add_action( 'bbp_widgets_init', array( 'BBP_Forums_Widget', 'register_widget' ), 10 );
150 add_action( 'bbp_widgets_init', array( 'BBP_Topics_Widget', 'register_widget' ), 10 );
151 add_action( 'bbp_widgets_init', array( 'BBP_Replies_Widget', 'register_widget' ), 10 );
152 add_action( 'bbp_widgets_init', array( 'BBP_Stats_Widget', 'register_widget' ), 10 );
153
154 // Notices
155 add_action( 'bbp_template_notices', 'bbp_template_notices', 20 );
156 add_action( 'bbp_template_notices', 'bbp_login_notices' );
157 add_action( 'bbp_template_notices', 'bbp_topic_notices' );
158 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_success' );
159 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_pending_email' );
160 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_is_super_admin', 2 );
161
162 // Always exclude private/hidden forums if needed
163 add_action( 'pre_get_posts', 'bbp_pre_get_posts_normalize_forum_visibility', 4 );
164
165 // Before Delete/Trash/Untrash Forum
166 add_action( 'wp_trash_post', 'bbp_trash_forum' );
167 add_action( 'trash_post', 'bbp_trash_forum' );
168 add_action( 'untrash_post', 'bbp_untrash_forum' );
169 add_action( 'before_delete_post', 'bbp_delete_forum' );
170
171 // After Deleted/Trashed/Untrashed Forum
172 add_action( 'trashed_post', 'bbp_trashed_forum' );
173 add_action( 'untrashed_post', 'bbp_untrashed_forum' );
174 add_action( 'deleted_post', 'bbp_deleted_forum' );
175
176 // Auto trash/untrash/delete a forums topics
177 add_action( 'bbp_delete_forum', 'bbp_delete_forum_topics', 10 );
178 add_action( 'bbp_trash_forum', 'bbp_trash_forum_topics', 10 );
179 add_action( 'bbp_untrash_forum', 'bbp_untrash_forum_topics', 10 );
180
181 // New/Edit Forum
182 add_action( 'bbp_new_forum', 'bbp_update_forum', 10 );
183 add_action( 'bbp_edit_forum', 'bbp_update_forum', 10 );
184
185 // Save forum extra metadata
186 add_action( 'bbp_new_forum_post_extras', 'bbp_save_forum_extras', 2 );
187 add_action( 'bbp_edit_forum_post_extras', 'bbp_save_forum_extras', 2 );
188 add_action( 'bbp_forum_attributes_metabox_save', 'bbp_save_forum_extras', 2 );
189
190 // New/Edit Reply
191 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 7 );
192 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 7 );
193
194 // Before Delete/Trash/Untrash Reply
195 add_action( 'wp_trash_post', 'bbp_trash_reply' );
196 add_action( 'trash_post', 'bbp_trash_reply' );
197 add_action( 'untrash_post', 'bbp_untrash_reply' );
198 add_action( 'before_delete_post', 'bbp_delete_reply' );
199
200 // After Deleted/Trashed/Untrashed Reply
201 add_action( 'trashed_post', 'bbp_trashed_reply' );
202 add_action( 'untrashed_post', 'bbp_untrashed_reply' );
203 add_action( 'deleted_post', 'bbp_deleted_reply' );
204
205 // New/Edit Topic
206 add_action( 'bbp_new_topic', 'bbp_update_topic', 10, 5 );
207 add_action( 'bbp_edit_topic', 'bbp_update_topic', 10, 5 );
208
209 // Split/Merge Topic
210 add_action( 'bbp_merged_topic', 'bbp_merge_topic_count', 1, 3 );
211 add_action( 'bbp_post_split_topic', 'bbp_split_topic_count', 1, 3 );
212
213 // Move Reply
214 add_action( 'bbp_post_move_reply', 'bbp_move_reply_count', 1, 3 );
215
216 // Before Delete/Trash/Untrash Topic
217 add_action( 'wp_trash_post', 'bbp_trash_topic' );
218 add_action( 'trash_post', 'bbp_trash_topic' );
219 add_action( 'untrash_post', 'bbp_untrash_topic' );
220 add_action( 'before_delete_post', 'bbp_delete_topic' );
221
222 // After Deleted/Trashed/Untrashed Topic
223 add_action( 'trashed_post', 'bbp_trashed_topic' );
224 add_action( 'untrashed_post', 'bbp_untrashed_topic' );
225 add_action( 'deleted_post', 'bbp_deleted_topic' );
226
227 // Favorites
228 add_action( 'bbp_spam_topic', 'bbp_remove_topic_from_all_favorites' );
229 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_favorites' );
230 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_favorites' );
231
232 // Subscriptions
233 add_action( 'bbp_spam_topic', 'bbp_remove_topic_from_all_subscriptions' );
234 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_subscriptions' );
235 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_subscriptions' );
236 add_action( 'bbp_trash_forum', 'bbp_remove_forum_from_all_subscriptions' );
237 add_action( 'bbp_delete_forum', 'bbp_remove_forum_from_all_subscriptions' );
238
239 // Subscription notifications
240 add_action( 'bbp_new_reply', 'bbp_notify_topic_subscribers', 11, 5 );
241 add_action( 'bbp_new_topic', 'bbp_notify_forum_subscribers', 11, 4 );
242
243 // Sticky
244 add_action( 'bbp_stick_topic', 'bbp_unstick_topic' );
245 add_action( 'bbp_unapprove_topic', 'bbp_unstick_topic' );
246 add_action( 'bbp_spam_topic', 'bbp_unstick_topic' );
247 add_action( 'bbp_trash_topic', 'bbp_unstick_topic' );
248 add_action( 'bbp_delete_topic', 'bbp_unstick_topic' );
249
250 // Update topic branch
251 add_action( 'bbp_trashed_topic', 'bbp_update_topic_walker' );
252 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_walker' );
253 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' );
254 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' );
255 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' );
256 add_action( 'bbp_approved_topic', 'bbp_update_topic_walker' );
257 add_action( 'bbp_unapproved_topic', 'bbp_update_topic_walker' );
258
259 // Update reply branch
260 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' );
261 add_action( 'bbp_untrashed_reply', 'bbp_update_reply_walker' );
262 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' );
263 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' );
264 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' );
265 add_action( 'bbp_approved_reply', 'bbp_update_reply_walker' );
266 add_action( 'bbp_unapproved_reply', 'bbp_update_reply_walker' );
267
268 // Update forum reply counts
269 add_action( 'bbp_new_reply', 'bbp_increase_forum_reply_count' );
270 add_action( 'bbp_untrashed_reply', 'bbp_increase_forum_reply_count' );
271 add_action( 'bbp_unspammed_reply', 'bbp_increase_forum_reply_count' );
272 add_action( 'bbp_approved_reply', 'bbp_increase_forum_reply_count' );
273 add_action( 'bbp_trash_reply', 'bbp_decrease_forum_reply_count' );
274 add_action( 'bbp_spam_reply', 'bbp_decrease_forum_reply_count' );
275 add_action( 'bbp_unapprove_reply', 'bbp_decrease_forum_reply_count' );
276
277 // Update forum hidden reply counts
278 add_action( 'bbp_trashed_reply', 'bbp_increase_forum_reply_count_hidden' );
279 add_action( 'bbp_spammed_reply', 'bbp_increase_forum_reply_count_hidden' );
280 add_action( 'bbp_unapproved_reply', 'bbp_increase_forum_reply_count_hidden' );
281 add_action( 'bbp_untrash_reply', 'bbp_decrease_forum_reply_count_hidden' );
282 add_action( 'bbp_unspam_reply', 'bbp_decrease_forum_reply_count_hidden' );
283 add_action( 'bbp_approve_reply', 'bbp_decrease_forum_reply_count_hidden' );
284 add_action( 'bbp_delete_reply', 'bbp_decrease_forum_reply_count_hidden' );
285
286 // Update forum topic counts
287 add_action( 'bbp_new_topic', 'bbp_increase_forum_topic_count' );
288 add_action( 'bbp_untrashed_topic', 'bbp_increase_forum_topic_count' );
289 add_action( 'bbp_unspammed_topic', 'bbp_increase_forum_topic_count' );
290 add_action( 'bbp_approved_topic', 'bbp_increase_forum_topic_count' );
291 add_action( 'bbp_trash_topic', 'bbp_decrease_forum_topic_count' );
292 add_action( 'bbp_spam_topic', 'bbp_decrease_forum_topic_count' );
293 add_action( 'bbp_unapprove_topic', 'bbp_decrease_forum_topic_count' );
294
295 // Update forum hidden topic counts
296 add_action( 'bbp_trashed_topic', 'bbp_increase_forum_topic_count_hidden' );
297 add_action( 'bbp_spammed_topic', 'bbp_increase_forum_topic_count_hidden' );
298 add_action( 'bbp_unapproved_topic', 'bbp_increase_forum_topic_count_hidden' );
299 add_action( 'bbp_untrash_topic', 'bbp_decrease_forum_topic_count_hidden' );
300 add_action( 'bbp_unspam_topic', 'bbp_decrease_forum_topic_count_hidden' );
301 add_action( 'bbp_approve_topic', 'bbp_decrease_forum_topic_count_hidden' );
302 add_action( 'bbp_delete_topic', 'bbp_decrease_forum_topic_count_hidden' );
303
304 // Update topic reply counts
305 add_action( 'bbp_new_reply', 'bbp_increase_topic_reply_count' );
306 add_action( 'bbp_untrashed_reply', 'bbp_increase_topic_reply_count' );
307 add_action( 'bbp_unspammed_reply', 'bbp_increase_topic_reply_count' );
308 add_action( 'bbp_approved_reply', 'bbp_increase_topic_reply_count' );
309 add_action( 'bbp_trash_reply', 'bbp_decrease_topic_reply_count' );
310 add_action( 'bbp_spam_reply', 'bbp_decrease_topic_reply_count' );
311 add_action( 'bbp_unapprove_reply', 'bbp_decrease_topic_reply_count' );
312
313 // Update topic hidden reply counts
314 add_action( 'bbp_trashed_reply', 'bbp_increase_topic_reply_count_hidden' );
315 add_action( 'bbp_unapproved_reply', 'bbp_increase_topic_reply_count_hidden' );
316 add_action( 'bbp_spammed_reply', 'bbp_increase_topic_reply_count_hidden' );
317 add_action( 'bbp_untrash_reply', 'bbp_decrease_topic_reply_count_hidden' );
318 add_action( 'bbp_unspam_reply', 'bbp_decrease_topic_reply_count_hidden' );
319 add_action( 'bbp_approve_reply', 'bbp_decrease_topic_reply_count_hidden' );
320 add_action( 'bbp_delete_reply', 'bbp_decrease_topic_reply_count_hidden' );
321
322 // Update forum reply counts for approved/unapproved topics
323 add_action( 'bbp_approved_topic', 'bbp_approved_unapproved_topic_update_forum_reply_count' );
324 add_action( 'bbp_unapproved_topic', 'bbp_approved_unapproved_topic_update_forum_reply_count' );
325
326 // Users topic & reply counts
327 add_action( 'bbp_new_topic', 'bbp_increase_user_topic_count' );
328 add_action( 'bbp_new_reply', 'bbp_increase_user_reply_count' );
329 add_action( 'bbp_untrash_topic', 'bbp_increase_user_topic_count' );
330 add_action( 'bbp_untrash_reply', 'bbp_increase_user_reply_count' );
331 add_action( 'bbp_unspam_topic', 'bbp_increase_user_topic_count' );
332 add_action( 'bbp_unspam_reply', 'bbp_increase_user_reply_count' );
333 add_action( 'bbp_trash_topic', 'bbp_decrease_user_topic_count' );
334 add_action( 'bbp_trash_reply', 'bbp_decrease_user_reply_count' );
335 add_action( 'bbp_spam_topic', 'bbp_decrease_user_topic_count' );
336 add_action( 'bbp_spam_reply', 'bbp_decrease_user_reply_count' );
337
338 // Topic status transition helpers for replies
339 add_action( 'bbp_trash_topic', 'bbp_trash_topic_replies' );
340 add_action( 'bbp_untrash_topic', 'bbp_untrash_topic_replies' );
341 add_action( 'bbp_delete_topic', 'bbp_delete_topic_replies' );
342 add_action( 'bbp_spam_topic', 'bbp_spam_topic_replies' );
343 add_action( 'bbp_unspam_topic', 'bbp_unspam_topic_replies' );
344
345 // Topic engagements on user creation
346 add_action( 'bbp_new_topic', 'bbp_update_topic_engagements', 20 );
347 add_action( 'bbp_new_reply', 'bbp_update_topic_engagements', 20 );
348
349 add_action( 'bbp_new_reply', 'bbp_update_topic_voice_count', 30 );
350 add_action( 'bbp_new_topic', 'bbp_update_topic_voice_count', 30 );
351
352 // Topic/reply counts on code insert (unit tests)
353 add_action( 'bbp_insert_topic', 'bbp_insert_topic_update_counts', 10, 2 );
354 add_action( 'bbp_insert_reply', 'bbp_insert_reply_update_counts', 10, 3 );
355
356 // Topic engagements on code insert (unit tests)
357 add_action( 'bbp_insert_topic', 'bbp_update_topic_engagements', 20 );
358 add_action( 'bbp_insert_reply', 'bbp_update_topic_engagements', 20 );
359
360 // Topic engagement counts on code insert (unit tests)
361 add_action( 'bbp_insert_topic', 'bbp_update_topic_voice_count', 30 );
362 add_action( 'bbp_insert_reply', 'bbp_update_topic_voice_count', 30 );
363
364 // Recalculate engagements
365 add_action( 'bbp_trashed_reply', 'bbp_recalculate_topic_engagements' );
366 add_action( 'bbp_untrashed_reply', 'bbp_recalculate_topic_engagements' );
367 add_action( 'bbp_spammed_reply', 'bbp_recalculate_topic_engagements' );
368 add_action( 'bbp_unspammed_reply', 'bbp_recalculate_topic_engagements' );
369 add_action( 'bbp_approved_reply', 'bbp_recalculate_topic_engagements' );
370 add_action( 'bbp_unapproved_reply', 'bbp_recalculate_topic_engagements' );
371 add_action( 'bbp_deleted_reply', 'bbp_recalculate_topic_engagements' );
372 add_action( 'bbp_trashed_topic', 'bbp_recalculate_topic_engagements' );
373 add_action( 'bbp_untrashed_topic', 'bbp_recalculate_topic_engagements' );
374 add_action( 'bbp_spammed_topic', 'bbp_recalculate_topic_engagements' );
375 add_action( 'bbp_unspammed_topic', 'bbp_recalculate_topic_engagements' );
376 add_action( 'bbp_approved_topic', 'bbp_recalculate_topic_engagements' );
377 add_action( 'bbp_unapproved_topic', 'bbp_recalculate_topic_engagements' );
378 add_action( 'bbp_deleted_topic', 'bbp_recalculate_topic_engagements' );
379
380 // Update engagement counts
381 add_action( 'bbp_trashed_reply', 'bbp_update_topic_voice_count', 30 );
382 add_action( 'bbp_untrashed_reply', 'bbp_update_topic_voice_count', 30 );
383 add_action( 'bbp_spammed_reply', 'bbp_update_topic_voice_count', 30 );
384 add_action( 'bbp_unspammed_reply', 'bbp_update_topic_voice_count', 30 );
385 add_action( 'bbp_approved_reply', 'bbp_update_topic_voice_count', 30 );
386 add_action( 'bbp_unapproved_reply', 'bbp_update_topic_voice_count', 30 );
387 add_action( 'bbp_deleted_reply', 'bbp_update_topic_voice_count', 30 );
388 add_action( 'bbp_trashed_topic', 'bbp_update_topic_voice_count', 30 );
389 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_voice_count', 30 );
390 add_action( 'bbp_spammed_topic', 'bbp_update_topic_voice_count', 30 );
391 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_voice_count', 30 );
392 add_action( 'bbp_approved_topic', 'bbp_update_topic_voice_count', 30 );
393 add_action( 'bbp_unapproved_topic', 'bbp_update_topic_voice_count', 30 );
394 add_action( 'bbp_deleted_topic', 'bbp_update_topic_voice_count', 30 );
395
396 // User status
397 // @todo make these sub-actions
398 add_action( 'make_ham_user', 'bbp_make_ham_user' );
399 add_action( 'make_spam_user', 'bbp_make_spam_user' );
400
401 // User role
402 add_action( 'bbp_profile_update', 'bbp_profile_update_role' );
403
404 // Hook WordPress admin actions to bbPress profiles on save
405 add_action( 'bbp_user_edit_after', 'bbp_user_edit_after' );
406
407 // Clean bbPress post caches when WordPress's is cleaned
408 add_action( 'clean_post_cache', 'bbp_clean_post_cache', 10, 2 );
409
410 // User Registration
411 add_action( 'added_existing_user', 'bbp_user_add_role_on_register', 10, 1 );
412 add_action( 'bbp_user_register', 'bbp_user_add_role_on_register', 10, 1 );
413
414 // Invite a New User
415 add_action( 'invite_user', 'bbp_user_add_role_on_invite', 10, 3 );
416
417 // Multisite Activation (does not work in wp-activate.php)
418 add_action( 'wpmu_activate_user', 'bbp_user_add_role_on_activate', 10, 3 );
419
420 /**
421 * bbPress needs to redirect the user around in a few different circumstances:
422 *
423 * 1. POST and GET requests
424 * 2. Accessing private or hidden content (forums/topics/replies)
425 * 3. Editing forums, topics, replies, users, and tags
426 * 4. bbPress specific AJAX requests
427 */
428 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_blocked', 1 );
429 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_hidden', 1 );
430 add_action( 'bbp_template_redirect', 'bbp_forum_enforce_private', 1 );
431 add_action( 'bbp_template_redirect', 'bbp_post_request', 10 );
432 add_action( 'bbp_template_redirect', 'bbp_get_request', 10 );
433 add_action( 'bbp_template_redirect', 'bbp_check_user_edit', 10 );
434 add_action( 'bbp_template_redirect', 'bbp_check_forum_edit', 10 );
435 add_action( 'bbp_template_redirect', 'bbp_check_topic_edit', 10 );
436 add_action( 'bbp_template_redirect', 'bbp_check_reply_edit', 10 );
437 add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 );
438
439 // Must be after bbp_template_include_theme_compat
440 add_action( 'bbp_template_redirect', 'bbp_remove_adjacent_posts', 10 );
441
442 // Theme-side POST requests
443 add_action( 'bbp_post_request', 'bbp_do_ajax', 1 );
444 add_action( 'bbp_post_request', 'bbp_edit_topic_tag_handler', 1 );
445 add_action( 'bbp_post_request', 'bbp_edit_user_handler', 1 );
446 add_action( 'bbp_post_request', 'bbp_edit_forum_handler', 1 );
447 add_action( 'bbp_post_request', 'bbp_edit_reply_handler', 1 );
448 add_action( 'bbp_post_request', 'bbp_edit_topic_handler', 1 );
449 add_action( 'bbp_post_request', 'bbp_merge_topic_handler', 1 );
450 add_action( 'bbp_post_request', 'bbp_split_topic_handler', 1 );
451 add_action( 'bbp_post_request', 'bbp_move_reply_handler', 1 );
452 add_action( 'bbp_post_request', 'bbp_new_forum_handler', 10 );
453 add_action( 'bbp_post_request', 'bbp_new_reply_handler', 10 );
454 add_action( 'bbp_post_request', 'bbp_new_topic_handler', 10 );
455
456 // Theme-side GET requests
457 add_action( 'bbp_get_request', 'bbp_toggle_topic_handler', 1 );
458 add_action( 'bbp_get_request', 'bbp_toggle_reply_handler', 1 );
459 add_action( 'bbp_get_request', 'bbp_favorites_handler', 1 );
460 add_action( 'bbp_get_request', 'bbp_subscriptions_handler', 1 );
461 add_action( 'bbp_get_request', 'bbp_user_email_change_handler', 1 );
462 add_action( 'bbp_get_request', 'bbp_search_results_redirect', 10 );
463
464 // Maybe convert the users password
465 add_action( 'bbp_login_form_login', 'bbp_user_maybe_convert_pass' );
466