Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/20/2012 05:16:21 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Revert r5729 in favor of last known working check.

  • Fixes root profiles, again
  • Added inline doc why we manually query instead of using get_page_by_path()
  • Fixes #4000, again
  • Props johnjamesjacoby, blame johnjamesjacoby
File:
1 edited

Legend:

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

    r5767 r5810  
    343343 */
    344344function bp_core_load_template( $templates ) {
    345         global $post, $bp, $wp_query;
    346 
    347         // Bail if there is a uri offset but not a page in its place.
    348         // * Possibly root profiles are enabled
    349         if ( !empty( $bp->unfiltered_uri_offset ) ) {           
    350                 if ( ! get_page_by_path( $bp->unfiltered_uri[$bp->unfiltered_uri_offset] ) ) {
     345        global $post, $bp, $wp_query, $wpdb;
     346
     347        // Determine if the root object WP page exists for this request
     348        // note: get_page_by_path() breaks non-root pages
     349        if ( !empty( $bp->unfiltered_uri_offset ) ) {
     350                if ( !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp->unfiltered_uri[$bp->unfiltered_uri_offset] ) ) ) {
    351351                        return false;
    352352                }
    353353        }
    354 
     354               
    355355        // Set the root object as the current wp_query-ied item
    356356        $object_id = 0;
Note: See TracChangeset for help on using the changeset viewer.