Docs: Clarify some terminology around meta capabilities, primitive capabilities, and roles.
See #41017 git-svn-id: https://develop.svn.wordpress.org/trunk@41366 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0c29992e72
commit
45429a417b
|
@ -672,27 +672,26 @@ class WP_User {
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether user has capability or role name.
|
||||
* Whether the user has a specific capability.
|
||||
*
|
||||
* While checking against particular roles in place of a capability is supported
|
||||
* in part, this practice is discouraged as it may produce unreliable results.
|
||||
* While checking against a role in place of a capability is supported in part, this practice is discouraged as it
|
||||
* may produce unreliable results.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @see map_meta_cap()
|
||||
*
|
||||
* @param string $cap Capability name.
|
||||
* @param int $object_id,... Optional. ID of the specific object to check against if `$cap` is a "meta" cap.
|
||||
* "Meta" capabilities, e.g. 'edit_post', 'edit_user', etc., are capabilities used
|
||||
* by map_meta_cap() to map to other "primitive" capabilities, e.g. 'edit_posts',
|
||||
* 'edit_others_posts', etc. The parameter is accessed via func_get_args() and passed
|
||||
* to map_meta_cap().
|
||||
* @return bool Whether the current user has the given capability. If `$cap` is a meta cap and `$object_id` is
|
||||
* passed, whether the current user has the given meta capability for the given object.
|
||||
* @param int $object_id,... Optional. ID of a specific object to check against if `$cap` is a "meta" capability.
|
||||
* Meta capabilities such as `edit_post` and `edit_user` are capabilities used by
|
||||
* by the `map_meta_cap()` function to map to primitive capabilities that a user or
|
||||
* role has, such as `edit_posts` and `edit_others_posts`.
|
||||
* @return bool Whether the user has the given capability, or, if `$object_id` is passed, whether the user has
|
||||
* the given capability for that object.
|
||||
*/
|
||||
public function has_cap( $cap ) {
|
||||
if ( is_numeric( $cap ) ) {
|
||||
_deprecated_argument( __FUNCTION__, '2.0.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
|
||||
_deprecated_argument( __FUNCTION__, '2.0.0', __( 'Usage of user levels is deprecated. Use capabilities instead.' ) );
|
||||
$cap = $this->translate_level_to_cap( $cap );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue