automattic/jetpack-roles 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

automattic/jetpack-roles

最新稳定版本:v3.0.8

Composer 安装命令:

composer require automattic/jetpack-roles

包简介

Utilities, related with user roles and capabilities.

README 文档

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)

统计信息

  • 总下载量: 3.3M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 3
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-01-04