Docs: Correct description for WP_User::get_role_caps().

Props thomaswm.
Fixes #43410.

git-svn-id: https://develop.svn.wordpress.org/trunk@42735 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2018-02-25 15:38:13 +00:00
parent e0b18a023c
commit 00b59e627d

View File

@ -481,9 +481,9 @@ class WP_User {
* Retrieve all of the role capabilities and merge with individual capabilities. * Retrieve all of the role capabilities and merge with individual capabilities.
* *
* All of the capabilities of the roles the user belongs to are merged with * All of the capabilities of the roles the user belongs to are merged with
* the users individual roles. This also means that the user can be denied * user's individual capabilities. This also means that the user can be denied
* specific roles that their role might have, but the specific user isn't * specific capabilities that their role might have, but the user isn't granted
* granted permission to. * permission to.
* *
* @since 2.0.0 * @since 2.0.0
* *
@ -499,12 +499,12 @@ class WP_User {
$wp_roles = wp_roles(); $wp_roles = wp_roles();
//Filter out caps that are not role names and assign to $this->roles // Filter out caps that are not role names and assign to $this->roles.
if ( is_array( $this->caps ) ) { if ( is_array( $this->caps ) ) {
$this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) ); $this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
} }
//Build $allcaps from role caps, overlay user's $caps // Build $allcaps from role caps, overlay user's $caps.
$this->allcaps = array(); $this->allcaps = array();
foreach ( (array) $this->roles as $role ) { foreach ( (array) $this->roles as $role ) {
$the_role = $wp_roles->get_role( $role ); $the_role = $wp_roles->get_role( $role );