Skip to:
Content

BuddyPress.org

Changeset 3541


Ignore:
Timestamp:
12/19/2010 12:29:04 PM (14 years ago)
Author:
djpaul
Message:

Always set is_member/is_banned in get_group_extras(), also updates bp_group_is_user_banned() for these changes. Fixes #2960

Location:
trunk/bp-groups
Files:
2 edited

Legend:

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

    r3465 r3541  
    527527        $user_status = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id IN ( {$group_ids} ) AND is_confirmed = 1 AND is_banned = 0", $bp->loggedin_user->id ) );
    528528        for ( $i = 0; $i < count( $paged_groups ); $i++ ) {
     529            $paged_groups[$i]->is_member = false;
     530
    529531            foreach ( (array)$user_status as $group_id ) {
    530532                if ( $group_id == $paged_groups[$i]->id )
     
    535537        $user_banned = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE is_banned = 1 AND user_id = %d AND group_id IN ( {$group_ids} )", $bp->loggedin_user->id ) );
    536538        for ( $i = 0; $i < count( $paged_groups ); $i++ ) {
     539            $paged_groups[$i]->is_banned = false;
     540
    537541            foreach ( (array)$user_banned as $group_id ) {
    538542                if ( $group_id == $paged_groups[$i]->id )
  • trunk/bp-groups/bp-groups-templatetags.php

    r3540 r3541  
    10241024 *
    10251025 * If this function is invoked inside the groups template loop (e.g. the group directory), then
    1026  * $groups_template->group->is_banned is set if the user is banned, so use that instead of making
    1027  * another SQL query.
     1026 * check $groups_template->group->is_banned instead of making another SQL query.
     1027 * However, if used in a single group's pages, we must use groups_is_user_banned().
    10281028 *
    10291029 * @global object $bp BuddyPress global settings
     
    10341034 * @since 1.3
    10351035 */
    1036 function bp_group_is_user_banned( $group = false, $user_id = false ) {
     1036function bp_group_is_user_banned( $group = false, $user_id = 0 ) {
    10371037    global $bp, $groups_template;
    10381038
     
    10441044        $group =& $groups_template->group;
    10451045
    1046         if ( !$user_id && !empty( $group->is_banned ) )
    1047             return apply_filters( 'bp_group_is_member_banned', true );
     1046        if ( !$user_id && isset( $group->is_banned ) )
     1047            return apply_filters( 'bp_group_is_user_banned', $group->is_banned );
    10481048    }
    10491049
Note: See TracChangeset for help on using the changeset viewer.