https://github.com/underpin-wp/role-loader
Underpin Loader implementation for user roles
https://github.com/underpin-wp/role-loader
roles underpin wordpress
Last synced: about 2 months ago
JSON representation
Underpin Loader implementation for user roles
- Host: GitHub
- URL: https://github.com/underpin-wp/role-loader
- Owner: Underpin-WP
- Created: 2021-05-03T21:39:22.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-24T21:41:39.000Z (over 4 years ago)
- Last Synced: 2025-03-08T01:01:52.355Z (over 1 year ago)
- Topics: roles, underpin, wordpress
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Underpin Role Loader
Loader That assists with adding custom user roles to a WordPress website.
## Installation
### Using Composer
`composer require underpin/role-loader`
### Manually
This plugin uses a built-in autoloader, so as long as it is required _before_
Underpin, it should work as-expected.
`require_once(__DIR__ . '/underpin-roles/roles.php');`
## Setup
1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)
1. Register new roles menus as-needed.
## Example
A very basic example could look something like this.
```php
// Register role
underpin()->roles()->add( 'vip', [
'capabilities' => [ 'read_private_pages', 'read' ],
'name' => 'VIP Member',
'id' => 'vip_member',
] );
```
Alternatively, you can extend `Role` and reference the extended class directly, like so:
```php
underpin()->roles()->add('role-key','Namespace\To\Class');
```