From 45429a417be4b4447a115e0d223da2850ca5cfe2 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 10 Sep 2017 22:50:27 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-wp-user.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/wp-includes/class-wp-user.php b/src/wp-includes/class-wp-user.php index ca5897418f..a4595794ad 100644 --- a/src/wp-includes/class-wp-user.php +++ b/src/wp-includes/class-wp-user.php @@ -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 ); }