Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/15/2011 04:36:11 PM (13 years ago)
Author:
boonebgorges
Message:

In BP_Group_Extension::register(), only check to see if we're looking at a single group once, and do it early enough to avoid potential PHP errors related to tab visibility. Fixes #3481

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-classes.php

    r4961 r4983  
    12281228
    12291229        // When we are viewing a single group, add the group extension nav item
    1230         if ( $this->visibility == 'public' || ( $this->visibility != 'public' && $bp->groups->current_group->user_has_access ) ) {
    1231             if ( $this->enable_nav_item ) {
    1232                 if ( bp_is_groups_component() && $bp->is_single_item ) {
     1230        if ( bp_is_group() ) {
     1231            if ( $this->visibility == 'public' || ( $this->visibility != 'public' && $bp->groups->current_group->user_has_access ) ) {
     1232                if ( $this->enable_nav_item ) {
    12331233                    bp_core_new_subnav_item( array( 'name' => ( !$this->nav_item_name ) ? $this->name : $this->nav_item_name, 'slug' => $this->slug, 'parent_slug' => $bp->groups->current_group->slug, 'parent_url' => bp_get_group_permalink( $bp->groups->current_group ), 'position' => $this->nav_item_position, 'item_css_id' => 'nav-' . $this->slug, 'screen_function' => array( &$this, '_display_hook' ), 'user_has_access' => $this->enable_nav_item ) );
     1234
     1235                    // When we are viewing the extension display page, set the title and options title
     1236                    if ( bp_is_current_action( $this->slug ) ) {
     1237                        add_action( 'bp_template_content_header', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
     1238                        add_action( 'bp_template_title', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
     1239                    }
    12341240                }
    12351241
    1236                 // When we are viewing the extension display page, set the title and options title
    1237                 if ( bp_is_groups_component() && $bp->is_single_item && $bp->current_action == $this->slug ) {
    1238                     add_action( 'bp_template_content_header', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
    1239                     add_action( 'bp_template_title', create_function( '', 'echo "' . esc_attr( $this->name ) . '";' ) );
    1240                 }
     1242                // Hook the group home widget
     1243                if ( !bp_current_action() && bp_is_current_action( 'home' ) )
     1244                    add_action( $this->display_hook, array( &$this, 'widget_display' ) );
    12411245            }
    1242 
    1243             // Hook the group home widget
    1244             if ( bp_is_groups_component() && $bp->is_single_item && ( !$bp->current_action || 'home' == $bp->current_action ) )
    1245                 add_action( $this->display_hook, array( &$this, 'widget_display' ) );
    12461246        }
    12471247
Note: See TracChangeset for help on using the changeset viewer.