Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commands for managing signups on multisite #489

Merged
merged 17 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,8 @@ Errors if the option already exists.
Should this option be automatically loaded.
---
options:
- 'on'
- 'off'
- 'yes'
- 'no'
---
Expand Down Expand Up @@ -1990,6 +1992,8 @@ wp option update <key> [<value>] [--autoload=<autoload>] [--format=<format>]
Requires WP 4.2. Should this option be automatically loaded.
---
options:
- 'on'
- 'off'
- 'yes'
- 'no'
---
Expand Down Expand Up @@ -2053,6 +2057,8 @@ wp option set-autoload <key> <autoload>
Should this option be automatically loaded.
---
options:
- 'on'
- 'off'
- 'yes'
- 'no'
---
Expand Down Expand Up @@ -6294,6 +6300,193 @@ wp user set-role <user> [<role>]



### wp user signup

Manages signups on a multisite installation.

~~~
wp user signup
~~~

**EXAMPLES**

# List signups.
$ wp user signup list
+-----------+------------+---------------------+---------------------+--------+------------------+
| signup_id | user_login | user_email | registered | active | activation_key |
+-----------+------------+---------------------+---------------------+--------+------------------+
| 1 | bobuser | [email protected] | 2024-03-13 05:46:53 | 1 | 7320b2f009266618 |
| 2 | johndoe | [email protected] | 2024-03-13 06:24:44 | 0 | 9068d859186cd0b5 |
+-----------+------------+---------------------+---------------------+--------+------------------+

# Activate signup.
$ wp user signup activate 2
Success: Signup 2 activated. Password: bZFSGsfzb9xs
Success: Activated 1 of 1 signups.

# Delete signup.
$ wp user signup delete 3
Success: Signup 3 deleted.
Success: Deleted 1 of 1 signups.





### wp user signup activate

Activates one or more signups.

~~~
wp user signup activate <signup>...
~~~

**OPTIONS**

<signup>...
The signup ID, user login, user email, or activation key of the signup(s) to activate.

**EXAMPLES**

# Activate signup.
$ wp user signup activate 2
Success: Signup 2 activated. Password: bZFSGsfzb9xs
Success: Activated 1 of 1 signups.



### wp user signup delete

Deletes one or more signups.

~~~
wp user signup delete [<signup>...] [--all]
~~~

**OPTIONS**

[<signup>...]
The signup ID, user login, user email, or activation key of the signup(s) to delete.

[--all]
If set, all signups will be deleted.

**EXAMPLES**

# Delete signup.
$ wp user signup delete 3
Success: Signup 3 deleted.
Success: Deleted 1 of 1 signups.



### wp user signup get

Gets details about a signup.

~~~
wp user signup get <signup> [--field=<field>] [--fields=<fields>] [--format=<format>]
~~~

**OPTIONS**

<signup>
The signup ID, user login, user email, or activation key.

[--field=<field>]
Instead of returning the whole signup, returns the value of a single field.

[--fields=<fields>]
Limit the output to specific fields. Defaults to all fields.

[--format=<format>]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- yaml
---

**EXAMPLES**

# Get signup.
$ wp user signup get 1 --field=user_login
bobuser

# Get signup and export to JSON file.
$ wp user signup get bobuser --format=json > bobuser.json



### wp user signup list

Lists signups.

~~~
wp user signup list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>]
~~~

[--<field>=<value>]
Filter the list by a specific field.

[--field=<field>]
Prints the value of a single field for each signup.

[--fields=<fields>]
Limit the output to specific object fields.

[--format=<format>]
Render output in a particular format.
---
default: table
options:
- table
- csv
- ids
- json
- count
- yaml
---

**AVAILABLE FIELDS**

These fields will be displayed by default for each signup:

* signup_id
* user_login
* user_email
* registered
* active
* activation_key

These fields are optionally available:

* domain
* path
* title
* activated
* meta

**EXAMPLES**

# List signup IDs.
$ wp user signup list --field=signup_id
1

# List all signups.
$ wp user signup list
+-----------+------------+---------------------+---------------------+--------+------------------+
| signup_id | user_login | user_email | registered | active | activation_key |
+-----------+------------+---------------------+---------------------+--------+------------------+
| 1 | bobuser | [email protected] | 2024-03-13 05:46:53 | 1 | 7320b2f009266618 |
| 2 | johndoe | [email protected] | 2024-03-13 06:24:44 | 0 | 9068d859186cd0b5 |
+-----------+------------+---------------------+---------------------+--------+------------------+



### wp user spam

Marks one or more users as spam on multisite.
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"wp-cli/wp-cli": "^2.10"
"wp-cli/wp-cli": "^2.11"
},
"require-dev": {
"wp-cli/cache-command": "^1 || ^2",
Expand Down Expand Up @@ -198,6 +198,11 @@
"user session destroy",
"user session list",
"user set-role",
"user signup",
"user signup activate",
"user signup delete",
"user signup get",
"user signup list",
"user spam",
"user term",
"user term add",
Expand Down
12 changes: 12 additions & 0 deletions entity-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,15 @@
if ( class_exists( 'WP_CLI\Dispatcher\CommandNamespace' ) ) {
WP_CLI::add_command( 'network', 'Network_Namespace' );
}

WP_CLI::add_command(
'user signup',
'Signup_Command',
array(
'before_invoke' => function () {
if ( ! is_multisite() ) {
WP_CLI::error( 'This is not a multisite installation.' );
}
},
)
);
Loading