WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/14/2015 08:04:39 PM (6 years ago)
Author:
DrewAPicture
Message:

Docs: Clarify documentation for WP_Role::has_cap() to more clearing indicate that the method checks for capabilities against the role rather than the user.

Also updates syntax in the DocBlock summary and description.

Props GunGeekATX for the initial patch.
Fixes #35080.

File:
1 edited

Legend:

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

    r34412 r35935  
    8282
    8383    /**
    84      * Whether role has capability.
     84     * Determines whether the role has the given capability.
    8585     *
    86      * The capabilities is passed through the 'role_has_cap' filter. The first
    87      * parameter for the hook is the list of capabilities the class has
    88      * assigned. The second parameter is the capability name to look for. The
    89      * third and final parameter for the hook is the role name.
     86     * The capabilities is passed through the {@see 'role_has_cap'} filter.
     87     * The first parameter for the hook is the list of capabilities the class
     88     * has assigned. The second parameter is the capability name to look for.
     89     * The third and final parameter for the hook is the role name.
    9090     *
    9191     * @since 2.0.0
     
    9393     *
    9494     * @param string $cap Capability name.
    95      * @return bool True, if user has capability. False, if doesn't have capability.
     95     * @return bool True if the role has the given capability. False otherwise.
    9696     */
    9797    public function has_cap( $cap ) {
     
    106106         */
    107107        $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
     108
    108109        if ( !empty( $capabilities[$cap] ) )
    109110            return $capabilities[$cap];
Note: See TracChangeset for help on using the changeset viewer.