Skip to content

Do not mark main site as spam when using 'wp user spam'#393

Merged
danielbachhuber merged 4 commits intowp-cli:mainfrom
r-a-y:fix/do-not-mark-main-site-as-spam
Mar 15, 2023
Merged

Do not mark main site as spam when using 'wp user spam'#393
danielbachhuber merged 4 commits intowp-cli:mainfrom
r-a-y:fix/do-not-mark-main-site-as-spam

Conversation

@r-a-y
Copy link
Contributor

@r-a-y r-a-y commented Feb 27, 2023

If a user has a role on the main site and we use wp user spam on that user, the main site will be marked as spam.

It looks like the following commit broke the main site check: 60f91b3. Commit 1bc55d0 fixes this by using is_main_site().

I've also removed the call to use WP_CLI\Fetchers\Site as SiteFetcher in commit 5f4b7e1 since it doesn't appear to be necessary.

I haven't written a behat test for this yet, but feel free to do so.

@r-a-y r-a-y requested a review from a team as a code owner February 27, 2023 23:20
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @r-a-y !

It looks like the original incorrect logic is from #74

I verified that WordPress core's behavior in wp-admin is to:

  1. Spam any of the user's blogs.
  2. Not spam the main site.

I also added some Behat tests to cover the changes

@danielbachhuber danielbachhuber added this to the 2.4.2 milestone Mar 15, 2023
@danielbachhuber danielbachhuber added bug command:user Related to 'user' command command:user-spam Related to 'user spam' command command:user-unspam Related to 'user unspam' command labels Mar 15, 2023
@danielbachhuber danielbachhuber merged commit 694a4a5 into wp-cli:main Mar 15, 2023
@r-a-y r-a-y deleted the fix/do-not-mark-main-site-as-spam branch March 15, 2023 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:user Related to 'user' command command:user-spam Related to 'user spam' command command:user-unspam Related to 'user unspam' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants