Skip to content

Commit

Permalink
Hide buttons in user profile if current user has no edit permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
giuscris committed May 25, 2024
1 parent 27d9126 commit 84fc46a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions panel/views/users/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

<div class="header">
<div class="header-title"><?= $this->translate('panel.users.user') ?></div>
<div>
<button type="button" class="button button-link" data-modal="deleteUserModal" data-modal-action="<?= $panel->uri('/users/' . $user->username() . '/delete/') ?>" title="<?= $this->translate('panel.users.deleteUser') ?>" aria-label="<?= $this->translate('panel.users.deleteUser') ?>" <?php if (!$panel->user()->canDeleteUser($user)) : ?>disabled<?php endif ?>><?= $this->icon('trash') ?></button>
<button type="submit" class="button button-accent" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button>
</div>
<?php if ($panel->user()->canChangeOptionsOf($user)) : ?>
<div>
<button type="button" class="button button-link" data-modal="deleteUserModal" data-modal-action="<?= $panel->uri('/users/' . $user->username() . '/delete/') ?>" title="<?= $this->translate('panel.users.deleteUser') ?>" aria-label="<?= $this->translate('panel.users.deleteUser') ?>" <?php if (!$panel->user()->canDeleteUser($user)) : ?>disabled<?php endif ?>><?= $this->icon('trash') ?></button>
<button type="submit" class="button button-accent" data-command="save"><?= $this->icon('check-circle') ?> <?= $this->translate('panel.modal.action.save') ?></button>
</div>
<?php endif ?>
</div>

<section class="section">
Expand Down

0 comments on commit 84fc46a

Please sign in to comment.