Skip to content

Can't use wp user spam *ID* on single site installation #412

Closed

Description

@Rvervuurt

Bug Report

Describe the current, buggy behavior

I'm trying to mark a user as spam with wp user spam *ID*, but I get the error Error: This is not a multisite installation.

Describe how other contributors can replicate this bug

  • Create a clean WP installation
  • Generate some users with wp user generate
  • Try to mark a random user (f.ex. 50) as spam with wp user spam 50

Describe what you would expect as the correct outcome

I expect user 50 to be registered as spam, as the (docs)[https://developer.wordpress.org/cli/commands/user/spam/] make me think it should, no matter if it's a multiste or not.

Let us know what environment you are running this on

OS:	Darwin 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
Shell:	/bin/zsh
PHP binary:	/opt/homebrew/Cellar/php@8.1/8.1.21/bin/php
PHP version:	8.1.21
php.ini used:	/opt/homebrew/etc/php/8.1/php.ini
MySQL binary:
MySQL version:
SQL modes:
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/Applications/MAMP/htdocs/ideal/wordpress
WP-CLI packages dir:
WP-CLI cache dir:	/Users/robbert/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version:	2.8.1

Provide additional context/Screenshots

image

Activity

  1. added
    command:user
    command:user-spam
    on Jul 13, 2023
  2. danielbachhuber commented on Jul 13, 2023

    @danielbachhuber
    Member

    Hey @Rvervuurt,

    The concept of marking a user as spam only exists in WordPress multisite:

    Multisite

    image

    Standard

    image

    Whenever relevant, WP-CLI emulates wp-admin, so this isn't behavior we'll change.

    How would you recommend we improve the documentation? Want to submit a PR with your suggested changes?

    /**
    * Marks one or more users as spam.
    *
    * ## OPTIONS
    *
    * <id>...
    * : One or more IDs of users to mark as spam.
    *
    * ## EXAMPLES
    *
    * $ wp user spam 123
    * User 123 marked as spam.
    * Success: Spamed 1 of 1 users.
    */
    public function spam( $args ) {
    $this->update_msuser_status( $args, 'spam', '1' );
    }
    /**
    * Removes one or more users from spam.
    *
    * ## OPTIONS
    *
    * <id>...
    * : One or more IDs of users to remove from spam.
    *
    * ## EXAMPLES
    *
    * $ wp user unspam 123
    * User 123 removed from spam.
    * Success: Unspamed 1 of 1 users.
    */
    public function unspam( $args ) {
    $this->update_msuser_status( $args, 'spam', '0' );
    }

  3. Rvervuurt commented on Jul 13, 2023

    @Rvervuurt
    Author

    Ah that makes sense! I didn't know it was multisite-only!

    There must be other multisite-commands, how are they documented?

  4. danielbachhuber commented on Jul 13, 2023

    @danielbachhuber
    Member

    There must be other multisite-commands, how are they documented?

    @Rvervuurt That's a good question. They generally aren't explicitly documented as such, but usually have some reference to multisite:

    * Creates, deletes, empties, moderates, and lists one or more sites on a multisite installation.

    We could say something like:

    Marks one or more users as spam on multisite.
    

    Or:

    Marks one or more users as spam.
    
    Spam users only exist on multisite.
    

    Do you have a preference? Or another suggestion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    command:usercommand:user-spamstate:unconfirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions