Skip to:
Content

BuddyPress.org

Ticket #5021: 5021.2.patch

File 5021.2.patch, 1.3 KB (added by johnjamesjacoby, 11 years ago)

Adds in_the_loop() calls

  • bp-core-template-loader.php

     
    396396        );
    397397        return bp_get_query_template( 'buddypress', $templates );
    398398}
     399
     400/**
     401 * Helper function to conditionally toggle the_content filters in the main
     402 * query loop. Aids with theme compatibility.
     403 *
     404 * @since BuddyPress (1.8)
     405 * @internal Used only by theme compatibilty
     406 * @see bp_template_include_theme_compat()
     407 * @see bp_theme_compat_main_loop_end()
     408 */
     409function bp_theme_compat_main_loop_start() {
     410
     411        // Bail if not the main query
     412        if ( ! in_the_loop() || ! is_main_query() )
     413                return;
     414
     415        // Remove all of the filters from the_content
     416        bp_remove_all_filters( 'the_content' );
     417
     418        // Make sure we replace the content
     419        add_filter( 'the_content', 'bp_replace_the_content' );
     420}
     421
     422/**
     423 * Helper function to conditionally toggle the_content filters in the main
     424 * query loop. Aids with theme compatibility.
     425 *
     426 * @since BuddyPress (1.8)
     427 * @internal Used only by theme compatibilty
     428 * @see bp_template_include_theme_compat()
     429 * @see bp_theme_compat_main_loop_start()
     430 */
     431function bp_theme_compat_main_loop_end() {
     432
     433        // Bail if not the main query
     434        if ( ! in_the_loop() || ! is_main_query() )
     435                return;
     436
     437        // Put all the filters back
     438        bp_restore_all_filters( 'the_content' );
     439}