Changeset 8173
- Timestamp:
- 03/27/2014 05:37:41 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-functions.php
r8172 r8173 37 37 38 38 // Check if already friends, and bail if so 39 if ( friends_check_friendship( $initiator_userid, $friend_userid ) ) { 40 return true; 41 } 42 43 // Setup the friendship data 39 44 $friendship = new BP_Friends_Friendship; 40 if ( (int) $friendship->is_confirmed ) {41 return true;42 }43 44 // Setup the friendship data45 45 $friendship->initiator_user_id = $initiator_userid; 46 46 $friendship->friend_user_id = $friend_userid; … … 49 49 $friendship->date_created = bp_core_current_time(); 50 50 51 if ( ! empty( $force_accept ) ) {51 if ( ! empty( $force_accept ) ) { 52 52 $friendship->is_confirmed = 1; 53 53 } -
trunk/tests/testcases/friends/functions.php
r8172 r8173 124 124 $this->assertFalse( friends_add_friend( $u1, $u1 ) ); 125 125 } 126 127 /** 128 * @group friends_add_friend 129 */ 130 public function test_friends_add_friend_already_friends() { 131 $u1 = $this->create_user(); 132 $u2 = $this->create_user(); 133 134 friends_add_friend( $u1, $u2, true ); 135 136 $this->assertTrue( friends_add_friend( $u1, $u2 ) ); 137 } 126 138 }
Note: See TracChangeset
for help on using the changeset viewer.