- Timestamp:
- 08/22/2016 09:37:39 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/classes/class-bp-friends-friendship.php
r10820 r11025 242 242 } 243 243 244 return $fids;244 return array_map( 'intval', $fids ); 245 245 } 246 246 … … 252 252 * @param int $user_id The ID of the first user. 253 253 * @param int $friend_id The ID of the second user. 254 * @return int| bool The ID of the friendship object if found, otherwise false.254 * @return int|null The ID of the friendship object if found, otherwise null. 255 255 */ 256 256 public static function get_friendship_id( $user_id, $friend_id ) { … … 259 259 $bp = buddypress(); 260 260 261 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) ); 261 $query = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->friends->table_name} WHERE ( initiator_user_id = %d AND friend_user_id = %d ) OR ( initiator_user_id = %d AND friend_user_id = %d ) AND is_confirmed = 1", $user_id, $friend_id, $friend_id, $user_id ) ); 262 263 return is_numeric( $query ) ? (int) $query : $query; 262 264 } 263 265 … … 282 284 283 285 wp_cache_set( $user_id, $friend_requests, 'bp_friends_requests' ); 286 } 287 288 // Integer casting. 289 if ( ! empty( $friend_requests ) ) { 290 $friend_requests = array_map( 'intval', $friend_requests ); 284 291 } 285 292 … … 382 389 return false; 383 390 384 return array( 'friends' => $filtered_friend_ids, 'total' => (int) $total_friend_ids );391 return array( 'friends' => array_map( 'intval', $filtered_friend_ids ), 'total' => (int) $total_friend_ids ); 385 392 } 386 393
Note: See TracChangeset
for help on using the changeset viewer.