Changeset 49802
- Timestamp:
- 12/15/2020 10:16:03 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r48665 r49802 8 8 9 9 /** 10 * Maps meta capabilities to primitive capabilities. 10 * Maps a capability to the primitive capabilities required of the given user to 11 * satisfy the capability being checked. 11 12 * 12 13 * This function also accepts an ID of an object to map against if the capability is a meta capability. Meta 13 14 * capabilities such as `edit_post` and `edit_user` are capabilities used by this function to map to primitive 14 * capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`.15 * capabilities that a user or role requires, such as `edit_posts` and `edit_others_posts`. 15 16 * 16 17 * Example usage: … … 20 21 * map_meta_cap( 'edit_post_meta', $user->ID, $post->ID, $meta_key ); 21 22 * 22 * This does not actually compare whether the user ID has the actual capability, 23 * just what the capability or capabilities are. Meta capability list value can 24 * be 'delete_user', 'edit_user', 'remove_user', 'promote_user', 'delete_post', 25 * 'delete_page', 'edit_post', 'edit_page', 'read_post', or 'read_page'. 23 * This function does not check whether the user has the required capabilities, 24 * it just returns what the required capabilities are. 26 25 * 27 26 * @since 2.0.0 … … 31 30 * @global array $post_type_meta_caps Used to get post type meta capabilities. 32 31 * 33 * @param string $cap Capability name.32 * @param string $cap Capability being checked. 34 33 * @param int $user_id User ID. 35 34 * @param mixed ...$args Optional further parameters, typically starting with an object ID. 36 * @return string[] Actual capabilities for meta capability.35 * @return string[] Primitive capabilities required of the user. 37 36 */ 38 37 function map_meta_cap( $cap, $user_id, ...$args ) { … … 623 622 624 623 /** 625 * Filters a user's capabilities depending on specific context and/or privilege. 624 * Filters the primitive capabilities required of the given user to satisfy the 625 * capability being checked. 626 626 * 627 627 * @since 2.8.0 628 628 * 629 * @param string[] $caps Array of the user's capabilities.630 * @param string $cap Capability name.629 * @param string[] $caps Primitive capabilities required of the user. 630 * @param string $cap Capability being checked. 631 631 * @param int $user_id The user ID. 632 * @param array $args Adds the context to the cap. Typically the object ID. 632 * @param array $args Adds context to the capability check, typically 633 * starting with an object ID. 633 634 */ 634 635 return apply_filters( 'map_meta_cap', $caps, $cap, $user_id, $args );
Note: See TracChangeset
for help on using the changeset viewer.