From 7e09bfd82fcbc90e95b6196393a0eaedaa16ff29 Mon Sep 17 00:00:00 2001 From: Stefan Hanauska Date: Wed, 27 Aug 2025 09:47:38 +0200 Subject: [PATCH] MDL-86454 badges: Hide revoke button if not available --- public/badges/renderer.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/public/badges/renderer.php b/public/badges/renderer.php index 6177145ac30..07150a3e0b8 100644 --- a/public/badges/renderer.php +++ b/public/badges/renderer.php @@ -151,12 +151,17 @@ class core_badges_renderer extends plugin_renderer_base { 'value' => $this->output->larrow() . ' ' . get_string('award', 'badges'), 'class' => 'actionbutton btn btn-secondary') ); - $actioncell->text .= html_writer::empty_tag('input', array( + if (has_capability('moodle/badges:revokebadge', $this->page->context)) { + $actioncell->text .= html_writer::empty_tag( + 'input', + [ 'type' => 'submit', 'name' => 'revoke', 'value' => get_string('revoke', 'badges') . ' ' . $this->output->rarrow(), - 'class' => 'actionbutton btn btn-secondary') - ); + 'class' => 'actionbutton btn btn-secondary', + ] + ); + } $actioncell->text .= html_writer::end_tag('div', array()); $actioncell->attributes['class'] = 'actions'; $potentialcell = new html_table_cell();