AP_Roles::add_capabilities()
Description #
Add new capabilities
Source #
File: includes/class/roles-cap.php
public function add_capabilities() { global $wp_roles; if ( class_exists( 'WP_Roles' ) && ! isset( $wp_roles ) ) { $wp_roles = new WP_Roles(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited } if ( is_object( $wp_roles ) ) { $roles = array( 'editor', 'administrator', 'contributor', 'author', 'ap_participant', 'ap_moderator', 'subscriber' ); foreach ( $roles as $role_name ) { // Add base cpas to all roles. foreach ( $this->base_caps as $k => $grant ) { $wp_roles->add_cap( $role_name, $k ); } if ( in_array( $role_name, array( 'editor', 'administrator', 'ap_moderator' ), true ) ) { foreach ( $this->mod_caps as $k => $grant ) { $wp_roles->add_cap( $role_name, $k ); } } } } }
Expand full source code Collapse full source code View on GitHub: includes/class/roles-cap.php:72
Add your comment