Skip to:
Content

BuddyPress.org

Changeset 1250 for trunk/bp-groups.php


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-groups.php

    r1238 r1250  
    2626require ( 'bp-groups/bp-groups-filters.php' );
    2727require ( 'bp-groups/bp-groups-admin.php' );
    28 require ( 'bp-groups/directories/bp-groups-directory-groups.php' );
    2928
    3029/**************************************************************************
     
    142141        $bp->groups->table_name_wire = $wpdb->base_prefix . 'bp_groups_wire';
    143142   
    144     $bp->groups->forbidden_names = array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' );
     143    $bp->groups->forbidden_names = apply_filters( 'groups_forbidden_names', array( 'my-groups', 'group-finder', 'create', 'invites', 'delete', 'add', 'admin', 'request-membership' ) );
    145144    $bp->version_numbers->groups = BP_GROUPS_VERSION;
    146145   
    147146    return $bp;
    148147}
    149 add_action( 'wp', 'groups_setup_globals', 1, false );   
    150 add_action( 'admin_menu', 'groups_setup_globals', 1, false );
     148add_action( 'plugins_loaded', 'groups_setup_globals', 5 ); 
     149add_action( 'admin_menu', 'groups_setup_globals', 1 );
    151150
    152151function groups_setup_root_component() {
     
    154153    bp_core_add_root_component( BP_GROUPS_SLUG );
    155154}
    156 add_action( 'plugins_loaded', 'groups_setup_root_component' );
     155add_action( 'plugins_loaded', 'groups_setup_root_component', 1 );
    157156
    158157function groups_check_installed() {
     
    169168}
    170169add_action( 'admin_menu', 'groups_check_installed' );
    171 
    172170
    173171function groups_add_admin_menu() {
     
    248246            array_shift($bp->action_variables);
    249247                                   
    250             $bp->bp_options_title = bp_create_excerpt( $group_obj->name, 1 );
     248            $bp->bp_options_title = $group_obj->name;
    251249            $bp->bp_options_avatar = '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />';
    252250           
     
    301299add_action( 'admin_menu', 'groups_setup_nav', 2 );
    302300
     301function groups_directory_groups_setup() {
     302    global $bp;
     303   
     304    if ( $bp->current_component == $bp->groups->slug && empty( $bp->current_action ) ) {
     305        $bp->is_directory = true;
     306
     307        wp_enqueue_script( 'bp-groups-directory-groups', WPMU_PLUGIN_URL . '/bp-groups/js/directory-groups.js', array( 'jquery', 'jquery-livequery-pack' ) );
     308        bp_core_load_template( 'directories/groups/index' );
     309    }
     310}
     311add_action( 'wp', 'groups_directory_groups_setup', 5 );
    303312
    304313/***** Screens **********/
     
    22492258
    22502259function groups_force_buddypress_theme( $template ) {
    2251     global $current_component, $current_action;
    2252     global $is_member_page, $bp;
    2253 
    2254     $groups_bp = groups_setup_globals(true);
    2255    
    2256     if ( $current_component != $groups_bp->groups->slug )
     2260    global $bp;
     2261   
     2262    if ( $bp->current_component != $bp->groups->slug )
    22572263        return $template;
    22582264   
     
    22612267    if ( empty($member_theme) )
    22622268        $member_theme = 'buddypress-member';
    2263    
    2264     // The theme filter does not recognize any globals, where as the stylesheet filter does.
    2265     // We have to set up the globals to use manually.
    2266     bp_core_set_uri_globals();
    2267 
    2268     if ( $current_component == $groups_bp->groups->slug )
    2269         $bp->is_single_item = BP_Groups_Group::group_exists( $current_action, $groups_bp->groups->table_name );
    2270    
    2271     if ( $bp->is_single_item ) {
    2272         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    2273         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
    2274 
    2275         return $member_theme;
    2276     } else {
    2277         return $template;
    2278     }
    2279    
    2280     return $theme;
    2281 }
    2282 add_filter( 'template', 'groups_force_buddypress_theme', 1, 1 );
     2269
     2270    add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     2271    add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     2272
     2273    return $member_theme;
     2274}
     2275add_filter( 'template', 'groups_force_buddypress_theme' );
    22832276
    22842277function groups_force_buddypress_stylesheet( $stylesheet ) {
    2285     global $bp, $is_member_page, $current_component;
    2286 
    2287     if ( $current_component != $bp->groups->slug )
     2278    global $bp;
     2279
     2280    if ( $bp->current_component != $bp->groups->slug )
    22882281        return $stylesheet;
    22892282
     
    22932286        $member_theme = 'buddypress-member';
    22942287   
    2295     if ( $bp->is_single_item ) {
    2296         add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
    2297         add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
    2298        
    2299         return $member_theme;
    2300     } else {
    2301         return $stylesheet;
    2302     }
     2288    add_filter( 'theme_root', 'bp_core_set_member_theme_root' );
     2289    add_filter( 'theme_root_uri', 'bp_core_set_member_theme_root_uri' );
     2290   
     2291    return $member_theme;
    23032292}
    23042293add_filter( 'stylesheet', 'groups_force_buddypress_stylesheet', 1, 1 );
Note: See TracChangeset for help on using the changeset viewer.