Download the PHP package devgeniem/wp-geniem-roles without Composer

On this page you can find all versions of the php package devgeniem/wp-geniem-roles. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-geniem-roles

Geniem Roles

Wrapper classes for developers to create and manipulate WordPress roles.

Table of contents

Installation

Composer installation

command line

composer.json

Manual installation

Move plugin to your WordPress installation plugins/ folder.

Development guidelines

User roles are stored in the database so you need to reset roles in the database after changes to the roles. This can be done with wp-geniem-roles or wp cli.

Reset roles with wp-geniem-roles

wp-geniem-roles resets WordPress standard and custom roles with one method. Note this is a slow process you don't want to run this on every page load. Helper function for debugging and controlled reseting of the roles.

Reset roles to WordPress default roles

wp-geniem-roles resets all roles to WordPress default ones with one method.

Reset roles on multisite with WP CLI

Reset roles on multisite with CLI command. This resets all default and custom roles.

WP CLI reset roles.

You can also reset roles with WP CLI see the documentation from here. https://developer.wordpress.org/cli/commands/role/

Examples / Features

Initializing Geniem Roles

Geniem roles plugin has been designed in singleton architecture. Singleton is created inside the plugin. After plugin has been activated you are able to use Geniem roles functions. It is still good practice to check that plugin has been activated.

Create a new role with capabilities

All new roles capabilities defaults to false. So we add just capabilities that we want to apply for the role. See the example code for a hands on example.

Get and manipulate a role

You can call existing role from WordPress by calling function \Geniem\Roles::get( $role_slug );. You can use a role as an object to manipulate the role. See the example from the below.

Add caps for a role

Remove caps from a role

Remove a role.

Rename a role.

Remove menu pages from a role

You can remove single admin menu page with string value or multiple pages with an array value. You can also remove submenu pages. See the example below for the details.

Remove admin bar nodes by a role

You can remove admin bar nodes by a role with a function remove_admin_bar_nodes(). See the example below for the details.

Restrict post editing and deleting

This function makes easy and fast to restrict editing of certain posts. Pass restricted post as an array of post ids and choose which capabilities you want to restrict for them.

Grant post editing

This function makes easy and fast to grant posts by the given post ids and capabilities. Note you can also define caps for the other posts if not defined all caps will be blocked for the other posts.

Restrict user management by role

Function to restrict users to manage users by the given roles and capabilities. Role will be removed from the WordPress admin user management dropdowns for example bulk action "Change role to" if the role has been restricted with the caps edit_user or promote_user.

Restrict user template management by role

Function to restrict roles available templates. Add only templates that you want to enable. Array of slugs will be used ass a parameter. (You can inspect template slug from the wp-admin template dropdown.) Note!: WordPress doesn't handle default template the same way as other templates. Default template will always be available for the users. If you want to enable only default template add string 'default' as a parameter.

Grant super admin cap for a single user

Filters

'geniem/roles/add_menu_page_cap'

Change wp-geniem-roles wp-admin menu capability.

Example usage

'geniem/roles/default_roles'

Filter new role default capabilities.

Admin page role listing

wp-geniem-roles creates a admin page which lists all current active roles and their capabilities in the admin side. Admin page can be seen for roles that can can_activate_plugins.

screenshot

Admin page menu slugs

wp-geniem-roles creates a admin page which lists all menu slugs. This is helper page for usage of function remove_menu_pages(). See the function documentation for more information.

Wiki

Tips and tricks https://github.com/devgeniem/wp-geniem-roles/wiki


All versions of wp-geniem-roles with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
composer/installers Version >=v1.0.12
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package devgeniem/wp-geniem-roles contains the following files

Loading the files please wait ....