Skip to:
Content

BuddyPress.org

Changeset 3884


Ignore:
Timestamp:
01/24/2011 10:23:57 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Adjust bp_is_current_component and bp_core_load_template to look for page templates as root_slug's too

Location:
trunk/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-catchuri.php

    r3835 r3884  
    235235
    236236    // Determine if the root object WP page exists for this request (TODO: is there an API function for this?
    237     if ( !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) )
     237    if ( !empty( $bp_unfiltered_uri_offset ) && !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) )
    238238        return false;
    239239
  • trunk/bp-core/bp-core-template.php

    r3829 r3884  
    670670            }
    671671        }
     672
     673    // Page template fallback check if $bp->current_component is empty
     674    } elseif ( is_page() ) {
     675        global $wp_query;
     676        $page          = $wp_query->get_queried_object();
     677        $custom_fields = get_post_custom_values( '_wp_page_template', $page->ID );
     678        $page_template = $custom_fields[0];
     679
     680        // Component name is in the page template name
     681        if ( strstr( strtolower( $page_template ), strtolower( $component ) ) )
     682            $is_current_component = true;
    672683    }
    673684
Note: See TracChangeset for help on using the changeset viewer.