Codex tools: Log in
This hook adds ability to give (or take away) author access to specific parts of a page based on user's capabilities.
function give_permissions( $allcaps, $cap, $args ) {
// give author some permissions
}
add_filter( 'user_has_cap', 'give_permissions', 0, 3 );
Passing in a numeric to has_cap on WP_User objects has been deprecated. Passing a numeric will generate a deprecated option warning if debugging mode is enabled via wp_config.php:
Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.
This will occur if a plugin or a theme calls has_cap directly. The plugin or theme needs to be updated to use the new roles and capabilities classes.
It is important to note that many built-in functions will use the has_cap functionality within their implementation. For example the add_options_page calls has_cap on the 3rd parameter. If this is called with the v2.0 user level syntax by passing in a numeric you will see the warning as noted above.
Return to Plugin API/Filter Reference