Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/25/2009 04:01:43 PM (15 years ago)
Author:
apeatling
Message:

Removed blogs, groups and members directory from the home theme into the BuddyPress member theme. The directories now have their own templates and theme based CSS and provide much easier editing.

Moved the $bp global setup to a higher priority action - from the 'wp' action to the 'plugins_loaded' action. This stops occurrences where the $bp global was not defined yet.

File:
1 edited

Legend:

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

    r1226 r1250  
    3333    global $bp;
    3434   
    35     $path = apply_filters( 'bp_uri', $_SERVER['REQUEST_URI'] );
    36    
     35    if ( strpos( $_SERVER['REQUEST_URI'], 'bp-core-ajax-handler.php' ) )
     36        $path = bp_core_referrer();
     37    else
     38        $path = clean_url( $_SERVER['REQUEST_URI'] );
     39
     40    $path = apply_filters( 'bp_uri', $path );
     41
    3742    // Firstly, take GET variables off the URL to avoid problems,
    3843    // they are still registered in the global $_GET variable */
     
    7984        }
    8085    }
    81    
     86
    8287    /* Reset the keys by merging with an empty array */
    8388    $bp_uri = array_merge( array(), $bp_uri );
    8489    $bp_unfiltered_uri = $bp_uri;
    85 
     90   
    8691    /* Catch a member page and set the current member ID */
    87     if ( $bp_uri[0] == MEMBERS_SLUG && !empty( $bp_uri[1] ) ) {
     92    if ( $bp_uri[0] == MEMBERS_SLUG || in_array( 'bp-core-ajax-handler.php', $bp_uri ) ) {
    8893        $is_member_page = true;
    8994        $is_root_component = true;
     
    106111    }
    107112
    108     /* This is used to determine where the component and action indexes should start */
    109     $root_components = $bp->root_components;
    110    
    111113    if ( !isset($is_root_component) )
    112         $is_root_component = in_array( $bp_uri[0], $root_components );
     114        $is_root_component = in_array( $bp_uri[0], $bp->root_components );
    113115
    114116    if ( 'no' == VHOST && !$is_root_component ) {
     
    139141    //var_dump($current_component, $current_action, $action_variables);
    140142}
    141 add_action( 'wp', 'bp_core_set_uri_globals', 1 );
     143add_action( 'plugins_loaded', 'bp_core_set_uri_globals', 3 );
    142144
    143145/**
     
    254256
    255257function bp_core_force_buddypress_theme( $template ) {
    256     global $current_component, $current_action;
    257     global $is_member_page;
    258    
    259     // The theme filter does not recognize any globals, where as the stylesheet filter does.
    260     // We have to set up the globals to use manually.
    261     bp_core_set_uri_globals();
    262    
    263     $member_theme = get_site_option('active-member-theme');
     258    global $is_member_page, $bp;
     259
     260    $member_theme = get_site_option( 'active-member-theme' );
    264261   
    265262    if ( empty( $member_theme ) )
    266263        $member_theme = 'buddypress-member';
    267264   
     265    if ( $is_member_page ) {
     266
     267        add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     268        add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     269
     270        return $member_theme;
     271    } else {
     272        return $template;
     273    }
     274}
     275add_filter( 'template', 'bp_core_force_buddypress_theme', 1, 1 );
     276
     277function bp_core_force_buddypress_stylesheet( $stylesheet ) {
     278    global $is_member_page;
     279
     280    $member_theme = get_site_option( 'active-member-theme' );
     281   
     282    if ( empty( $member_theme ) )
     283        $member_theme = 'buddypress-member';
     284
    268285    if ( $is_member_page ) {
    269286        add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     
    272289        return $member_theme;
    273290    } else {
    274         return $template;
    275     }
    276 }
    277 add_filter( 'template', 'bp_core_force_buddypress_theme', 1, 1 );
    278 
    279 function bp_core_force_buddypress_stylesheet( $stylesheet ) {
    280     global $bp, $is_member_page;
    281 
    282     $member_theme = get_site_option('active-member-theme');
    283    
    284     if ( empty( $member_theme ) )
    285         $member_theme = 'buddypress-member';
    286 
    287     if ( $is_member_page ) {
    288         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    289         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
    290 
    291         return $member_theme;
    292     } else {
    293291        return $stylesheet;
    294292    }
Note: See TracChangeset for help on using the changeset viewer.