Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/26/2014 06:42:40 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Remove page template name check in bp_is_current_component() introduced in r3884, fixing potential collisions causing unexpected template output or redirections.

Props pro120. Fixes #5721.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-template.php

    r9049 r9091  
    10821082 * @return bool Returns true if the component matches, or else false.
    10831083 */
    1084 function bp_is_current_component( $component ) {
    1085     global $wp_query;
    1086 
     1084function bp_is_current_component( $component = '' ) {
     1085
     1086    // Default is no match. We'll check a few places for matches
    10871087    $is_current_component = false;
    10881088
     
    10991099    $bp = buddypress();
    11001100
     1101    // Only check if BuddyPress found a current_component
    11011102    if ( ! empty( $bp->current_component ) ) {
    11021103
     
    11371138                    break;
    11381139                }
    1139             }
    1140         }
    1141 
    1142     // Page template fallback check if $bp->current_component is empty
    1143     } elseif ( !is_admin() && is_a( $wp_query, 'WP_Query' ) && is_page() ) {
    1144         global $wp_query;
    1145 
    1146         $page = $wp_query->get_queried_object();
    1147         if ( isset( $page->ID ) ) {
    1148             $custom_fields = get_post_custom_values( '_wp_page_template', $page->ID );
    1149             $page_template = $custom_fields[0];
    1150 
    1151             // Component name is in the page template name
    1152             if ( !empty( $page_template ) && strstr( strtolower( $page_template ), strtolower( $component ) ) ) {
    1153                 $is_current_component = true;
    11541140            }
    11551141        }
Note: See TracChangeset for help on using the changeset viewer.