MDL-87649 user: Show suspended users more clearly

This commit is contained in:
Brendan Heywood
2026-03-13 00:54:49 +11:00
parent 6ebf41a6c2
commit 31f361c73f
3 changed files with 38 additions and 5 deletions
@@ -156,19 +156,36 @@ class users extends system_report {
if ($column = $this->get_column('user:fullnamewithpicturelink')) {
$column
->add_fields("{$entityuseralias}.suspended, {$entityuseralias}.confirmed")
->add_callback(static function(string $fullname, \stdClass $row): string {
->add_callback(static function (string $fullname, \stdClass $row): string {
if ($row->suspended) {
$fullname .= ' ' . \html_writer::tag('span', get_string('suspended', 'moodle'),
['class' => 'badge text-bg-secondary ms-1']);
$fullname .= ' ' . \html_writer::tag(
'span',
get_string('suspended', 'moodle'),
['class' => 'badge text-bg-warning ms-1']
);
}
if (!$row->confirmed) {
$fullname .= ' ' . \html_writer::tag('span', get_string('confirmationpending', 'admin'),
['class' => 'badge text-bg-danger ms-1']);
$fullname .= ' ' . \html_writer::tag(
'span',
get_string('confirmationpending', 'admin'),
['class' => 'badge text-bg-danger ms-1']
);
}
return $fullname;
});
}
if ($column = $this->get_column('user:email')) {
$column
->add_fields("{$entityuseralias}.suspended")
->add_callback(static function (string $email, \stdClass $row): string {
if ($row->suspended) {
$email = \html_writer::tag('del', $email);
}
return $email;
});
}
$this->set_initial_sort_column('user:fullnamewithpicturelink', SORT_ASC);
$this->set_default_no_results_notice(new lang_string('nousersfound', 'moodle'));
}
+9
View File
@@ -224,6 +224,15 @@ profile_view($user, $usercontext);
// TODO WORK OUT WHERE THE NAV BAR IS!
echo $OUTPUT->header();
if ($user->suspended) {
echo $OUTPUT->notification(
html_writer::tag('h4', get_string('suspended', 'auth')) .
get_string('suspended_help', 'auth'),
\core\output\notification::NOTIFY_WARNING
);
}
echo '<div class="userprofile">';
$hiddenfields = [];
+7
View File
@@ -190,6 +190,13 @@ echo '<div class="userprofile">';
$headerinfo = array('heading' => fullname($user), 'user' => $user, 'usercontext' => $usercontext);
echo $OUTPUT->context_header($headerinfo, 2);
if ($user->suspended) {
echo $OUTPUT->notification(
html_writer::tag('h4', get_string('suspended', 'auth')) .
get_string('suspended_help', 'auth'),
\core\output\notification::NOTIFY_WARNING
);
}
if ($user->deleted) {
echo $OUTPUT->heading(get_string('userdeleted'));
if (!has_capability('moodle/user:update', $coursecontext)) {