Skip to:
Content

BuddyPress.org

Ticket #4081: improve-faulty-conditional.patch

File improve-faulty-conditional.patch, 845 bytes (added by chrisbliss18, 7 years ago)

Improve the faulty conditional logic code

  • bp-core/bp-core-template.php

     
    780780                // Next, check to see whether $component is a canonical,
    781781                // non-translatable component name. If so, we can return its
    782782                // corresponding slug from $bp->active_components.
    783                 } else if ( $key = array_search( $component, $bp->active_components ) ) {
    784                         if ( strstr( $bp->current_component, $key ) ) {
    785                                 $is_current_component = true;
    786                         }
     783                } elseif ( array_key_exists( $component, $bp->active_components ) && $bp->current_component == $component ) {
     784                        $is_current_component = true;
    787785
    788786                // If we haven't found a match yet, check against the root_slugs
    789787                // created by $bp->pages, as well as the regular slugs