. * * Hooked to 'wp_head'. * * @since 1.6.0 */ function bp_head() { /** * Fires inside the 'bp_head' function, which runs on 'wp_head'. * * @since 1.6.0 */ do_action( 'bp_head' ); } /** Theme Permissions *********************************************************/ /** * Fire the 'bp_template_redirect' action. * * Run at 'template_redirect', just before WordPress selects and loads a theme * template. The main purpose of this hook in BuddyPress is to redirect users * who do not have the proper permission to access certain content. * * @since 1.6.0 */ function bp_template_redirect() { /** * Fires inside the 'bp_template_redirect' function. * * @since 1.6.0 */ do_action( 'bp_template_redirect' ); } /** Theme Helpers *************************************************************/ /** * Fire the 'bp_register_theme_directory' action. * * The main action used registering theme directories. * * @since 1.5.0 */ function bp_register_theme_directory() { /** * Fires inside the 'bp_register_theme_directory' function. * * The main action used registering theme directories. * * @since 1.7.0 */ do_action( 'bp_register_theme_directory' ); } /** * Fire the 'bp_register_theme_packages' action. * * The main action used registering theme packages. * * @since 1.7.0 */ function bp_register_theme_packages() { /** * Fires inside the 'bp_register_theme_packages' function. * * @since 1.7.0 */ do_action( 'bp_register_theme_packages' ); } /** * Fire the 'bp_enqueue_scripts' action, where BP enqueues its CSS and JS. * * @since 1.6.0 */ function bp_enqueue_scripts() { /** * Fires inside the 'bp_enqueue_scripts' function, where BP enqueues its CSS and JS. * * @since 1.6.0 */ do_action( 'bp_enqueue_scripts' ); } /** * Fires the 'bp_enqueue_embed_scripts' action in the for BP oEmbeds. * * @since 2.6.0 */ function bp_enqueue_embed_scripts() { if ( ! is_buddypress() ) { return; } /** * Enqueue CSS and JS files for BuddyPress embeds. * * @since 2.6.0 */ do_action( 'bp_enqueue_embed_scripts' ); } /** * Fire the 'bp_add_rewrite_tag' action, where BP adds its custom rewrite tags. * * @since 1.8.0 */ function bp_add_rewrite_tags() { /** * Fires inside the 'bp_add_rewrite_tags' function, where BP adds its custom rewrite tags. * * @since 1.8.0 */ do_action( 'bp_add_rewrite_tags' ); } /** * Fire the 'bp_add_rewrite_rules' action, where BP adds its custom rewrite rules. * * @since 1.9.0 */ function bp_add_rewrite_rules() { /** * Fires inside the 'bp_add_rewrite_rules' function, where BP adds its custom rewrite rules. * * @since 1.9.0 */ do_action( 'bp_add_rewrite_rules' ); } /** * Fire the 'bp_add_permastructs' action, where BP adds its BP-specific permalink structure. * * @since 1.9.0 */ function bp_add_permastructs() { /** * Fires inside the 'bp_add_permastructs' function, where BP adds its BP-specific permalink structure. * * @since 1.9.0 */ do_action( 'bp_add_permastructs' ); } /** * Fire the 'bp_setup_theme' action. * * The main purpose of 'bp_setup_theme' is give themes a place to load their * BuddyPress-specific functionality. * * @since 1.6.0 */ function bp_setup_theme() { /** * Fires inside the 'bp_setup_theme' function. * * @since 1.6.0 */ do_action( 'bp_setup_theme' ); } /** * Fire the 'bp_after_setup_theme' action. * * Piggy-back action for BuddyPress-specific theme actions once the theme has * been set up and the theme's functions.php has loaded. * * Hooked to 'after_setup_theme' with a priority of 100. This allows plenty of * time for other themes to load their features, such as BuddyPress support, * before our theme compatibility layer kicks in. * * @since 1.6.0 */ function bp_after_setup_theme() { /** * Fires inside the 'bp_after_setup_theme' function. * * @since 1.7.0 */ do_action( 'bp_after_setup_theme' ); } /** Theme Compatibility Filter ************************************************/ /** * Fire the 'bp_request' filter, a piggy-back of WP's 'request'. * * @since 1.7.0 * * @see WP::parse_request() for a description of parameters. * * @param array $query_vars See {@link WP::parse_request()}. * @return array $query_vars See {@link WP::parse_request()}. */ function bp_request( $query_vars = array() ) { /** * Filters the query_vars for the current request. * * @since 1.7.0 * * @param array $query_vars Array of query variables. */ return apply_filters( 'bp_request', $query_vars ); } /** * Fire the 'bp_login_redirect' filter, a piggy-back of WP's 'login_redirect'. * * @since 1.7.0 * * @param string $redirect_to See 'login_redirect'. * @param string $redirect_to_raw See 'login_redirect'. * @param bool $user See 'login_redirect'. * @return string */ function bp_login_redirect( $redirect_to = '', $redirect_to_raw = '', $user = false ) { /** * Filters the URL to redirect to after login. * * @since 1.7.0 * * @param string $redirect_to The redirect destination URL. * @param string $redirect_to_raw The requested redirect destination URL passed as a parameter. * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. */ return apply_filters( 'bp_login_redirect', $redirect_to, $redirect_to_raw, $user ); } /** * Fire 'bp_template_include', main filter used for theme compatibility and displaying custom BP theme files. * * Hooked to 'template_include'. * * @since 1.6.0 * * @param string $template See 'template_include'. * @return string Template file to use. */ function bp_template_include( $template = '' ) { /** * Filters the template to use with template_include. * * @since 1.6.0 * * @param string $template The path of the template to include. */ return apply_filters( 'bp_template_include', $template ); } /** * Fire the 'bp_generate_rewrite_rules' action, where BP generates its rewrite rules. * * @since 1.7.0 * * @param WP_Rewrite $wp_rewrite See 'generate_rewrite_rules'. */ function bp_generate_rewrite_rules( $wp_rewrite ) { /** * Fires inside the 'bp_generate_rewrite_rules' function. * * @since 1.7.0 * * @param WP_Rewrite $wp_rewrite WP_Rewrite object. Passed by reference. */ do_action_ref_array( 'bp_generate_rewrite_rules', array( &$wp_rewrite ) ); } /** * Fire the 'bp_allowed_themes' filter. * * Filter the allowed themes list for BuddyPress-specific themes. * * @since 1.7.0 * * @param array $themes The path of the template to include. * @return array */ function bp_allowed_themes( $themes ) { /** * Filters the allowed themes list for BuddyPress-specific themes. * * @since 1.7.0 * * @param string $template The path of the template to include. */ return apply_filters( 'bp_allowed_themes', $themes ); } /** Requests ******************************************************************/ /** * The main action used for handling theme-side POST requests. * * @since 1.9.0 */ function bp_post_request() { // Bail if not a POST action. if ( ! bp_is_post_request() ) { return; } // Bail if no action. if ( empty( $_POST['action'] ) ) { return; } // Sanitize the POST action. $action = sanitize_key( $_POST['action'] ); /** * Fires at the end of the bp_post_request function. * * 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. * * @since 1.9.0 */ do_action( 'bp_post_request_' . $action ); /** * Fires at the end of the bp_post_request function. * * Use this static action if you don't mind checking the 'action' yourself. * * @since 1.9.0 * * @param string $action The action being run. */ do_action( 'bp_post_request', $action ); } /** * The main action used for handling theme-side GET requests. * * @since 1.9.0 */ function bp_get_request() { // Bail if not a POST action. if ( ! bp_is_get_request() ) { return; } // Bail if no action. if ( empty( $_GET['action'] ) ) { return; } // Sanitize the GET action. $action = sanitize_key( $_GET['action'] ); /** * Fires at the end of the bp_get_request function. * * 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. * * @since 1.9.0 */ do_action( 'bp_get_request_' . $action ); /** * Fires at the end of the bp_get_request function. * * Use this static action if you don't mind checking the 'action' yourself. * * @since 1.9.0 * * @param string $action The action being run. */ do_action( 'bp_get_request', $action ); }