Skip to:

wrong number of friends count in main nav after user deletion or marked as spam

  • Avatar of tifire


    Buddypress version: 1.6.1
    Wordpress version: 3.4.2

    I just found out that the number of friends is not correct if one of the friends is marked as spam or deleted by the site admin.

    User A has three friends: f1, f2 and f3. Now the site admin deleted the user f2. The main nav (friend) for user A still shows the number of friends to be 3, even though only f1 and f3 show on page.

    The same thing happens after marking f2 as spam. I do this by set the user_status from 0 to 1 in database.

    I search the code and found out the function friends_get_total_friend_count () is used. This function returns the user meta ‘total_friend_count’ as the friend count.

    So my question is, how do I fix this? Should I forget about the “total_friend_count” meta and recalculate the number of friends in the function friends_get_total_friend_count ()?

    Or should I update the user meta “total_friend_count” each time when a user is marked as spam, deleted, or recovered from being marked as spam?

    Any suggestions?

You must be logged in to reply to this topic.