Giter Site home page Giter Site logo

redandblue-user-roles's Introduction

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)

redandblue-user-roles's People

Contributors

petrilan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.