Skip to:
Content

BuddyPress.org

Ticket #5411: 5411.02b.patch

File 5411.02b.patch, 3.5 KB (added by r-a-y, 12 years ago)
  • bp-groups/bp-groups-classes.php

    class BP_Groups_Group { 
    161161         */
    162162        public function __construct( $id = null, $args = array() ) {
    163163                $this->args = wp_parse_args( $args, array(
    164                         'populate_extras' => true,
     164                        'populate_extras' => false,
    165165                ) );
    166166
    167167                if ( !empty( $id ) ) {
  • bp-groups/bp-groups-functions.php

    function groups_get_group( $args = '' ) { 
    4343        $r = wp_parse_args( $args, array(
    4444                'group_id'          => false,
    4545                'load_users'        => false,
    46                 'populate_extras'   => true,
     46                'populate_extras'   => false,
    4747        ) );
    4848
    4949        $group_args = array(
  • bp-groups/bp-groups-loader.php

    class BP_Groups_Component extends BP_Component { 
    162162
    163163                        $bp->is_single_item  = true;
    164164                        $current_group_class = apply_filters( 'bp_groups_current_group_class', 'BP_Groups_Group' );
    165                         $this->current_group = apply_filters( 'bp_groups_current_group_object', new $current_group_class( $group_id ) );
     165
     166                        if ( $current_group_class == 'BP_Groups_Group' ) {
     167                                $this->current_group = groups_get_group( array(
     168                                        'group_id'        => $group_id,
     169                                        'populate_extras' => true,
     170                                ) );
     171
     172                        } else {
     173                                $this->current_group = apply_filters( 'bp_groups_current_group_object', new $current_group_class( $group_id ) );
     174                        }
    166175
    167176                        // When in a single group, the first action is bumped down one because of the
    168177                        // group name, so we need to adjust this and set the group name to current_item.
  • bp-groups/bp-groups-template.php

    class BP_Groups_Template { 
    160160                        $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page, $exclude );
    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 {
    166166                        $this->groups = groups_get_groups( array(
    class BP_Groups_Template { 
    261261                $this->group       = $this->next_group();
    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
    267267                        do_action('group_loop_start');
  • tests/testcases/groups/functions.php

    Bar!'; 
    562562                $old_user = get_current_user_id();
    563563                $this->set_current_user( $u1 );
    564564
    565                 $group1 = groups_get_group( array( 'group_id' => $g, ) );
     565                $group1 = groups_get_group( array( 'group_id' => $g, 'populate_extras' => true ) );
    566566
    567567                $this->set_current_user( $u2 );
    568568
    569                 $group2 = groups_get_group( array( 'group_id' => $g, ) );
     569                $group2 = groups_get_group( array( 'group_id' => $g, 'populate_extras' => true ) );
    570570
    571571                $this->assertNotEquals( $group1, $group2 );
    572572