ngg_set_capability
The NextGEN Gallery ngg set capability function.
Description
ngg_set_capability( $lowest_role, $capability );
Parameters (2)
- 0. $lowest_role
- The lowest role.
- 1. $capability
- The capability.
Usage
if ( !function_exists( 'ngg_set_capability' ) ) { require_once ABSPATH . PLUGINDIR . 'nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/roles.php'; } // The lowest role. $lowest_role = null; // The capability. $capability = null; // NOTICE! Understand what this does before running. $result = ngg_set_capability($lowest_role, $capability);
Defined (1)
The function is defined in the following location(s).
- /products/photocrati_nextgen/modules/ngglegacy/admin/roles.php
- function ngg_set_capability($lowest_role, $capability) {
- // This function set or remove the $capability
- $check_order = ngg_get_sorted_roles();
- $add_capability = false;
- foreach ($check_order as $the_role) {
- $role = $the_role->name;
- if ( $lowest_role == $role )
- $add_capability = true;
- // If you rename the roles, then please use a role manager plugin
- if ( empty($the_role) )
- continue;
- $add_capability ? $the_role->add_cap($capability) : $the_role->remove_cap($capability) ;
- }
- }