Permalink
Browse files

Fix Invite_Anyone_User_Query to return only registered users.

  • Loading branch information...
1 parent f94f8ea commit 368188e4203823bab3c8e864f4772839f24b379c @r-a-y r-a-y committed Apr 23, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 group-invites/group-invites.php
@@ -259,6 +259,18 @@ function invite_anyone_invite_query( $group_id = false, $search_terms = false )
* @since 1.0.4
*/
class Invite_Anyone_User_Query extends WP_User_Query {
+ function __construct( $query = null ) {
+ add_action( 'pre_user_query', array( &$this, 'filter_registered_users_only' ) );
+ parent::__construct( $query );
+ }
+
+ /**
+ * BuddyPress has different user statuses. We need to filter the user list so only registered users are shown.
+ */
+ function filter_registered_users_only( $query ) {
+ $query->query_where .= ' AND user_status = 0';
+ }
+
/**
* @see WP_User_Query::get_search_sql()
*/
@@ -287,7 +299,7 @@ function get_search_sql( $string, $cols, $wild = false ) {
$searches[] = "$col LIKE '$leading_wild" . like_escape($string) . "$trailing_wild'";
}
- return ' AND (' . implode(' OR ', $searches) . ')';
+ return ' AND (' . implode(' OR ', $searches) . ') AND user_status = 0';
}
}

0 comments on commit 368188e

Please sign in to comment.