Ticket #5319: 5319.01.patch
File 5319.01.patch, 1.0 KB (added by , 10 years ago) |
---|
-
bp-friends/bp-friends-functions.php
30 30 */ 31 31 function friends_add_friend( $initiator_userid, $friend_userid, $force_accept = false ) { 32 32 33 // You cannot be friends with yourself! 34 if ( $initiator_userid == $friend_userid ) { 35 return false; 36 } 37 33 38 // Check if already friends, and bail if so 34 $friendship = new BP_Friends_Friendship; 35 if ( (int) $friendship->is_confirmed ) { 39 if ( friends_check_friendship( $initiator_userid, $friend_userid ) ) { 36 40 return true; 37 41 } 38 42 39 43 // Setup the friendship data 44 $friendship = new BP_Friends_Friendship; 40 45 $friendship->initiator_user_id = $initiator_userid; 41 46 $friendship->friend_user_id = $friend_userid; 42 47 $friendship->is_confirmed = 0; 43 48 $friendship->is_limited = 0; 44 49 $friendship->date_created = bp_core_current_time(); 45 50 46 if ( ! empty( $force_accept ) ) {51 if ( ! empty( $force_accept ) ) { 47 52 $friendship->is_confirmed = 1; 48 53 } 49 54