current_component = 'activity'; } /** * Modify the template stack. Currently unused. * * @return void */ public function modify_template_stack() { if ( function_exists( 'bp_register_template_stack' ) ) { bp_register_template_stack( 'bp_tol_register_template_location', 5 ); } } /** * See if our shortcode exists on the current queried object. * * @return void */ public function check_for_shortcode() { if ( true === $this->feed_enabled ) { return; } $queried_object = get_queried_object(); if ( ! $queried_object ) { return; } if ( 'page' !== $queried_object->post_type ) { return; } if ( has_shortcode( $queried_object->post_content, 'activity_feed_anywhere' ) ) { buddypress()->current_component = 'activity'; $this->feed_enabled = true; } } /** * We need to tell BuddyPress that a page/post with our shortcode on, should have the activity component active. * * @param $is_current_component * @param $component * * @return bool|mixed */ public function enable_component( $is_current_component, $component ) { if ( function_exists( 'bp_duplicate_notice' ) && $this->feed_enabled ) { return true; } else { return $is_current_component; } } /** * Tell our shortcode-inclusive pages to spin up the Heartbeat. * * @param $retval * * @return bool|mixed */ public function enable_heartbeat( $retval ) { if ( $this->feed_enabled ) { return true; } else { return $retval; } } /** * Add classes to the body of Space pages, to assist with styling. * * @param $classes * * @return mixed */ public function add_body_classes( $classes ) { if ( $this->feed_enabled ) { $classes[] = 'activity buddypress activity-feed-anywhere'; } return $classes; } /** * Our shortcode. * * @param $atts */ public function add_shortcode( $atts ) { $a = shortcode_atts( array( 'feed' => true, 'postbox' => true, ), $atts ); if ( ! $this->feed_enabled ) { return; } // We need our feed to be part of the activity component buddypress()->current_component = 'activity'; ?>