When getting lists of roles, put role names through format_string
(ie for multilang filter)
This commit is contained in:
+3
-3
@@ -2476,7 +2476,7 @@ function get_assignable_roles ($context) {
|
||||
if ($roles = get_records('role', '', '', 'sortorder ASC')) {
|
||||
foreach ($roles as $role) {
|
||||
if (user_can_assign($context, $role->id)) {
|
||||
$options[$role->id] = $role->name;
|
||||
$options[$role->id] = strip_tags(format_string($role->name, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2495,7 +2495,7 @@ function get_overridable_roles ($context) {
|
||||
if ($roles = get_records('role', '', '', 'sortorder ASC')) {
|
||||
foreach ($roles as $role) {
|
||||
if (user_can_override($context, $role->id)) {
|
||||
$options[$role->id] = $role->name;
|
||||
$options[$role->id] = strip_tags(format_string($role->name, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2798,4 +2798,4 @@ function get_users_from_role_on_context($role, $context) {
|
||||
AND roleid = $role->id");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+3
-3
@@ -1424,7 +1424,7 @@ function text_format_name( $key ) {
|
||||
*/
|
||||
function format_string ($string, $striplinks = false, $courseid=NULL ) {
|
||||
|
||||
global $CFG, $course;
|
||||
global $CFG, $COURSE;
|
||||
|
||||
//We'll use a in-memory cache here to speed up repeated strings
|
||||
static $strcache;
|
||||
@@ -1438,8 +1438,8 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) {
|
||||
}
|
||||
|
||||
if (empty($courseid)) {
|
||||
if (!empty($course->id)) { // An ugly hack for better compatibility
|
||||
$courseid = $course->id; // (copied from format_text)
|
||||
if (!empty($COURSE->id)) { // An ugly hack for better compatibility
|
||||
$courseid = $COURSE->id; // (copied from format_text)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user