Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/27/2014 05:37:41 PM (12 years ago)
Author:
boonebgorges
Message:

Fix check for existing friendship in friends_add_friend()

The previous logic would always result in this check failing.

Fixes #5319

Props r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-functions.php

    r8172 r8173  
    3737
    3838    // 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
    3944    $friendship = new BP_Friends_Friendship;
    40     if ( (int) $friendship->is_confirmed ) {
    41         return true;
    42     }
    43 
    44     // Setup the friendship data
    4545    $friendship->initiator_user_id = $initiator_userid;
    4646    $friendship->friend_user_id    = $friend_userid;
     
    4949    $friendship->date_created      = bp_core_current_time();
    5050
    51     if ( !empty( $force_accept ) ) {
     51    if ( ! empty( $force_accept ) ) {
    5252        $friendship->is_confirmed = 1;
    5353    }
Note: See TracChangeset for help on using the changeset viewer.