Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2014 02:32:19 AM (10 years ago)
Author:
r-a-y
Message:

Groups: Introduces new function - groups_get_invite_count_for_user().

Previously, BP_Groups_Member::get_invites() did two queries -- one to
get a paginated array of group invites for a user and the second to
get the total group invite count for a user.

This commit:

  • Splits up the total group invite count query into a separate class method - BP_Group_Member::get_invite_count_for_user()
  • Adds a wrapper function - groups_get_invite_count_for_user() - and uses it in the BP_Groups_Component class where the invite count is only needed.

The group invite count will be cached in a future commit.

File:
1 edited

Legend:

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

    r8056 r8057  
    664664}
    665665
     666/**
     667 * Gets the total group invite count for a user.
     668 *
     669 * @since BuddyPress (2.0.0)
     670 *
     671 * @param int $user_id The user ID
     672 * @return int
     673 */
     674function groups_get_invite_count_for_user( $user_id = 0 ) {
     675    if ( empty( $user_id ) ) {
     676        $user_id = bp_loggedin_user_id();
     677    }
     678
     679    return BP_Groups_Member::get_invite_count_for_user( $user_id );
     680}
     681
    666682function groups_invite_user( $args = '' ) {
    667683
Note: See TracChangeset for help on using the changeset viewer.