Ticket #5703: 5703.01.patch
File 5703.01.patch, 1.8 KB (added by , 11 years ago) |
---|
-
src/bp-friends/bp-friends-filters.php
38 38 $friend_id = bp_loggedin_user_id() == $fs->initiator_user_id ? $fs->friend_user_id : $fs->initiator_user_id; 39 39 40 40 if ( isset( $user_query->results[ $friend_id ] ) ) { 41 $user_query->results[ $friend_id ]->is_friend = $fs->is_confirmed; 41 if ( 0 == $fs->is_confirmed ) { 42 $status = $fs->initiator_user_id == bp_loggedin_user_id() ? 'pending' : 'awaiting_response'; 43 } else { 44 $status = 'is_friend'; 45 } 46 47 $user_query->results[ $friend_id ]->is_friend = $fs->is_confirmed; 48 $user_query->results[ $friend_id ]->friendship_status = $status; 42 49 } 43 50 } 44 51 } -
src/bp-friends/bp-friends-functions.php
195 195 /** 196 196 * Get the friendship status of two friends. 197 197 * 198 * Will return 'is_friends', 'not_friends', or 'pending'.198 * Will return 'is_friends', 'not_friends', 'pending' or 'awaiting_response'. 199 199 * 200 200 * @param int $user_id ID of the first user. 201 201 * @param int $possible_friend_id ID of the other user. 202 202 * @return string Friend status of the two users. 203 203 */ 204 204 function friends_check_friendship_status( $user_id, $possible_friend_id ) { 205 global $members_template; 206 207 // check the BP_User_Query first 208 // @see bp_friends_filter_user_query_populate_extras() 209 if ( ! empty( $members_template->in_the_loop ) ) { 210 if ( isset( $members_template->member->friendship_status ) ) { 211 return $members_template->member->friendship_status; 212 } else { 213 return 'not_friends'; 214 } 215 } 216 205 217 return BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id ); 206 218 } 207 219