Skip to content

A Lightweight WordPress plugin that adds a Content Manager role to wp-admin

Notifications You must be signed in to change notification settings

redandbluefi/redandblue-user-roles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

redandblue user roles

A Lightweight WordPress plugin that adds a Content Manager role to wp-admin. Restricts the role of installing plugins and themes. Adds common capabilities to admin.

Capabilities:

  • Edit/Add posts
  • Edit/Add media
  • Edit/Add pages
  • Edit/Add custom post types
  • Edit options pages created by ACF
  • Edit/Add Menus in Layouts
  • Manage comments
  • Manage languages
  • Manage SEO

Filters

'redandblue-user-roles/rnb_urc_comments'

(true|false) Toggle Comment editing. Default false (hide)

'redandblue-user-roles/rnb_urc_users'

(true|false) Toggle User editing. Default false (hide)

'redandblue-user-roles/rnb_urc_comments'

(array) Overwrite capabilities array. See documentation of Roles and Capabilities

Example usage of filters

// Allow editing of users
add_filter('redandblue-user-roles/rnb_urc_users', function () {
  return true;
});

// Overwriting default capabilities by passing a inline function into filter which returns an array
add_filter('redandblue-user-roles/rnb_urc_caps', function () {
  return [
    'edit_posts' => false
  ];
});
// refresh_redandblue_role function must be used after updating capabilities. (Better method will be implemented in upcoming versions)
refresh_redandblue_role(); // this function needs to be run only ones to update

CLI command

wp rnb-refresh-roles

Todo

  • Filters to disable/enable caps in theme functions
  • Add multisite capabilities
  • More filters?
  • Better way to refresh caps (WP CLI Command perhaps)

About

A Lightweight WordPress plugin that adds a Content Manager role to wp-admin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages