Skip to:
Content

BuddyPress.org

Ticket #4060: 4060-fix-friends.002.patch

File 4060-fix-friends.002.patch, 746 bytes (added by DJPaul, 13 years ago)
  • bp-core/bp-core-classes.php

    diff --git a/bp-core/bp-core-classes.php b/bp-core/bp-core-classes.php
    index 90442de..1bb9f43 100644
    a b class BP_User_Query { 
    302302                        $friend_ids = $wpdb->escape( implode( ',', (array) $friend_ids ) );
    303303
    304304                        if ( !empty( $friend_ids ) ) {
    305                                 $sql['where'][] = "u.{$this->uid_name} NOT IN ({$friend_ids})";
    306                         } else {
    307                                 // If the user has no friends, make sure the query returns null
     305                                $sql['where'][] = "u.{$this->uid_name} IN ({$friend_ids})";
     306
     307                        // If the user has no friends, and we're not including specific users, make sure the query returns null
     308                        } elseif ( empty( $include ) ) {
    308309                                $sql['where'][] = $this->no_results['where'];
    309310                        }
    310311                }