Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/02/2010 12:40:49 PM (15 years ago)
Author:
apeatling
Message:

Removing database hits inside BP loops to improve overall performance.

File:
1 edited

Legend:

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

    r2496 r2533  
    10801080        $group =& $groups_template->group;
    10811081
    1082     if ( groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
    1083         return true;
    1084 
    1085     return false;
     1082    if ( null == $group->is_member )
     1083        return false;
     1084
     1085    return true;
    10861086}
    10871087
     
    11681168
    11691169    // If they're not logged in or are banned from the group, no join button.
    1170     if ( !is_user_logged_in() || groups_is_user_banned( $bp->loggedin_user->id, $group->id ) )
     1170    if ( !is_user_logged_in() || $group->is_banned )
    11711171        return false;
    11721172
     
    11781178    switch ( $group->status ) {
    11791179        case 'public':
    1180             if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) )
     1180            if ( $group->is_member )
    11811181                echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    11821182            else
     
    11851185
    11861186        case 'private':
    1187             if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) ) {
     1187            if ( $group->is_member ) {
    11881188                echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    11891189            } else {
Note: See TracChangeset for help on using the changeset viewer.