rockschtar / wordpress-role
WordPress Role Abstraction
Installs: 5 328
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
This package is auto-updated.
Last update: 2024-10-11 16:26:09 UTC
README
Description
WordPress Role abstraction. Developed for usage with composer based WordPress projects (roots/bedrock orjohnpbloch/wordpress).
Requirements
- PHP 7.1
- Composer to install
Install
composer require rockschtar/wordpress-role
Usage
Basic Example
// describe role use Rockschtar\WordPress\Role\Role; class FAQManagerRole extends Role { public function roleName(): string { return 'faq-manager'; } public function capabilities(): array { return [ 'edit_faq', 'read_faq', 'delelte_faq' ]; } public function displayName(): string { return __('FAQ Manager', 'my-textdomain'); } } //register role hook register_activation_hook(MY_PLUGIN_FILE, 'myprefix_register_faq_role'); function myprefix_register_faq_role() { FAQManagerRole::register(); } //unregister role hook register_deactivation_hook(MY_PLUGIN_FILE, 'myprefix_unregister_faq_role'); function myprefix_unregister_faq_role() { FAQManagerRole::unregister(); }
License
rockschtar/wordpress-role is open source and released under MIT license. See LICENSE.md file for more info.