LLMS_User_Permissions::edit_others_lms_content( array $allcaps, array $cap, array $args )

Handle capabilities checks for lms content to allow *editing* content based on course instructor meta data


Description Description


Parameters Parameters

$allcaps

(array) (Required) All the capabilities of the user

$cap

(array) (Required) [0] Required capability

$args

(array) (Required) [0] Requested capability [1] User ID [2] Associated object ID


Top ↑

Return Return

(array)


Top ↑

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;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.13.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.