Merge branch 'MDL-87075-500' of https://github.com/raortegar/moodle into MOODLE_500_STABLE

This commit is contained in:
Huong Nguyen
2026-02-13 09:50:20 +07:00
+4 -4
View File
@@ -2881,12 +2881,12 @@ function get_roles_used_in_context(context $context, $includeparents = true) {
* It is using the CFG->profileroles to limit the list to only interesting roles.
* (The permission tab has full details of user role assignments.)
*
* @param int $userid
* @param int $userid ID of the user whose course roles are filtered by visibility
* @param int $courseid
* @return string
*/
function get_user_roles_in_course($userid, $courseid) {
global $CFG, $DB;
global $CFG, $DB, $USER;
if ($courseid == SITEID) {
$context = context_system::instance();
} else {
@@ -2926,7 +2926,7 @@ function get_user_roles_in_course($userid, $courseid) {
$rolestring = '';
if ($roles = $DB->get_records_sql($sql, $params)) {
$viewableroles = get_viewable_roles($context, $userid);
$viewableroles = get_viewable_roles($context, $USER->id);
$rolenames = array();
foreach ($roles as $roleid => $unused) {
@@ -3384,7 +3384,7 @@ function get_switchable_roles(context $context, $rolenamedisplay = ROLENAME_ALIA
* Gets a list of roles that this user can view in a context
*
* @param context $context a context.
* @param int $userid id of user.
* @param int $userid id of user whose viewable roles we are fetching
* @param int $rolenamedisplay the type of role name to display. One of the
* ROLENAME_X constants. Default ROLENAME_ALIAS.
* @return array an array $roleid => $rolename.