Skip to:
Content

BuddyPress.org

Changeset 8050


Ignore:
Timestamp:
03/05/2014 10:09:53 PM (13 years ago)
Author:
r-a-y
Message:

Do not query for a group unnecessarily if we're on a group page.

If we're on a group page, the group object is already queried in
the BP_Groups_Component::setup_globals() method. However,
BP_Groups_Template requeries for the group object even when we're on a
single group page.

This commit changes BP_Groups_Template to use the already-queried
group object to prevent these unnecessary queries.

File:
1 edited

Legend:

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

    r8045 r8050  
    161161                } else if ( 'single-group' == $type ) {
    162162                        $group           = new stdClass;
    163                         $group->group_id = BP_Groups_Group::get_id_from_slug( $slug );
     163                        $group->group_id = bp_get_current_group_id();
    164164                        $this->groups    = array( $group );
    165165                } else {
    … …  
    262262
    263263                if ( $this->single_group )
    264                         $this->group = groups_get_group( array( 'group_id' => $this->group->group_id ) );
     264                        $this->group = groups_get_current_group();
    265265
    266266                if ( 0 == $this->current_group ) // loop has just started
Note: See TracChangeset for help on using the changeset viewer.