PHPackages                             fp-cli/role-commandvf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fp-cli/role-commandvf

ActiveFp-cli-package[Utility &amp; Helpers](/categories/utility)

fp-cli/role-commandvf
=====================

Adds, removes, lists, and resets roles and capabilities.

v2.0.16(9mo ago)00MITPHPCI failing

Since Apr 17Pushed 9mo agoCompare

[ Source](https://github.com/fin-cli/role-command)[ Packagist](https://packagist.org/packages/fp-cli/role-commandvf)[ Docs](https://github.com/fp-cli/role-commandvf)[ RSS](/packages/fp-cli-role-commandvf/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (27)Used By (0)

fp-cli/role-commandvf
=====================

[](#fp-clirole-commandvf)

Adds, removes, lists, and resets roles and capabilities.

[![Testing](https://github.com/fp-cli/role-commandvf/actions/workflows/testing.yml/badge.svg)](https://github.com/fp-cli/role-commandvf/actions/workflows/testing.yml)

Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)

Using
-----

[](#using)

This package implements the following commands:

### fp role

[](#fp-role)

Manages user roles, including creating new roles and resetting to defaults.

```
fp role

```

See references for [Roles and Capabilities](https://codex.finpress.org/Roles_and_Capabilities) and [FP User class](https://codex.finpress.org/Class_Reference/FP_User).

**EXAMPLES**

```
# List roles.
$ fp role list --fields=role --format=csv
role
administrator
editor
author
contributor
subscriber

# Check to see if a role exists.
$ fp role exists editor
Success: Role with ID 'editor' exists.

# Create a new role.
$ fp role create approver Approver
Success: Role with key 'approver' created.

# Delete an existing role.
$ fp role delete approver
Success: Role with key 'approver' deleted.

# Reset existing roles to their default capabilities.
$ fp role reset administrator author contributor
Success: Reset 3/3 roles.

```

### fp role create

[](#fp-role-create)

Creates a new role.

```
fp role create   [--clone=]

```

**OPTIONS**

```

	The internal name of the role.

	The publicly visible name of the role.

[--clone=]
	Clone capabilities from an existing role.

```

**EXAMPLES**

```
# Create role for Approver.
$ fp role create approver Approver
Success: Role with key 'approver' created.

# Create role for Product Administrator.
$ fp role create productadmin "Product Administrator"
Success: Role with key 'productadmin' created.

```

### fp role delete

[](#fp-role-delete)

Deletes an existing role.

```
fp role delete

```

**OPTIONS**

```

	The internal name of the role.

```

**EXAMPLES**

```
# Delete approver role.
$ fp role delete approver
Success: Role with key 'approver' deleted.

# Delete productadmin role.
$ fp role delete productadmin
Success: Role with key 'productadmin' deleted.

```

### fp role exists

[](#fp-role-exists)

Checks if a role exists.

```
fp role exists

```

Exits with return code 0 if the role exists, 1 if it does not.

**OPTIONS**

```

	The internal name of the role.

```

**EXAMPLES**

```
# Check if a role exists.
$ fp role exists editor
Success: Role with ID 'editor' exists.

```

### fp role list

[](#fp-role-list)

Lists all roles.

```
fp role list [--fields=] [--field=] [--format=]

```

**OPTIONS**

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

[--field=]
	Prints the value of a single field.

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

```

**AVAILABLE FIELDS**

These fields will be displayed by default for each role:

- name
- role

There are no optional fields.

**EXAMPLES**

```
# List roles.
$ fp role list --fields=role --format=csv
role
administrator
editor
author
contributor
subscriber

```

### fp role reset

[](#fp-role-reset)

Resets any default role to default capabilities.

```
fp role reset [...] [--all]

```

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

**OPTIONS**

```
[...]
	The internal name of one or more roles to reset.

[--all]
	If set, all default roles will be reset.

```

**EXAMPLES**

```
# Reset three roles.
$ fp role reset administrator author contributor
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.
$ fp role reset custom_role
Custom role 'custom_role' not affected.
Error: Must specify a default role to reset.

# Reset all default roles.
$ fp role reset --all
Success: All default roles reset.

```

### fp cap

[](#fp-cap)

Adds, removes, and lists capabilities of a user role.

```
fp cap

```

See references for [Roles and Capabilities](https://codex.finpress.org/Roles_and_Capabilities) and [FP User class](https://codex.finpress.org/Class_Reference/FP_User).

**EXAMPLES**

```
# Add 'spectate' capability to 'author' role.
$ fp cap add 'author' 'spectate'
Success: Added 1 capability to 'author' role.

# Add all caps from 'editor' role to 'author' role.
$ fp cap list 'editor' | xargs fp cap add 'author'
Success: Added 24 capabilities to 'author' role.

# Remove all caps from 'editor' role that also appear in 'author' role.
$ fp cap list 'author' | xargs fp cap remove 'editor'
Success: Removed 34 capabilities from 'editor' role.

```

### fp cap add

[](#fp-cap-add)

Adds capabilities to a given role.

```
fp cap add  ... [--grant]

```

**OPTIONS**

```

	Key for the role.

...
	One or more capabilities to add.

[--grant]
	Adds the capability as an explicit boolean value, instead of implicitly defaulting to `true`.
	---
	default: true
	options:
	  - true
	  - false
	---

```

**EXAMPLES**

```
# Add 'spectate' capability to 'author' role.
$ fp cap add author spectate
Success: Added 1 capability to 'author' role.

```

### fp cap list

[](#fp-cap-list)

Lists capabilities for a given role.

```
fp cap list  [--format=] [--show-grant]

```

**OPTIONS**

```

	Key for the role.

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

[--show-grant]
	Display all capabilities defined for a role including grant.
	---
	default: false
	---

```

**EXAMPLES**

```
# Display alphabetical list of Contributor capabilities.
$ fp cap list 'contributor' | sort
delete_posts
edit_posts
level_0
level_1
read

```

### fp cap remove

[](#fp-cap-remove)

Removes capabilities from a given role.

```
fp cap remove  ...

```

**OPTIONS**

```

	Key for the role.

...
	One or more capabilities to remove.

```

**EXAMPLES**

```
# Remove 'spectate' capability from 'author' role.
$ fp cap remove author spectate
Success: Removed 1 capability from 'author' role.

```

Installing
----------

[](#installing)

This package is included with FP-CLI itself, no additional installation necessary.

To install the latest version of this package over what's included in FP-CLI, run:

```
fp package install git@github.com:fp-cli/role-commandvf.git

```

Contributing
------------

[](#contributing)

We appreciate you taking the initiative to contribute to this project.

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

For a more thorough introduction, [check out FP-CLI's guide to contributing](https://make.finpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.

### Reporting a bug

[](#reporting-a-bug)

Think you’ve found a bug? We’d love for you to help us get it fixed.

Before you create a new issue, you should [search existing issues](https://github.com/fp-cli/role-commandvf/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.

Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/fp-cli/role-commandvf/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.finpress.org/cli/handbook/bug-reports/).

### Creating a pull request

[](#creating-a-pull-request)

Want to contribute a new feature? Please first [open a new issue](https://github.com/fp-cli/role-commandvf/issues/new) to discuss whether the feature is a good fit for the project.

Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.finpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.finpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.

Support
-------

[](#support)

GitHub issues aren't for general support questions, but there are other venues you can try:

*This README.md is generated dynamically from the project's codebase using `fp scaffold package-readme` ([doc](https://github.com/fp-cli/scaffold-package-command#fp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance55

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 50.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~133 days

Recently: every ~231 days

Total

24

Last Release

297d ago

Major Versions

v1.1.0 → v2.0.02018-08-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39233575?v=4)[Diesel](/maintainers/dieselfox1)[@dieselfox1](https://github.com/dieselfox1)

---

Top Contributors

[![danielbachhuber](https://avatars.githubusercontent.com/u/36432?v=4)](https://github.com/danielbachhuber "danielbachhuber (535 commits)")[![scribu](https://avatars.githubusercontent.com/u/225715?v=4)](https://github.com/scribu "scribu (162 commits)")[![schlessera](https://avatars.githubusercontent.com/u/83631?v=4)](https://github.com/schlessera "schlessera (110 commits)")[![scribu-commits](https://avatars.githubusercontent.com/u/282080004?v=4)](https://github.com/scribu-commits "scribu-commits (104 commits)")[![ernilambar](https://avatars.githubusercontent.com/u/2098823?v=4)](https://github.com/ernilambar "ernilambar (28 commits)")[![swissspidy](https://avatars.githubusercontent.com/u/841956?v=4)](https://github.com/swissspidy "swissspidy (13 commits)")[![leewillis77](https://avatars.githubusercontent.com/u/1097338?v=4)](https://github.com/leewillis77 "leewillis77 (11 commits)")[![NateWr](https://avatars.githubusercontent.com/u/2306629?v=4)](https://github.com/NateWr "NateWr (8 commits)")[![trepmal](https://avatars.githubusercontent.com/u/251183?v=4)](https://github.com/trepmal "trepmal (8 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (8 commits)")[![miya0001](https://avatars.githubusercontent.com/u/309946?v=4)](https://github.com/miya0001 "miya0001 (6 commits)")[![PatelUtkarsh](https://avatars.githubusercontent.com/u/5015489?v=4)](https://github.com/PatelUtkarsh "PatelUtkarsh (6 commits)")[![mwilliamson](https://avatars.githubusercontent.com/u/391876?v=4)](https://github.com/mwilliamson "mwilliamson (6 commits)")[![nyordanov](https://avatars.githubusercontent.com/u/192220?v=4)](https://github.com/nyordanov "nyordanov (5 commits)")[![kshaner](https://avatars.githubusercontent.com/u/1686106?v=4)](https://github.com/kshaner "kshaner (5 commits)")[![mpeshev](https://avatars.githubusercontent.com/u/328189?v=4)](https://github.com/mpeshev "mpeshev (5 commits)")[![hearvox](https://avatars.githubusercontent.com/u/275759?v=4)](https://github.com/hearvox "hearvox (4 commits)")[![gitlost](https://avatars.githubusercontent.com/u/481982?v=4)](https://github.com/gitlost "gitlost (4 commits)")[![francescolaffi](https://avatars.githubusercontent.com/u/357331?v=4)](https://github.com/francescolaffi "francescolaffi (4 commits)")[![wojsmol](https://avatars.githubusercontent.com/u/4176111?v=4)](https://github.com/wojsmol "wojsmol (3 commits)")

### Embed Badge

![Health badge](/badges/fp-cli-role-commandvf/health.svg)

```
[![Health](https://phpackages.com/badges/fp-cli-role-commandvf/health.svg)](https://phpackages.com/packages/fp-cli-role-commandvf)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
