Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Roles::get_core_caps( string $role )

Retrieve the LifterLMS core capabilities for a give role


Parameters Parameters

$role

(string) (Required) Name of the role.


Top ↑

Return Return

(string[])


Top ↑

Source Source

File: includes/class.llms.roles.php

	private static function get_core_caps( $role ) {

		$all_caps = array_fill_keys( array_values( self::get_all_core_caps() ), true );

		switch ( $role ) {

			case 'instructor':
			case 'instructors_assistant':
				$caps = $all_caps;
				unset(
					$caps['enroll'],
					$caps['unenroll'],
					$caps['manage_lifterlms'],
					$caps[ self::MANAGE_EARNED_ENGAGEMENT_CAP ],
					$caps['view_others_lifterlms_reports'],
					$caps['create_students'],
					$caps['view_others_students'],
					$caps['edit_students'],
					$caps['edit_others_students'],
					$caps['delete_students'],
					$caps['delete_others_students'],
					$caps['view_grades']
				);
				break;

			case 'administrator':
			case 'lms_manager':
				$caps = $all_caps;
				break;

			default:
				$caps = array();

		}

		/**
		 * Filters the LifterLMS capabilities added to a LifterLMS user role.
		 *
		 * The dynamic portion of this hook `$role` refers to the user's role name.
		 *
		 * @since 4.21.2
		 *
		 * @param string[] $caps     List of capabilities provided to the role.
		 * @param string[] $all_caps Full list of all LifterLMS user capabilities.
		 */
		return apply_filters( "llms_get_{$role}_core_caps", $caps, $all_caps );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Added manage_earned_engagement to the list of instructor/assistant caps which are not automatically available.
4.21.2 Added 'view_grades' to the list of instructor/assistant caps which are not automatically available.
3.34.0 Added student management capabilities.
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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