Skip to:
Content

BuddyPress.org

Ticket #3554: 3554.01.patch

File 3554.01.patch, 3.7 KB (added by boonebgorges, 13 years ago)
  • bp-core/bp-core-filters.php

    function bp_modify_page_title( $title, $sep, $seplocation ) { 
    292292        // An index or directory
    293293        } elseif ( bp_is_directory() ) {
    294294                if ( !bp_current_component() )
    295                         $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( bp_members_slug() ) );
     295                        $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( bp_get_members_root_slug() ) );
    296296                else
    297297                        $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );
    298298
  • bp-core/bp-core-template.php

    function bp_get_name_from_root_slug( $root_slug = '' ) { 
    680680
    681681        // If no slug is passed, look at current_component
    682682        if ( empty( $root_slug ) )
    683                 $root_slug = $bp->current_component;
     683                $root_slug = $bp->{$bp->current_component}->root_slug;
    684684
    685685        // No current component or root slug, so flee
    686686        if ( empty( $root_slug ) )
    function bp_get_name_from_root_slug( $root_slug = '' ) { 
    690690        foreach ( $bp->active_components as $component => $id )
    691691                if (    isset( $bp->{$component}->root_slug ) &&
    692692                                !empty( $bp->{$component}->root_slug ) &&
    693                                 $bp->{$component}->root_slug == $root_slug )
     693                                $bp->{$component}->root_slug == $root_slug ) {
    694694                        return $bp->{$component}->name;
     695                }
    695696
    696697        return false;
    697698}
    function bp_is_current_component( $component ) { 
    748749                $component = 'profile';
    749750
    750751        if ( !empty( $bp->current_component ) ) {
    751                 // First, check to see whether $component_name and the current
    752                 // component are a simple match
    753                 if ( $bp->current_component == $component ) {
    754                         $is_current_component = true;
     752                if ( isset( $bp->{$bp->current_component} ) && isset( $bp->{$component} ) ) {
     753                        $current_slug = isset( $bp->{$bp->current_component}->root_slug ) ? $bp->{$bp->current_component}->root_slug : $bp->{$bp->current_component}->slug;
    755754
    756                 // Since the current component is based on the visible URL slug let's
    757                 // check the component being passed and see if its root_slug matches
    758                 } elseif ( isset( $bp->{$component}->root_slug ) && $bp->{$component}->root_slug == $bp->current_component ) {
    759                         $is_current_component = true;
    760 
    761                 // Because slugs can differ from root_slugs, we should check them too
    762                 } elseif ( isset( $bp->{$component}->slug ) && $bp->{$component}->slug == $bp->current_component ) {
    763                         $is_current_component = true;
     755                        $component_slug = isset( $bp->{$component}->root_slug ) ? $bp->{$component}->root_slug : $bp->{$component}->slug;
    764756
    765                 // Next, check to see whether $component is a canonical,
    766                 // non-translatable component name. If so, we can return its
    767                 // corresponding slug from $bp->active_components.
    768                 } else if ( $key = array_search( $component, $bp->active_components ) ) {
    769                         if ( strstr( $bp->current_component, $key ) )
    770                                 $is_current_component = true;
    771 
    772                 // If we haven't found a match yet, check against the root_slugs
    773                 // created by $bp->pages, as well as the regular slugs
    774                 } else {
    775                         foreach ( $bp->active_components as $id ) {
    776                                 // If the $component parameter does not match the current_component,
    777                                 // then move along, these are not the droids you are looking for
    778                                 if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component )
    779                                         continue;
    780 
    781                                 if ( $id == $component ) {
    782                                         $is_current_component = true;
    783                                         break;
    784                                 }
    785                         }
     757                        return $current_slug == $component_slug;
    786758                }
    787759
    788760        // Page template fallback check if $bp->current_component is empty