- $this->addTables( 'user_groups', 'ug1' );
-
- if ( count( $params['excludegroup'] ) == 1 ) {
- $exclude = array( 'ug1.ug_group' => $params['excludegroup'][0] );
- } else {
- $exclude = array( $db->makeList(
- array( 'ug1.ug_group' => $params['excludegroup'] ),
- LIST_OR
- ) );
- }
- $this->addJoinConds( array( 'ug1' => array( 'LEFT OUTER JOIN',
- array_merge( array( 'ug1.ug_user=user_id' ), $exclude )
- ) ) );
- $this->addWhere( 'ug1.ug_user IS NULL' );
+ $this->addWhere( 'NOT EXISTS (' . $db->selectSQLText(
+ 'user_groups', '1', array( 'ug_user=user_id', 'ug_group' => $params['excludegroup'] )
+ ) . ')' );