Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/08/2020 02:31:49 PM (5 years ago)
Author:
dcavins
Message:

Change how groups_get_invites_for_user() reports total.

In groups_get_invites_for_user() use the total returned by the groups_get_groups() call. This helps avoid the edge case where invitations to groups that no longer exist are still recorded in the invitations table. In that case, groups_get_groups() will only return existent groups.

Also update groups_get_invite_count_for_user() to use this more reliable method.

Props imath.

Fixes #8297.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/groups/class-bp-groups-member.php

    r12431 r12741  
    888888
    889889        $this->assertEqualSets( array( $g1, $g2, $g3 ), wp_list_pluck( $groups['groups'], 'id' ) );
     890        $this->assertEquals( 3, $groups['total'] );
    890891    }
    891892
     
    963964        $groups = groups_get_invites_for_user( $u2, false, false, array( $g2 ) );
    964965        $this->assertEqualSets( array( $g1, $g3 ), wp_list_pluck( $groups['groups'], 'id' ) );
     966        $this->assertEquals( 2, $groups['total'] );
    965967    }
    966968
Note: See TracChangeset for help on using the changeset viewer.