Make WordPress Core

Opened 18 months ago

Last modified 6 days ago

#61146 assigned defect (bug)

Multisite: Marking a user account as spam, also marks the blogs he's a member of as spam

Reported by: ignatiusjeroe's profile ignatiusjeroe Owned by: realloc's profile realloc
Milestone: 6.9 Priority: normal
Severity: normal Version: 6.5
Component: Networks and Sites Keywords: has-patch needs-unit-tests
Focuses: multisite Cc:

Description

Marking a user account as spam on wp-admin/network/users.php prohibits this user from logging in. Cool. But WP also fetches the blogs he's a member or and also marks these as spam. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable. Resulting only super-admins being able to access these blogs. This makes no sense. One rotten apple should not ruin access to blogs for other users. What is the motive behind such design?

Marking a user account as spam should not influence the status of any site.

Attachments (1)

61146.diff (2.3 KB) - added by realloc 9 months ago.
Proposal to use a short circuit filter

Download all attachments as: .zip

Change History (13)

#1 @realloc
10 months ago

Upon reviewing the code, I can confirm that when a user account is marked as spam, all the sites linked to that user are set to 'spam' = '1'. Similarly, when a user is marked as 'notspam,' all their associated sites are updated to 'spam' = '0'.

This behaviour might be a good topic for discussion to understand its purpose and whether it works as intended.

@realloc
9 months ago

Proposal to use a short circuit filter

This ticket was mentioned in Slack in #core-multisite by realloc. View the logs.


8 months ago

#3 follow-up: @johnjamesjacoby
8 months ago

This behavior is intended, but should be made better.

This was geared towards open blogging planets (where sites could be created easily by anyone) so when a user signed up and created 100 spam blogs, a Super Admin could clean up the mess in one shot.

I feel like these days, I almost never want that to happen.

Same goes for the notspam action.

Here's what I think is the best end result:

  • Change the default behavior to not do this anymore :X
  • Add filters to re-enable it if desired
  • Related dev/user outreach about an intended backwards compatibility break

Specific to the attached diff, the apply_filters( 'handle pattern is only used by network-admin bulk-actions, so I would suggest different hook names.

Last edited 8 months ago by johnjamesjacoby (previous) (diff)

This ticket was mentioned in PR #8633 on WordPress/wordpress-develop by @realloc.


7 months ago
#4

  • Keywords has-patch added

#5 in reply to: ↑ 3 @realloc
7 months ago

Replying to johnjamesjacoby:

  • Change the default behavior to not do this anymore :X
  • Add filters to re-enable it if desired
  • Related dev/user outreach about an intended backwards compatibility break

Thank you for looking into it. I just inverted the default value and renamed the hook. :-)

This ticket was mentioned in Slack in #core-multisite by realloc. View the logs.


7 months ago

This ticket was mentioned in Slack in #core-multisite by realloc. View the logs.


5 months ago

This ticket was mentioned in Slack in #core-multisite by realloc. View the logs.


5 months ago

#9 @realloc
3 weeks ago

  • Owner set to realloc
  • Status changed from new to assigned

#10 @realloc
3 weeks ago

  • Milestone changed from Awaiting Review to 6.9

#11 @westonruter
13 days ago

  • Keywords needs-unit-tests added

@westonruter commented on PR #8633:


6 days ago
#12

Review from Gemini:

The changes in src/wp-admin/network/users.php are well-implemented and adhere to WordPress coding standards.

Here's a summary of the review:

  • HTTP Status Codes: Explicitly adding 403 to wp_die() calls for unauthorized actions is a good practice for proper HTTP response handling.
  • New Filter: The introduction of the network_user_spam_propagate_to_blogs filter provides valuable flexibility for developers to control spam status propagation. The associated PHPDoc block is correctly formatted and includes the @since 6.9.0 tag, parameter descriptions, and type hints.
  • Security Enhancement: The addition of is_super_admin() checks for both "spam" and "notspam" actions prevents unauthorized modification of network administrators, which is a significant security improvement.
  • Multi-network Compatibility: The refinement in the "notspam" logic to include && get_current_network_id() === $details->site_id ensures that blog status updates are correctly scoped to the current network, improving behavior in multi-network installations.
  • Indentation and Readability: The code maintains consistent indentation and remains highly readable.

Overall, these changes improve security, flexibility, and correctness within the WordPress network user management.

Note: See TracTickets for help on using tickets.