Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/04/2013 03:04:29 AM (10 years ago)
Author:
boonebgorges
Message:

Deprecate exclude_banned arg of bp_group_has_members() in favor of 'banned' role

This changeset introduces support for the 'banned' group_role filter in
BP_Group_Member_Query. This takes the place of the exclude_banned parameter.
Backward compatibility for exclude_banned is added in
groups_get_group_members().

See #4977

File:
1 edited

Legend:

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

    r7144 r7145  
    988988        // these defaults).
    989989        $this->query_vars = wp_parse_args( $this->query_vars, array(
    990             'group_id'       => 0,
    991             'group_role'     => array( 'member' ),
    992             'exclude_banned' => true,
     990            'group_id'   => 0,
     991            'group_role' => array( 'member' ),
    993992        ) );
    994993
     
    10511050        // which there is no dedicated is_ column), figure out a list
    10521051        // of columns *not* to match
     1052        $roles_sql = '';
    10531053        if ( in_array( 'member', $roles ) ) {
    10541054            $role_columns = array();
     
    10561056                $role_columns[] = 'is_' . $excluded_role . ' = 0';
    10571057            }
    1058             $roles_sql = '(' . implode( ' AND ', $role_columns ) . ')';
     1058
     1059            if ( ! empty( $role_columns ) ) {
     1060                $roles_sql = '(' . implode( ' AND ', $role_columns ) . ')';
     1061            }
    10591062
    10601063        // When querying for a set of roles *not* containing 'member',
     
    10651068                $role_columns[] = 'is_' . $role . ' = 1';
    10661069            }
    1067             $roles_sql = '(' . implode( ' OR ', $role_columns ) . ')';
     1070
     1071            if ( ! empty( $role_columns ) ) {
     1072                $roles_sql = '(' . implode( ' OR ', $role_columns ) . ')';
     1073            }
    10681074        }
    10691075
    10701076        if ( ! empty( $roles_sql ) ) {
    10711077            $sql['where'][] = $roles_sql;
    1072         }
    1073 
    1074         if ( ! empty( $this->query_vars['exclude_banned'] ) ) {
    1075             $sql['where'][] = "is_banned = 0";
    10761078        }
    10771079
Note: See TracChangeset for help on using the changeset viewer.