WP Manifestindependent plugin directory
manifest / users / redandblue-user-roles

redandblue user roles

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

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/redandbluefi/redandblue-user-roles/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

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

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