automattic / jetpack-roles
Utilities, related with user roles and capabilities.
Installs: 2 212 539
Dependents: 4
Suggesters: 0
Security: 0
Stars: 6
Watchers: 4
Forks: 2
Type:jetpack-library
Requires
- php: >=7.2
Requires (Dev)
- automattic/jetpack-changelogger: ^5.0.0
- brain/monkey: 2.6.1
- yoast/phpunit-polyfills: ^1.1.1
Suggests
- automattic/jetpack-autoloader: Allow for better interoperability with other plugins that use this package.
- dev-trunk / 3.0.x-dev
- v3.0.0
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.25
- v1.4.24
- v1.4.23
- v1.4.22
- v1.4.21
- v1.4.20
- v1.4.19
- v1.4.18
- v1.4.17
- v1.4.16
- v1.4.15
- v1.4.14
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- 1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.4
- v1.0.2
- v1.0.1
- v1.0.0
- dev-prerelease
- dev-fix/slack-workflow-branch-detection
- dev-fix/release-branch-typo
- dev-update/generate-branch-plugin
- dev-release-v1.4.2
- dev-release-v1.4.1
- dev-feature/reorg
- dev-release-v1.4.0
- dev-release-v1.3.1
- dev-release-v1.3.0
- dev-release-v1.2.0
- dev-release-v1.1.0
This package is auto-updated.
Last update: 2024-11-20 15:14:49 UTC
README
A user roles class for Jetpack.
Contains utilities for translating user roles to capabilities and vice versa.
Usage
Get the role of the current user:
use Automattic\Jetpack\Roles; $roles = new Roles(); $current_user_role = $roles->translate_current_user_to_role();
Get the role of a particular user:
use Automattic\Jetpack\Roles; $roles = new Roles(); $user = get_user_by( 'contact@yourjetpack.blog' ); $user_role = $roles->translate_user_to_role( $user );
Get the capability we require for a role:
use Automattic\Jetpack\Roles; $roles = new Roles(); $capability = $roles->translate_role_to_cap( 'administrator' );
Using this package in your WordPress plugin
If you plan on using this package in your WordPress plugin, we would recommend that you use Jetpack Autoloader as your autoloader. This will allow for maximum interoperability with other plugins that use this package as well.
Security
Need to report a security vulnerability? Go to https://automattic.com/security/ or directly to our security bug bounty site https://hackerone.com/automattic.
License
jetpack-roles is licensed under GNU General Public License v2 (or later)