Skip to content

Underpin-WP/role-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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
  2. Register new roles menus as-needed.

Example

A very basic example could look something like this.

// 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:

underpin()->roles()->add('role-key','Namespace\To\Class');