Skip to:
Content

BuddyPress.org

Ticket #1726: bp-core-catchuri.patch

File bp-core-catchuri.patch, 2.0 KB (added by sbrajesh, 15 years ago)

patches bp-core-catchuri for the component name bug

  • bp-core-catchuri.php

     
    4343        else
    4444                $path = clean_url( $_SERVER['REQUEST_URI'] );
    4545
    46         $path = apply_filters( 'bp_uri', $path );
    47 
     46    $path = apply_filters( 'bp_uri', $path );
    4847        // Firstly, take GET variables off the URL to avoid problems,
    4948        // they are still registered in the global $_GET variable */
    5049        $noget = substr( $path, 0, strpos( $path, '?' ) );
     
    5251
    5352        /* Fetch the current URI and explode each part separated by '/' into an array */
    5453        $bp_uri = explode( "/", $path );
    55 
     54 
    5655        /* Loop and remove empties */
    5756        foreach ( (array)$bp_uri as $key => $uri_chunk )
    5857                if ( empty( $bp_uri[$key] ) ) unset( $bp_uri[$key] );
    59 
     58 
    6059        if ( defined( 'BP_ENABLE_MULTIBLOG' ) || 1 != BP_ROOT_BLOG ) {
    6160                /* If we are running BuddyPress on any blog, not just a root blog, we need to first
    6261                   shift off the blog name if we are running a subdirectory install of WPMU. */
     
    7473
    7574        /* Get site path items */
    7675        $paths = explode( '/', bp_core_get_site_path() );
     76//strip off the empty elemnts which are generated because of slashes in the path
     77        foreach ( (array)$paths  as $key => $uri_chunk )
     78                if ( empty( $paths[$key] ) ) unset( $paths[$key] );
    7779
    78         /* Take empties off the end of path */
    79         if ( empty( $paths[count($paths) - 1] ) )
    80                 array_pop( $paths );
     80//so we have $paths and $bp_uri array on same level
     81$count=count($paths);
     82array_splice($bp_uri, 0, $count);//now remove the paths section from the bp_uri
    8183
    82         /* Take empties off the start of path */
    83         if ( empty( $paths[0] ) )
    84                 array_shift( $paths );
    8584
    86         foreach ( (array)$bp_uri as $key => $uri_chunk ) {
    87                 if ( in_array( $uri_chunk, $paths )) {
    88                         unset( $bp_uri[$key] );
    89                 }
    90         }
    91 
    92         /* Reset the keys by merging with an empty array */
     85/*  Reset the keys by merging with an empty array */
    9386        $bp_uri = array_merge( array(), $bp_uri );
    9487        $bp_unfiltered_uri = $bp_uri;
    9588