Skip to:
Content
Pages
Categories
Search
Top
Bottom

"Add Friend" button on users who are already friends


  • ishvara
    Participant

    @ishvara

    Hello,

    I’ve recently installed BuddyPress 2.1.1 and discovered that I’m seeing the “Add Friend” button on users who are already my friends in the Friends directory (under Friends tab). By pressing it I’m unsurprisingly getting a message saying we are already friends.
    The problem is that this should be a “Cancel Friendship” button, not “Add Friend”.
    On the other hand, if I visit my friend’s profile, I can see the proper “Cancel Friendship” button and it works.

    Has someone experienced a similar issue?
    If yes, can you please give a hit ob how to fix it.

    Thanks a million in advance!

Viewing 6 replies - 1 through 6 (of 6 total)

  • danbp
    Moderator

    @danbp

    Works fine for me. Do you use a BP specific theme ?


    ishvara
    Participant

    @ishvara

    Hello Dan,

    I’m using bp-default.
    I’ve tried to dig a bit deeper and it looks like the friends_check_friendship_status function in bp-friends-functions.php is reporting incorrect friendship status. Maybe this info can help…

    Anton.


    danbp
    Moderator

    @danbp

    Avoid using bp-default with 2.x, this historical theme is now outdated and is only delivered for back compat with older sites.

    Anyway, try by activating 2013 or 2014 to see if everithing is ok. And if, choose another theme.


    ishvara
    Participant

    @ishvara

    Switched to 2014 – unfortunately no luck.
    The issue is still present.

    PS
    I know that bp-default is no longer supported, but I’m forced to stick with it for some time 🙁
    Anyway, looks like the issue is not related to bp-default.


    ishvara
    Participant

    @ishvara

    I have identified that friends_check_friendship_status() function is returning 'not_friends' because the elseif (has_filter(‘bp_user_query_populate_extras’, 'bp_friends_filter_user_query_populate_extras’)) is triggering return ‘not_friends’.

    But I don’t understand at the moment on why this is happening…


    ishvara
    Participant

    @ishvara

    Update:
    As a temp fix (I know it’s by far not perfect) I’ve replaced the
    return ‘not_friends’
    which is triggered by the elseif (see post above)
    with
    return BP_Friends_Friendship::check_is_friend( $user_id, $possible_friend_id );

    I understand that by doing this I’m loosing some of the optimization and this will most likely lead to the increased amount of queries to the DB, but for now I haven’t found a better fix.
    I hope someone will be able to find a smarter solution for this issue.
    Or maybe give an idea of why this is happening in my case.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘"Add Friend" button on users who are already friends’ is closed to new replies.
Skip to toolbar