Skip to content

Commit

Permalink
Add explanation of what happens for wp role reset (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Feb 27, 2023
1 parent 56575d1 commit 80e2367
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ Resets any default role to default capabilities.
wp role reset [<role-key>...] [--all]
~~~

Uses WordPress' `populate_roles()` function to put one or more
roles back into the state they were at in the a fresh
WordPress install. Removes any capabilities that were added,
and restores any capabilities that were removed. Custom roles
are not affected.

**OPTIONS**

[<role-key>...]
Expand All @@ -197,9 +203,17 @@ wp role reset [<role-key>...] [--all]

**EXAMPLES**

# Reset role.
# Reset three roles.
$ wp role reset administrator author contributor
Success: Reset 1/3 roles.
Restored 1 capability to and removed 0 capabilities from 'administrator' role.
No changes necessary for 'author' role.
No changes necessary for 'contributor' role.
Success: 1 of 3 roles reset.

# Reset a custom role.
$ wp role reset custom_role
Custom role 'custom_role' not affected.
Error: Must specify a default role to reset.

# Reset all default roles.
$ wp role reset --all
Expand Down
18 changes: 16 additions & 2 deletions src/Role_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ public function delete( $args ) {
/**
* Resets any default role to default capabilities.
*
* Uses WordPress' `populate_roles()` function to put one or more
* roles back into the state they were at in the a fresh
* WordPress install. Removes any capabilities that were added,
* and restores any capabilities that were removed. Custom roles
* are not affected.
*
* ## OPTIONS
*
* [<role-key>...]
Expand All @@ -255,9 +261,17 @@ public function delete( $args ) {
*
* ## EXAMPLES
*
* # Reset role.
* # Reset three roles.
* $ wp role reset administrator author contributor
* Success: Reset 1/3 roles.
* Restored 1 capability to and removed 0 capabilities from 'administrator' role.
* No changes necessary for 'author' role.
* No changes necessary for 'contributor' role.
* Success: 1 of 3 roles reset.
*
* # Reset a custom role.
* $ wp role reset custom_role
* Custom role 'custom_role' not affected.
* Error: Must specify a default role to reset.
*
* # Reset all default roles.
* $ wp role reset --all
Expand Down

0 comments on commit 80e2367

Please sign in to comment.