LLMS_User_Permissions::edit_others_lms_content( bool[] $allcaps, string[] $cap, array $args )
Handle capabilities checks for lms content to allow *editing* content based on course instructor
Parameters Parameters
- $allcaps
-
(bool[]) (Required) Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.
- $cap
-
(string[]) (Required) Required primitive capabilities for the requested capability.
- $args
-
(array) (Required) Arguments that accompany the requested capability check.
- (string) Requested capability.
- '1'
(int) Concerned user ID. - '...$2'
(mixed) Optional second and further parameters, typically object ID.
Return Return
(array)
Source Source
File: includes/class.llms.user.permissions.php
public function edit_others_lms_content( $allcaps, $cap, $args ) { /** * this might be a problem * this happens when in wp-admin/includes/post.php * when actually creating/updating a course * and no post_id is passed in $args[2]. */ if ( empty( $args[2] ) ) { $allcaps[ $cap[0] ] = true; return $allcaps; } $instructor = llms_get_instructor( $args[1] ); if ( $instructor && $instructor->is_instructor( $args[2] ) ) { $allcaps[ $cap[0] ] = true; } return $allcaps; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.13.0 | Introduced. |