Skip to:
Content

BuddyPress.org

Changeset 4839


Ignore:
Timestamp:
07/24/2011 07:45:09 PM (13 years ago)
Author:
boonebgorges
Message:

Refactors bp_is_blog_page() to use simpler logic, and to avoid reference to unused bp->root_components. Fixes #3375

File:
1 edited

Legend:

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

    r4820 r4839  
    741741function bp_is_root_component( $component_name ) {
    742742    global $bp;
    743 
     743   
    744744    if ( !isset( $bp->active_components ) )
    745745        return false;
     
    777777}
    778778
     779/**
     780 * Is this a blog page, ie a non-BP page?
     781 *
     782 * You can tell if a page is displaying BP content by whether the current_component has been defined
     783 *
     784 * @package BuddyPress
     785 *
     786 * @return bool True if it's a non-BP page, false otherwise
     787 */
    779788function bp_is_blog_page() {
    780789    global $bp, $wp_query;
    781790
    782     if ( $wp_query->is_home && !bp_is_directory() )
    783         return true;
    784 
    785     if ( !bp_is_user() && !bp_is_single_item() && !bp_is_directory() && !bp_is_root_component( $bp->current_component ) )
    786         return true;
    787 
    788     return false;
     791    $is_blog_page = false;
     792
     793    if ( !bp_current_component() )
     794        $is_blog_page = true;
     795
     796    return apply_filters( 'bp_is_blog_page', $is_blog_page );
    789797}
    790798
     
    12141222 * @package BuddyPress
    12151223 * @subpackage Core Template
     1224 *
     1225 * @param array $wp_classes The body classes coming from WP
     1226 * @param array $custom_classes Classes that were passed to get_body_class()
     1227 * @return array $classes The BP-adjusted body classes
    12161228 */
    12171229function bp_the_body_class() {
     
    13881400        return apply_filters( 'bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes );
    13891401    }
    1390     add_filter( 'body_class', 'bp_get_the_body_class', 10, 2 )
     1402add_filter( 'body_class', 'bp_get_the_body_class', 10, 2 )
    13911403?>
Note: See TracChangeset for help on using the changeset viewer.