Skip to content

Commit

Permalink
Merge pull request #489 from ernilambar/feat-signup
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored May 4, 2024
2 parents 8110a59 + 889336b commit 3648d0e
Show file tree
Hide file tree
Showing 6 changed files with 748 additions and 2 deletions.
196 changes: 196 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,196 @@ 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
Signup 2 activated. Password: bZFSGsfzb9xs
Success: Activated 1 of 1 signups.

# Delete signup.
$ wp user signup delete 3
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
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
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>] [--per_page=<per_page>]
~~~

[--<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
---

[--per_page=<per_page>]
Limits the signups to the given number. Defaults to none.

**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

0 comments on commit 3648d0e

Please sign in to comment.