| 828 | | // Since the current component is based on the visible URL slug let's |
| 829 | | // check the component being passed and see if its root_slug matches |
| 830 | | } elseif ( isset( $bp->{$component}->root_slug ) && $bp->{$component}->root_slug == $bp->current_component ) { |
| 831 | | $is_current_component = true; |
| | 825 | // First, check to see whether $component_name and the current |
| | 826 | // component are a simple match |
| | 827 | if ( $bp->current_component == $component ) { |
| | 828 | $is_current_component = true; |
| 837 | | // Next, check to see whether $component is a canonical, |
| 838 | | // non-translatable component name. If so, we can return its |
| 839 | | // corresponding slug from $bp->active_components. |
| 840 | | } else if ( $key = array_search( $component, $bp->active_components ) ) { |
| 841 | | if ( strstr( $bp->current_component, $key ) ) { |
| | 835 | // Because slugs can differ from root_slugs, we should check them too |
| | 836 | } elseif ( isset( $bp->{$component}->slug ) && $bp->{$component}->slug == $bp->current_component ) { |
| 845 | | // If we haven't found a match yet, check against the root_slugs |
| 846 | | // created by $bp->pages, as well as the regular slugs |
| 847 | | } else { |
| 848 | | foreach ( $bp->active_components as $id ) { |
| 849 | | // If the $component parameter does not match the current_component, |
| 850 | | // then move along, these are not the droids you are looking for |
| 851 | | if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component ) { |
| 852 | | continue; |
| | 839 | // Next, check to see whether $component is a canonical, |
| | 840 | // non-translatable component name. If so, we can return its |
| | 841 | // corresponding slug from $bp->active_components. |
| | 842 | } else if ( $key = array_search( $component, $bp->active_components ) ) { |
| | 843 | if ( strstr( $bp->current_component, $key ) ) { |
| | 844 | $is_current_component = true; |
| 855 | | if ( $id == $component ) { |
| 856 | | $is_current_component = true; |
| 857 | | break; |
| | 847 | // If we haven't found a match yet, check against the root_slugs |
| | 848 | // created by $bp->pages, as well as the regular slugs |
| | 849 | } else { |
| | 850 | foreach ( $bp->active_components as $id ) { |
| | 851 | // If the $component parameter does not match the current_component, |
| | 852 | // then move along, these are not the droids you are looking for |
| | 853 | if ( empty( $bp->{$id}->root_slug ) || $bp->{$id}->root_slug != $bp->current_component ) { |
| | 854 | continue; |
| | 855 | } |
| | 856 | |
| | 857 | if ( $id == $component ) { |
| | 858 | $is_current_component = true; |
| | 859 | break; |
| | 860 | } |
| 862 | | // Page template fallback check if $bp->current_component is empty |
| 863 | | } elseif ( !is_admin() && is_page() ) { |
| 864 | | global $wp_query; |
| 865 | | $page = $wp_query->get_queried_object(); |
| 866 | | $custom_fields = get_post_custom_values( '_wp_page_template', $page->ID ); |
| 867 | | $page_template = $custom_fields[0]; |
| | 864 | // Page template fallback check if $bp->current_component is empty |
| | 865 | } elseif ( !is_admin() && is_page() ) { |
| | 866 | global $wp_query; |
| | 867 | $page = $wp_query->get_queried_object(); |
| | 868 | $custom_fields = get_post_custom_values( '_wp_page_template', $page->ID ); |
| | 869 | $page_template = $custom_fields[0]; |