Maps capabilities via the map_meta_cap
filter.
Description
See also
Parameters
- $caps
-
(array) (Required) Required capabilities.
- $cap
-
(string) (Required) Capability name.
- $user_id
-
(int) (Required) User ID.
- $args
-
(array) (Required) Additional arguments.
Return
(array) Required mapped capabilities.
Source
File: src/db-objects/forms/form-capabilities.php
protected function map_meta_cap( $caps, $cap, $user_id, $args ) { if ( empty( $this->capability_mappings ) ) { return $caps; } if ( ! isset( $this->capability_mappings[ $cap ] ) ) { if ( ! isset( $caps[0] ) || ! isset( $this->capability_mappings[ $caps[0] ] ) ) { return $caps; } $cap = $caps[0]; } $user_id = absint( $user_id ); if ( is_callable( $this->capability_mappings[ $cap ] ) ) { $mapped_cap = call_user_func( $this->capability_mappings[ $cap ], $user_id, $args ); } else { $mapped_cap = $this->capability_mappings[ $cap ]; } $caps = array( $mapped_cap ); return $this->map_meta_cap( $caps, $mapped_cap, $user_id, $args ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |