Ticket #5021: 5021.02.2.patch
File 5021.02.2.patch, 2.2 KB (added by , 12 years ago) |
---|
-
bp-core/bp-core-template-loader.php
function bp_get_template_stack() { 202 202 function bp_buffer_template_part( $slug, $name = null, $echo = true ) { 203 203 ob_start(); 204 204 205 // Remove 'bp_replace_the_content' filter to prevent infinite loops206 remove_filter( 'the_content', 'bp_replace_the_content' );207 208 205 bp_get_template_part( $slug, $name ); 209 206 210 // Remove 'bp_replace_the_content' filter to prevent infinite loops211 add_filter( 'the_content', 'bp_replace_the_content' );212 213 207 // Get the output buffer contents 214 208 $output = ob_get_contents(); 215 209 216 210 // Flush the output buffer 217 211 ob_end_clean(); 218 212 213 // Remove our filter just in case there are other post loops 214 // after this one is rendered 215 remove_filter( 'the_content', 'bp_replace_the_content' ); 216 219 217 // Echo or return the output buffer contents 220 218 if ( true === $echo ) { 221 219 echo $output; -
bp-core/bp-core-theme-compatibility.php
function bp_template_include_theme_compat( $template = '' ) { 521 521 */ 522 522 if ( bp_is_theme_compat_active() ) { 523 523 524 // Remove all filters from the_content525 bp_remove_all_filters( 'the_content' );526 527 // Add a filter on the_content late, which we will later remove528 if ( ! has_filter( 'the_content', 'bp_replace_the_content' ) ) {524 // After the_post() is called, remove all filters from 'the_content'. 525 // Next, add our filter to 'the_content' so BP can inject its contents. 526 // This is the latest we can run this before we do our object buffering 527 add_action( 'loop_start', create_function( '', " 528 bp_remove_all_filters( 'the_content' ); 529 529 add_filter( 'the_content', 'bp_replace_the_content' ); 530 } 530 " ), 9999 ); 531 532 // Restore the filters after the post loop is finished 533 add_action( 'loop_end', create_function( '', " 534 bp_restore_all_filters( 'the_content' ); 535 " ), 0 ); 531 536 532 537 // Add BuddyPress's head action to wp_head 533 538 if ( ! has_action( 'wp_head', 'bp_head' ) ) {