post_type, $post_types, true ) && ! in_array( $post_before->post_type, $post_types, true ) ) { return; } // Do the action do_action( 'bbp_post_updated', $post_id, $post_after, $post_before ); } /** User Actions **************************************************************/ /** * The main action for hooking into when a user account is updated * * @since 2.2.0 bbPress (r4304) * * @param int $user_id ID of user being edited * @param array $old_user_data The old, unmodified user data */ function bbp_profile_update( $user_id = 0, $old_user_data = array() ) { do_action( 'bbp_profile_update', $user_id, $old_user_data ); } /** * The main action for hooking into a user being registered * * @since 2.2.0 bbPress (r4304) * * @param int $user_id ID of user being edited */ function bbp_user_register( $user_id = 0 ) { do_action( 'bbp_user_register', $user_id ); } /** Final Action **************************************************************/ /** * bbPress has loaded and initialized everything, and is okay to go * * @since 2.0.0 bbPress (r2618) */ function bbp_ready() { do_action( 'bbp_ready' ); } /** Theme Permissions *********************************************************/ /** * The main action used for redirecting bbPress theme actions that are not * permitted by the current_user * * @since 2.1.0 bbPress (r3605) */ function bbp_template_redirect() { do_action( 'bbp_template_redirect' ); } /** Theme Helpers *************************************************************/ /** * The main action used for executing code before the theme has been setup * * @since 2.1.0 bbPress (r3829) */ function bbp_register_theme_packages() { do_action( 'bbp_register_theme_packages' ); } /** * The main action used for executing code before the theme has been setup * * @since 2.1.0 bbPress (r3732) */ function bbp_setup_theme() { do_action( 'bbp_setup_theme' ); } /** * The main action used for executing code after the theme has been setup * * @since 2.1.0 bbPress (r3732) */ function bbp_after_setup_theme() { do_action( 'bbp_after_setup_theme' ); } /** * The main action used for handling theme-side POST requests * * @since 2.3.0 bbPress (r4550) */ function bbp_post_request() { // Bail if not a POST action if ( ! bbp_is_post_request() ) { return; } // Bail if no action, or if not a string (arrays not supported) if ( empty( $_POST['action'] ) || ! is_string( $_POST['action'] ) ) { return; } // Sanitize the POST action $action = sanitize_key( $_POST['action'] ); // Bail if action was totally invalid if ( empty( $action ) ) { return; } // This dynamic action is probably the one you want to use. It narrows down // the scope of the 'action' without needing to check it in your function. do_action( 'bbp_post_request_' . $action ); // Use this static action if you don't mind checking the 'action' yourself. do_action( 'bbp_post_request', $action ); } /** * The main action used for handling theme-side GET requests * * @since 2.3.0 bbPress (r4550) */ function bbp_get_request() { // Bail if not a POST action if ( ! bbp_is_get_request() ) { return; } // Bail if no action, or if not a string (arrays not supported) if ( empty( $_GET['action'] ) || ! is_string( $_GET['action'] ) ) { return; } // Sanitize the GET action $action = sanitize_key( $_GET['action'] ); // Bail if action was totally invalid if ( empty( $action ) ) { return; } // This dynamic action is probably the one you want to use. It narrows down // the scope of the 'action' without needing to check it in your function. do_action( 'bbp_get_request_' . $action ); // Use this static action if you don't mind checking the 'action' yourself. do_action( 'bbp_get_request', $action ); } /** Filters *******************************************************************/ /** * Filter the plugin locale and domain. * * @since 2.2.0 bbPress (r4213) * * @param string $locale * @param string $domain */ function bbp_plugin_locale( $locale = '', $domain = '' ) { // Filter & return return apply_filters( 'bbp_plugin_locale', $locale, $domain ); } /** * Piggy back filter for WordPress's 'request' filter * * @since 2.1.0 bbPress (r3758) * * @param array $query_vars * @return array */ function bbp_request( $query_vars = array() ) { // Filter & return return apply_filters( 'bbp_request', $query_vars ); } /** * The main filter used for theme compatibility and displaying custom bbPress * theme files. * * @since 2.0.0 bbPress (r3311) * * @param string $template * @return string Template file to use */ function bbp_template_include( $template = '' ) { // Filter & return return apply_filters( 'bbp_template_include', $template ); } /** * Generate bbPress-specific rewrite rules * * @since 2.0.0 bbPress (r2688) * * @deprecated 2.4.0 bbPress (r4918) * * @param WP_Rewrite $wp_rewrite */ function bbp_generate_rewrite_rules( $wp_rewrite ) { do_action_ref_array( 'bbp_generate_rewrite_rules', array( &$wp_rewrite ) ); } /** * Filter the allowed themes list for bbPress specific themes * * @since 2.0.0 bbPress (r2944) * * @param array $themes * * @return array Array of allowed themes */ function bbp_allowed_themes( $themes ) { // Filter & return return (array) apply_filters( 'bbp_allowed_themes', $themes ); } /** * Maps forum/topic/reply caps to built in WordPress caps * * @since 2.0.0 bbPress (r2593) * * @param array $caps Capabilities for meta capability * @param string $cap Capability name * @param int $user_id User id * @param array $args Arguments * * @return array Array of capabilities */ function bbp_map_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { // Filter & return return (array) apply_filters( 'bbp_map_meta_caps', $caps, $cap, $user_id, $args ); } /** * Filter the arguments used by wp_mail for bbPress specific emails * * @since 2.6.0 bbPress (r6918) * * @param array $args A compacted array of wp_mail() arguments, including the "to" email, * subject, message, headers, and attachments values. * * @return array Array of capabilities */ function bbp_mail( $args = array() ) { // Bail if headers are missing/malformed if ( empty( $args['headers'] ) || ! is_array( $args['headers'] ) ) { return $args; } // Header to search all headers for $bbp_header = bbp_get_email_header(); // Bail if no bbPress header found if ( false === array_search( $bbp_header, $args['headers'], true ) ) { return $args; } // Filter & return return (array) apply_filters( 'bbp_mail', $args ); }