Skip to content

Commit c537a7f

Browse files
committed
Merge branch 'main' into copilot/add-font-library-commands
2 parents 273e156 + 07eeaf7 commit c537a7f

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,21 @@ wp option
17761776

17771777
See the [Plugin Settings API](https://developer.wordpress.org/plugins/settings/settings-api/) and the [Theme Options](https://developer.wordpress.org/themes/customize-api/) for more information on adding customized options.
17781778

1779+
**COMMON OPTIONS**
1780+
1781+
These are some of the most commonly used WordPress options:
1782+
1783+
* `siteurl` - Site URL, e.g. http://example.com
1784+
* `blogname` - Site title
1785+
* `blogdescription` - Site tagline
1786+
* `admin_email` - Administration email address
1787+
* `default_role` - Default role for new users
1788+
* `timezone_string` - Local timezone, e.g. "America/New_York"
1789+
* `home` - Home URL, e.g. http://example.com
1790+
* `blog_public` - Discourage search engines when set to 0
1791+
1792+
For the full list of available options, see the [Option Reference](https://developer.wordpress.org/apis/options/).
1793+
17791794
**EXAMPLES**
17801795

17811796
# Get site URL.

features/user.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ Feature: Manage WordPress users
352352
| roles | author |
353353
354354
When I run `wp user remove-role 1`
355-
Then STDOUT should not be empty
355+
Then STDOUT should contain:
356+
"""
357+
Success: Removed all roles from admin (1) on
358+
"""
356359
357360
When I run `wp user get 1`
358361
Then STDOUT should be a table containing rows:

src/Option_Command.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@
99
*
1010
* See the [Plugin Settings API](https://developer.wordpress.org/plugins/settings/settings-api/) and the [Theme Options](https://developer.wordpress.org/themes/customize-api/) for more information on adding customized options.
1111
*
12+
* ## COMMON OPTIONS
13+
*
14+
* These are some of the most commonly used WordPress options:
15+
*
16+
* * `siteurl` - Site URL, e.g. http://example.com
17+
* * `blogname` - Site title
18+
* * `blogdescription` - Site tagline
19+
* * `admin_email` - Administration email address
20+
* * `default_role` - Default role for new users
21+
* * `timezone_string` - Local timezone, e.g. "America/New_York"
22+
* * `home` - Home URL, e.g. http://example.com
23+
* * `blog_public` - Discourage search engines when set to 0
24+
*
25+
* For the full list of available options, see the [Option Reference](https://developer.wordpress.org/apis/options/).
26+
*
1227
* ## EXAMPLES
1328
*
1429
* # Get site URL.

src/User_Command.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,15 +807,25 @@ public function add_role( $args, $assoc_args ) {
807807
* : User ID, user email, or user login.
808808
*
809809
* [<role>...]
810-
* : Remove the specified role(s) from the user.
810+
* : Remove the specified role(s) from the user. If not passed, all roles are
811+
* removed from the user; on multisite, this removes the user from the current
812+
* site/blog.
811813
*
812814
* ## EXAMPLES
813815
*
814816
* $ wp user remove-role 12 author
815-
* Success: Removed 'author' role for johndoe (12).
817+
* Success: Removed 'author' role from johndoe (12).
816818
*
817819
* $ wp user remove-role 12 author editor
818-
* Success: Removed 'author', 'editor' roles for johndoe (12).
820+
* Success: Removed 'author', 'editor' roles from johndoe (12).
821+
*
822+
* # On single-site: removes all roles from the user
823+
* $ wp user remove-role 12
824+
* Success: Removed all roles from johndoe (12) on http://example.com.
825+
*
826+
* # On multisite: removes the user from the current site/blog
827+
* $ wp user remove-role 12
828+
* Success: Removed johndoe (12) from http://example.com.
819829
*
820830
* @subcommand remove-role
821831
*/
@@ -837,14 +847,14 @@ public function remove_role( $args, $assoc_args ) {
837847
$label = count( $roles ) > 1 ? 'roles' : 'role';
838848
WP_CLI::success( "Removed '{$message}' {$label} from {$user->user_login} ({$user->ID})." );
839849
} else {
840-
// Multisite
850+
$site_url = site_url();
841851
if ( function_exists( 'remove_user_from_blog' ) ) {
842852
remove_user_from_blog( $user->ID, get_current_blog_id() );
853+
WP_CLI::success( "Removed {$user->user_login} ({$user->ID}) from {$site_url}." );
843854
} else {
844855
$user->remove_all_caps();
856+
WP_CLI::success( "Removed all roles from {$user->user_login} ({$user->ID}) on {$site_url}." );
845857
}
846-
847-
WP_CLI::success( "Removed {$user->user_login} ({$user->ID}) from " . site_url() . '.' );
848858
}
849859
}
850860

0 commit comments

Comments
 (0)