PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / trunk
Forumax – AI Powered Advanced Community Forum Plugin vtrunk
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / lib / bbpress / includes / core / actions.php

actions.php in Forumax – AI Powered Advanced Community Forum Plugin trunk, at lib/bbpress/includes/core/actions.php

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