Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/30/2013 10:58:46 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Iterate on theme compatibility content replacement order. Introduce bp_do_theme_compat() and other helper functions to avoid breaking on nested calls to the_content() or nested usages of 'the_content' filter.

Also, experiment with not adding/removing all_filters from 'the_content' for a bit, and see if any issues come up in testing with other plugins active.

See #5021.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template-loader.php

    r6824 r7131  
    212212
    213213    // Get the output buffer contents
    214     $output = ob_get_contents();
    215 
    216     // Flush the output buffer
    217     ob_end_clean();
     214    $output = ob_get_clean();
    218215
    219216    // Echo or return the output buffer contents
     
    342339    $new_template = apply_filters( 'bp_get_root_template', false, $template );
    343340
    344     // BuddyPress template file exists
     341    // A BuddyPress template file was located, so override the WordPress
     342    // template and use it to switch off BuddyPress's theme compatibility.
    345343    if ( !empty( $new_template ) ) {
    346 
    347         // Override the WordPress template with a BuddyPress one
    348         $template = $new_template;
    349 
    350         // @see: bp_template_include_theme_compat()
    351         buddypress()->theme_compat->found_template = true;
     344        $template = bbp_set_template_included( $new_template );
    352345    }
    353346
    354347    return apply_filters( 'bp_template_include_theme_supports', $template );
     348}
     349
     350/**
     351 * Set the included template
     352 *
     353 * @since BuddyPress (1.8)
     354 * @param mixed $template Default false
     355 * @return mixed False if empty. Template name if template included
     356 */
     357function bp_set_template_included( $template = false ) {
     358    buddypress()->theme_compat->found_template = $template;
     359
     360    return buddypress()->theme_compat->found_template;
     361}
     362
     363/**
     364 * Is a BuddyPress template being included?
     365 *
     366 * @since BuddyPress (1.8)
     367 * @return bool True if yes, false if no
     368 */
     369function bp_is_template_included() {
     370    return ! empty( buddypress()->theme_compat->found_template );
    355371}
    356372
Note: See TracChangeset for help on using the changeset viewer.