Skip to:
Content

BuddyPress.org

Changeset 10820


Ignore:
Timestamp:
05/28/2016 09:17:35 PM (8 years ago)
Author:
r-a-y
Message:

Replace group membership static DB method calls with group membership functions.

Our group membership functions now have better caching logic due to #6327
and #7078.

This commit switches all our older group membership static DB method calls
with these group membership functions so sites enabled with an object cache
can benefit from these improvements.

Props r-a-y, boonebgorges, dcavins.

Fixes #7078.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/classes/class-bp-friends-friendship.php

    r10710 r10820  
    656656     *
    657657     * @since 1.0.0
     658     * @todo Need to do a group component check before using group functions.
    658659     *
    659660     * @param int $user_id  ID of the user whose friends are being counted.
     
    664665
    665666        // Setup some data we'll use below.
    666         $is_group_admin  = BP_Groups_Member::check_is_admin( $user_id, $group_id );
     667        $is_group_admin  = groups_is_user_admin( $user_id, $group_id );
    667668        $friend_ids      = BP_Friends_Friendship::get_friend_user_ids( $user_id );
    668669        $invitable_count = 0;
     
    671672
    672673            // If already a member, they cannot be invited again.
    673             if ( BP_Groups_Member::check_is_member( (int) $friend_ids[$i], $group_id ) )
     674            if ( groups_is_user_member( (int) $friend_ids[$i], $group_id ) ) {
    674675                continue;
     676            }
    675677
    676678            // If user already has invite, they cannot be added.
    677             if ( BP_Groups_Member::check_has_invite( (int) $friend_ids[$i], $group_id )  )
     679            if ( groups_check_user_has_invite( (int) $friend_ids[$i], $group_id ) ) {
    678680                continue;
     681            }
    679682
    680683            // If user is not group admin and friend is banned, they cannot be invited.
    681             if ( ( false === $is_group_admin ) && BP_Groups_Member::check_is_banned( (int) $friend_ids[$i], $group_id ) )
     684            if ( ( false === $is_group_admin ) && groups_is_user_banned( (int) $friend_ids[$i], $group_id ) ) {
    682685                continue;
     686            }
    683687
    684688            $invitable_count++;
  • trunk/src/bp-groups/bp-groups-screens.php

    r10718 r10820  
    691691        $message = __( 'You are not allowed to send or remove invites', 'buddypress' );
    692692        $error = 'error';
    693     } elseif ( BP_Groups_Member::check_for_membership_request( $friend_id, $group_id ) ) {
     693    } elseif ( groups_check_for_membership_request( $friend_id, $group_id ) ) {
    694694        $message = __( 'The member requested to join the group', 'buddypress' );
    695695        $error = 'error';
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r10794 r10820  
    246246            // Set user-specific data.
    247247            $user_id          = bp_loggedin_user_id();
    248             $this->is_member  = BP_Groups_Member::check_is_member( $user_id, $this->id );
    249             $this->is_invited = BP_Groups_Member::check_has_invite( $user_id, $this->id );
    250             $this->is_pending = BP_Groups_Member::check_for_membership_request( $user_id, $this->id );
     248            $this->is_member  = groups_is_user_member( $user_id, $this->id );
     249            $this->is_invited = groups_check_user_has_invite( $user_id, $this->id );
     250            $this->is_pending = groups_check_for_membership_request( $user_id, $this->id );
    251251
    252252            // If this is a private or hidden group, does the current user have access?
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r10727 r10820  
    12791279        // Users who have previously requested membership do not need
    12801280        // another invitation created for them.
    1281         if ( BP_Groups_Member::check_for_membership_request( $friend_id, $group_id ) ) {
     1281        if ( groups_check_for_membership_request( $friend_id, $group_id ) ) {
    12821282            $user_status = 'is_pending';
    12831283
Note: See TracChangeset for help on using the changeset viewer.