Skip to:
Content

BuddyPress.org

Changeset 1250 for trunk/bp-blogs.php


Ignore:
Timestamp:
03/25/2009 04:01:43 PM (18 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-blogs.php

    r1247 r1250  
    2626require ( 'bp-blogs/bp-blogs-widgets.php' );
    2727require ( 'bp-blogs/bp-blogs-ajax.php' );
    28 require ( 'bp-blogs/directories/bp-blogs-directory-blogs.php' );
    2928
    3029
    … …  
    148147        $bp->version_numbers->blogs = BP_BLOGS_VERSION;
    149148}
    150 add_action( 'wp', 'bp_blogs_setup_globals', 1 );       
     149add_action( 'plugins_loaded', 'bp_blogs_setup_globals', 5 );   
    151150add_action( 'admin_menu', 'bp_blogs_setup_globals', 1 );
    152151
    … …  
    155154        bp_core_add_root_component( BP_BLOGS_SLUG );
    156155}
    157 add_action( 'plugins_loaded', 'bp_blogs_setup_root_component' );
     156add_action( 'plugins_loaded', 'bp_blogs_setup_root_component', 1 );
    158157
    159158/**
    … …  
    198197add_action( 'wp', 'bp_blogs_setup_nav', 2 );
    199198add_action( 'admin_menu', 'bp_blogs_setup_nav', 2 );
     199
     200function bp_blogs_directory_blogs_setup() {
     201        global $bp;
     202       
     203        if ( $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
     204                $bp->is_directory = true;
     205
     206                wp_enqueue_script( 'bp-blogs-directory-blogs', WPMU_PLUGIN_URL . '/bp-blogs/js/directory-blogs.js', array( 'jquery', 'jquery-livequery-pack' ) );
     207                bp_core_load_template( 'directories/blogs/index' );
     208        }
     209}
     210add_action( 'wp', 'bp_blogs_directory_blogs_setup', 5 );
    200211
    201212function bp_blogs_screen_my_blogs() {
    … …  
    826837}
    827838
     839function bp_blogs_force_buddypress_theme( $template ) {
     840        global $bp;
     841       
     842        if ( $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
     843                $member_theme = get_site_option( 'active-member-theme' );
     844
     845                if ( empty( $member_theme ) )
     846                        $member_theme = 'buddypress-member';
     847
     848                add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     849                add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     850
     851                return $member_theme;
     852        } else {
     853                return $template;
     854        }
     855}
     856add_filter( 'template', 'bp_blogs_force_buddypress_theme', 1, 1 );
     857
     858function bp_blogs_force_buddypress_stylesheet( $stylesheet ) {
     859        global $bp;
     860
     861        if ( $bp->current_component == $bp->blogs->slug && empty( $bp->current_action ) ) {
     862                $member_theme = get_site_option( 'active-member-theme' );
     863       
     864                if ( empty( $member_theme ) )
     865                        $member_theme = 'buddypress-member';
     866
     867                add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     868                add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     869
     870                return $member_theme;
     871        } else {
     872                return $stylesheet;
     873        }
     874}
     875add_filter( 'stylesheet', 'bp_blogs_force_buddypress_stylesheet', 1, 1 );
     876
     877
     878
    828879function bp_blogs_remove_data( $user_id ) {
    829880        /* If this is regular blog, delete all data for that blog. */
    … …  
    839890
    840891function bp_blogs_clear_blog_object_cache( $blog_id, $user_id ) {
    841         wp_cache_delete( 'bp_user_blogs_' . $user_id, 'bp' );
     892        wp_cache_delete( 'bp_blogs_of_user_' . $user_id, 'bp' );
     893        wp_cache_delete( 'bp_blogs_for_user_' . $user_id, 'bp' );
    842894}
    843895
Note: See TracChangeset for help on using the changeset viewer.