Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/08/2020 02:31:49 PM (16 months 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/src/bp-groups/bp-groups-functions.php

    r12731 r12741  
    14161416        'page'        => $page,
    14171417    );
    1418     $groups = groups_get_groups( $args );
    1419 
    1420     return array( 'groups' => $groups['groups'], 'total' => groups_get_invite_count_for_user( $user_id ) );
     1418
     1419    return groups_get_groups( $args );
    14211420}
    14221421
     
    14341433    }
    14351434
    1436     return count( groups_get_invited_to_group_ids( $user_id ) );
     1435    $invites = groups_get_invites_for_user( $user_id );
     1436    return $invites['total'];
    14371437}
    14381438
Note: See TracChangeset for help on using the changeset viewer.