Skip to:

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#6686 closed defect (bug) (worksforme)

Users marked as spam are visible in friends list

Reported by: finzend's profile finzend Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Members Keywords: reporter-feedback close


When I mark someone as a spammer, this user is still visible in other members lists with friends. I'm not sure if this is desired behaviour, but I would think its not.

I've made a filter to fix this for now (see below, just fyi), but let me know if its gonna be 'fixed' in a next milestone.


function ab_filter_banned_users($hasmembers, $mymembers) {
  if (isset($mymembers->members)) {

    $mycounter = 0;
    foreach($mymembers->members as $useridx => $myuser) {
        if ($myuser->spam==1){
                //echo $myuser->user_login;

    $mymembers->member_count = ($mymembers->member_count - $mycounter);

  return $mymembers;

add_filter( 'bp_has_members', 'ab_filter_banned_users', 10, 2);

Change History (5)

#1 @DJPaul
8 years ago

  • Keywords reporter-feedback added

Hi @finzend

Could you give some instructions on how to recreate this, step-by-step? I tested very quickly and couldn't reproduce a problem, but I don't know how you're marking people as spammer and what the "other members list with friends" are, but I might just be looking in the wrong place.

Also, are you running regular WordPress or multisite?

#2 @finzend
8 years ago

Hi @DJPaul

Sure. We can mark users as spammers by clicking on the "spam"-link below each user, in the user-screen of our (multisite) network: wp-admin/network/users.php
After that the user gets a 1 value in the spam-field of the wp_users table.

The list with friends in Buddypress is like: members/username/friends/ (if you enabled the friends component)

Hope this helps. Let me know if you have any questions.


#3 @boonebgorges
8 years ago

I can't reproduce either. Here's a bit more on what should happen, and what is probably happening.

When a user is marked as spam, friends_remove_data() ought to be called. In this function, BuddyPress deletes all friend data associated with the spammed user. That is, the friendships are no longer listed in the database at all. So when you view a former friend's list of friends - populated by friends_get_friend_user_ids() (see BP_User_Query) - the spammed user should never show up.

If you're still seeing the spammed user in friend lists, one of several things must be happening:

  • friends_remove_data() is never being called. This can happen because bp_make_spam_user is not being called, or because the Friends component is not loaded properly at the time of spamming.
  • BP_Friends_Friendship::delete_all_for_user() is failing for some reason.

Is BuddyPress network-activated on your multisite installation? If not, is it activated on blog 1, or is it a secondary site? It could be that BP is not fully loaded on wp-admin/network/users.php.

#4 @DJPaul
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

We can't reproduce the original report, and despite leaving feedback questions which would help further our investigation, we've heard nothing back in about 7 weeks, so I'm going to close this ticket until if/when we can confirm the problem.

#5 @finzend
7 years ago

  • Keywords close added

Sorry, I didn get any notifications about your replies. With the new Buddypress I cant reproduce the problem either, so the ticket can remain closed. Thanks anyway!

Note: See TracTickets for help on using tickets.