Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2014 02:32:19 AM (13 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-loader.php

    r8056 r8057  
    537537
    538538                        // Pending group invites
    539                         $count   = groups_get_invites_for_user( bp_loggedin_user_id() );
     539                        $count   = groups_get_invite_count_for_user();
    540540                        $title   = __( 'Groups',             'buddypress' );
    541541                        $pending = __( 'No Pending Invites', 'buddypress' );
    542542
    543543                        if ( !empty( $count['total'] ) ) {
    544                                 $title   = sprintf( __( 'Groups <span class="count">%s</span>',          'buddypress' ), $count['total'] );
    545                                 $pending = sprintf( __( 'Pending Invites <span class="count">%s</span>', 'buddypress' ), $count['total'] );
     544                                $title   = sprintf( __( 'Groups <span class="count">%s</span>',          'buddypress' ), $count );
     545                                $pending = sprintf( __( 'Pending Invites <span class="count">%s</span>', 'buddypress' ), $count );
    546546                        }
    547547
Note: See TracChangeset for help on using the changeset viewer.