Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#38124 closed enhancement (duplicate)

Setting user to SPAM also marks site as SPAM in a network install

Reported by: mensmaximus's profile mensmaximus Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords:
Focuses: multisite Cc:


If you mark one or more users as SPAM from network admin the sites the users are associated with get marked as spam as well. As a result the site marked as spam will only display "This site has been archived or suspended." if accessed.

Within the switch statement in /wp-admin/network/users.php from line 70 we can read

case 'spam':
        $user = get_userdata( $user_id );
        if ( is_super_admin( $user->ID ) )
                wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );

        $userfunction = 'all_spam';
        $blogs = get_blogs_of_user( $user_id, true );
        foreach ( (array) $blogs as $details ) {
                if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
                        update_blog_status( $details->userblog_id, 'spam', '1' );
        update_user_status( $user_id, 'spam', '1' );

Imho this behavior needs some tweaking. Think about a site with community of 1000 members. If one member gets marked as spam why would you suspend the entire site and penalize 999 others by switching the site off?

If this is something really intended there should be a warning that marking a user as spam will suspend any site the user is associated to.

However I cant think of any good reason to suspend an entire site if one user is suspected to be spam. It may be worth to discuss whether this would be an appropriate action if a site-admin gets marked as spam. But even than the superadmin(s) should get a notice that a site has been suspended on behalf of a superadmin (the email should name the user how marked which user as spam and what site(s) got suspended)

However I think suspending a site should never be connected to marking a user as spam. You would not delete the site either if the user gets deleted - won't you? To suspend a site is a decision of the superadmin and there should me no automatism making a possible false decision for him.

I opt for removing the entire part to mark a site/blog as spam in case a user gets marked as spam.

Attachments (1)

users.patch (970 bytes) - added by mensmaximus 7 years ago.

Download all attachments as: .zip

Change History (2)

7 years ago

#1 @ocean90
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 4.6.1 deleted

Duplicate of #20774.

Note: See TracTickets for help on using tickets.