Changeset 10323 for trunk/src/bp-friends/bp-friends-filters.php
- Timestamp:
- 11/02/2015 02:07:44 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/bp-friends-filters.php
r10147 r10323 27 27 global $wpdb; 28 28 29 // stop if user isn't logged in29 // Stop if user isn't logged in. 30 30 if ( ! is_user_logged_in() ) { 31 31 return; … … 34 34 $bp = buddypress(); 35 35 36 // Fetch whether or not the user is a friend of the current user 36 // Fetch whether or not the user is a friend of the current user. 37 37 $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids_sql} ) ) OR (initiator_user_id IN ( {$user_ids_sql} ) AND friend_user_id = %d )", bp_loggedin_user_id(), bp_loggedin_user_id() ) ); 38 38 39 // Keep track of members that have a friendship status with the current user 39 // Keep track of members that have a friendship status with the current user. 40 40 $friend_user_ids = array(); 41 41 42 // The "friend" is the user ID in the pair who is *not* the logged in user 42 // The "friend" is the user ID in the pair who is *not* the logged in user. 43 43 foreach ( (array) $friend_status as $fs ) { 44 44 $friend_id = bp_loggedin_user_id() == $fs->initiator_user_id ? $fs->friend_user_id : $fs->initiator_user_id; … … 57 57 } 58 58 59 // The rest are not friends with the current user, so set status accordingly 59 // The rest are not friends with the current user, so set status accordingly. 60 60 $not_friends = array_diff( $user_query->user_ids, $friend_user_ids ); 61 61 foreach ( (array) $not_friends as $nf ) {
Note: See TracChangeset
for help on using the changeset viewer.