Changeset 4110
- Timestamp:
- 03/11/2011 07:48:15 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r4107 r4110 179 179 } 180 180 } 181 182 // URLs with BP_ENABLE_ROOT_PROFILES enabled won't be caught above 183 if ( empty( $matches ) && defined( 'BP_ENABLE_ROOT_PROFILES' ) && BP_ENABLE_ROOT_PROFILES ) { 184 185 // Make sure there's a user corresponding to $bp_uri[0] 186 if ( !empty( $bp_uri[0] ) && $root_profile = get_userdatabylogin( $bp_uri[0] ) ) { 187 188 // Force BP to recognize that this is a members page 189 $matches[] = 1; 190 $match = $bp->pages->members; 191 $match->key = 'members'; 192 193 // Without the 'members' URL chunk, WordPress won't know which page to load 194 // This filter intercepts the WP query and tells it to load the members page 195 add_filter( 'request', create_function( '$query_args', '$query_args["pagename"] = "' . $match->name . '"; return $query_args;' ) ); 196 197 } 198 199 } 181 200 182 201 // Search doesn't have an associated page, so we check for it separately … … 188 207 return false; 189 208 190 // Find the offset 209 // Find the offset. With $root_profile set, we fudge the offset down so later parsing works 191 210 $slug = !empty ( $match ) ? explode( '/', $match->slug ) : ''; 192 $uri_offset = 0;211 $uri_offset = empty( $root_profile ) ? 0 : -1; 193 212 194 213 // Rejig the offset … … 198 217 } 199 218 200 // Global the unfiltered offset to use in bp_core_load_template() 201 $bp_unfiltered_uri_offset = $uri_offset; 219 // Global the unfiltered offset to use in bp_core_load_template(). 220 // To avoid PHP warnings in bp_core_load_template(), it must always be >= 0 221 $bp_unfiltered_uri_offset = $uri_offset >= 0 ? $uri_offset : 0; 202 222 203 223 // We have an exact match … … 212 232 // Viewing a specific user 213 233 if ( !empty( $bp_uri[$uri_offset + 1] ) ) { 214 234 215 235 // Switch the displayed_user based on cmpatbility mode 216 236 if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
Note: See TracChangeset
for help on using the changeset viewer.