Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

#5857 closed enhancement (fixed)

In multisite a user removed from spammers will not have his sites restored

Reported by: imath Owned by: djpaul
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Blogs Keywords: has-patch
Cc:

Description

I've noticed testing 2.0.2 with WordPress 4.0.RC3 that when marking a user as a spammer, all BuddyPress data is deleted including the user's recorded blog(s).

When you ham the user, his profile won't show user's blog(s) anymore. In 2.1, the tool to recalculate blog records fix this, but i wonder if it would be a good idea to restore the user's blog records (and not all blog records) when the user is removed from the spammers.

Adding a patch, just in case.

Attachments (4)

5857.patch (1.0 KB) - added by imath 5 years ago.
5857.02.patch (2.8 KB) - added by imath 5 years ago.
5857.03.patch (2.8 KB) - added by DJPaul 5 years ago.
5857.04.patch (2.8 KB) - added by imath 5 years ago.

Download all attachments as: .zip

Change History (10)

@imath
5 years ago

#1 follow-up: @DJPaul
5 years ago

  • Keywords needs-refresh added; has-patch removed

Let's get the get_blogs_of_user( 2 ) corrected, and add a unit test.

#2 in reply to: ↑ 1 @imath
5 years ago

  • Keywords has-patch added; needs-refresh removed

Replying to DJPaul:

Let's get the get_blogs_of_user( 2 ) corrected, and add a unit test.

Thanks a lot for the feedback, i made a silly mistake there! Wow!

Corrected it in 5857.02.patch and added a unit test. Using the unit test made me change the function to restore user's blog association in order to be sure it respects bp_get_current_blog_roles()

@imath
5 years ago

@DJPaul
5 years ago

#3 follow-up: @DJPaul
5 years ago

I've updated the patch. I removed an unused $old_user variable, changed $b2 to be created the same as $b1 (I didn't understand why it was different), and switched a assertFalse( $expected == array_map( to use assertNotEquals to un-confuse myself and create some symmetry with the other assertion.

If this is OK with you imath, feel free to commit it.

#4 in reply to: ↑ 3 @imath
5 years ago

Replying to DJPaul:

If this is OK with you imath, feel free to commit it.

Thanks a lot DJPaul. When i've run the complete tests i had an error 'blog already taken'. So in 5857.04.patch i'm using a path var to avoid it. I think we don't need bp_blogs_record_existing_blogs() and i'd rather not use it as i've noticed while working on #1269 that it was causing a lot of tests to fail. Didn't figure out why.

Are you ok with the changes in the tests ?

Last edited 5 years ago by imath (previous) (diff)

@imath
5 years ago

#5 @DJPaul
5 years ago

No, we should fix the test environment rather than workaround. The earlier test test_bp_activity_format_activity_action_custom_post_type_post_ms is creating a blog which for some reason isn't being cleaned up. I am looking.

#6 @djpaul
5 years ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 9280:

Blogs: when un-spamming a user, restore blog records.

When marking a user as a spammer, all BuddyPress data is deleted including the user's recorded blog(s). When you ham the user, their profile won't show their blog(s) anymore. This change adds a function to the ham action to re-calculate the user's blogs.

Fixes #5857, props imath, DJPaul.

Note: See TracTickets for help on using tickets.