LLMS_User_Permissions::editable_roles( [type] $all_roles )

Filters roles available to users when creating / editing users on the admin panel Allows LMS Managers to create instructors and other managers Allows instructors to create & manage assistants


Description Description


Parameters Parameters

$all_roles

([type]) (Required) [description]


Top ↑

Return Return

([type]) [description]


Top ↑

Source Source

File: includes/class.llms.user.permissions.php

	public function editable_roles( $all_roles ) {

		$user = wp_get_current_user();

		$lms_roles = apply_filters( 'llms_editable_roles', array(
			'lms_manager' => array( 'instructor', 'instructors_assistant', 'lms_manager', 'student' ),
			'instructor' => array( 'instructors_assistant' ),
		) );

		foreach ( $lms_roles as $role => $allowed_roles ) {

			if ( in_array( $role, $user->roles ) ) {

				foreach ( $all_roles as $the_role => $caps ) {
					if ( ! in_array( $the_role, $allowed_roles ) ) {
						unset( $all_roles[ $the_role ] );
					}
				}
			}
		}

		return $all_roles;

	}

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.