Make WordPress Core

Changeset 41366


Ignore:
Timestamp:
09/10/2017 10:50:27 PM (6 years ago)
Author:
johnbillion
Message:

Docs: Clarify some terminology around meta capabilities, primitive capabilities, and roles.

See #41017

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-user.php

    r41162 r41366  
    673673
    674674    /**
    675      * Whether user has capability or role name.
    676      *
    677      * While checking against particular roles in place of a capability is supported
    678      * in part, this practice is discouraged as it may produce unreliable results.
     675     * Whether the user has a specific capability.
     676     *
     677     * While checking against a role in place of a capability is supported in part, this practice is discouraged as it
     678     * may produce unreliable results.
    679679     *
    680680     * @since 2.0.0
     
    683683     *
    684684     * @param string $cap           Capability name.
    685      * @param int    $object_id,... Optional. ID of the specific object to check against if `$cap` is a "meta" cap.
    686      *                              "Meta" capabilities, e.g. 'edit_post', 'edit_user', etc., are capabilities used
    687      *                              by map_meta_cap() to map to other "primitive" capabilities, e.g. 'edit_posts',
    688      *                              'edit_others_posts', etc. The parameter is accessed via func_get_args() and passed
    689      *                              to map_meta_cap().
    690      * @return bool Whether the current user has the given capability. If `$cap` is a meta cap and `$object_id` is
    691      *              passed, whether the current user has the given meta capability for the given object.
     685     * @param int    $object_id,... Optional. ID of a specific object to check against if `$cap` is a "meta" capability.
     686     *                              Meta capabilities such as `edit_post` and `edit_user` are capabilities used by
     687     *                              by the `map_meta_cap()` function to map to primitive capabilities that a user or
     688     *                              role has, such as `edit_posts` and `edit_others_posts`.
     689     * @return bool Whether the user has the given capability, or, if `$object_id` is passed, whether the user has
     690     *              the given capability for that object.
    692691     */
    693692    public function has_cap( $cap ) {
    694693        if ( is_numeric( $cap ) ) {
    695             _deprecated_argument( __FUNCTION__, '2.0.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
     694            _deprecated_argument( __FUNCTION__, '2.0.0', __( 'Usage of user levels is deprecated. Use capabilities instead.' ) );
    696695            $cap = $this->translate_level_to_cap( $cap );
    697696        }
Note: See TracChangeset for help on using the changeset viewer.