Changeset 3583 for trunk/bp-core/bp-core-catchuri.php
- Timestamp:
- 12/25/2010 06:01:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r3539 r3583 106 106 // Reset the keys by merging with an empty array 107 107 $bp_uri = array_merge( array(), $bp_uri ); 108 $bp_unfiltered_uri = $bp_uri;109 108 110 109 // If a component is set to the front page, force its name into $bp_uri so that $current_component is populated … … 114 113 $bp_uri[0] = $post->post_name; 115 114 } 115 116 $bp_unfiltered_uri = $bp_uri; 116 117 117 118 // Find a match within registered BuddyPress controlled WP pages (check members first) … … 229 230 */ 230 231 function bp_core_load_template( $templates ) { 231 global $ bp, $wpdb, $wp_query, $bp_unfiltered_uri, $bp_unfiltered_uri_offset;232 global $post, $bp, $wpdb, $wp_query, $bp_unfiltered_uri, $bp_unfiltered_uri_offset; 232 233 233 234 // Determine if the root object WP page exists for this request (TODO: is there an API function for this? 234 if ( !empty( $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) 235 if ( !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) ) 236 return false; 235 if ( !$page_exists = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s", $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) ) ) 236 return false; 237 238 // Set the root object as the current wp_query-ied item 239 $object_id = 0; 240 foreach ( (array)$bp->pages as $page ) { 241 if ( isset( $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) && $page->name == $bp_unfiltered_uri[$bp_unfiltered_uri_offset] ) 242 $object_id = $page->id; 243 } 244 245 // Make the queried/post object an actual valid page 246 if ( !empty( $object_id ) ) { 247 $wp_query->queried_object = &get_post( $object_id ); 248 $wp_query->queried_object_id = $object_id; 249 250 $post = $wp_query->queried_object; 251 } 237 252 238 253 // Fetch each template and add the php suffix … … 241 256 242 257 // Filter the template locations so that plugins can alter where they are located 243 if ( $located_template = apply_filters( 'bp_located_template', locate_template( (array) $filtered_templates, false ), $filtered_templates ) ) 258 if ( $located_template = apply_filters( 'bp_located_template', locate_template( (array) $filtered_templates, false ), $filtered_templates ) ) { 259 // Template was located, lets set this as a valid page and not a 404. 260 status_header( 200 ); 261 $wp_query->is_page = true; 262 $wp_query->is_404 = false; 263 244 264 load_template( apply_filters( 'bp_load_template', $located_template ) ); 265 } 245 266 246 267 // Kill any other output after this.
Note: See TracChangeset
for help on using the changeset viewer.