aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2020-06-14 19:50:09 +0200
committerGravatar GitHub <noreply@github.com> 2020-06-14 19:50:09 +0200
commitcaeb660f29d13db62d5381c262aa03e12f201ea2 (patch)
treebbe593de7c584f15c67c1e4c96f0852c2c5637ed /app/views
parent6edbeaaf6add5e6f60d949301a05ef42fbdc6afd (diff)
Add a way to disable/enable users (#3056)
If you want to block users without deleting their account, you can now disable them from the interface.
Diffstat (limited to 'app/views')
-rw-r--r--app/views/user/details.phtml9
-rw-r--r--app/views/user/manage.phtml4
2 files changed, 11 insertions, 2 deletions
diff --git a/app/views/user/details.phtml b/app/views/user/details.phtml
index 8b3cc3a44..b93cd4d72 100644
--- a/app/views/user/details.phtml
+++ b/app/views/user/details.phtml
@@ -1,6 +1,8 @@
<?php $this->partial('aside_configure'); ?>
+<?php $isDefault = $this->details['is_default']; ?>
<?php $isAdmin = $this->details['is_admin']; ?>
+<?php $enabled = $this->details['enabled']; ?>
<div class="post">
<a href="<?= _url('user', 'manage'); ?>"><?= _t('admin.user.back_to_manage'); ?></a>
@@ -68,11 +70,16 @@
<button type="submit" class="btn btn-important" name="action" value="update"><?= _t('gen.action.update') ?></button>
<button type="submit" class="btn btn-attention confirm" name="action" value="purge"><?= _t('gen.action.purge') ?></button>
<button type="submit" class="btn btn-attention confirm" name="action" value="delete"><?= _t('gen.action.remove') ?></button>
- <?php if ($isAdmin && !$this->isDefaultUser): ?>
+ <?php if ($isAdmin && !$isDefault): ?>
<button type="submit" class="btn btn-attention confirm" name="action" value="demote"><?= _t('gen.action.demote') ?></button>
<?php elseif (!$isAdmin): ?>
<button type="submit" class="btn btn-attention confirm" name="action" value="promote"><?= _t('gen.action.promote') ?></button>
<?php endif; ?>
+ <?php if ($enabled && !$isDefault): ?>
+ <button type="submit" class="btn btn-attention" name="action" value="disable"><?= _t('gen.action.disable') ?></button>
+ <?php elseif (!$enabled): ?>
+ <button type="submit" class="btn btn-attention" name="action" value="enable"><?= _t('gen.action.enable') ?></button>
+ <?php endif; ?>
<div>
</div>
</form>
diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml
index 5c4e1e128..cf053d918 100644
--- a/app/views/user/manage.phtml
+++ b/app/views/user/manage.phtml
@@ -71,6 +71,7 @@
<thead>
<tr>
<th><?= _t('admin.user.username') ?></th>
+ <th><?= _t('admin.user.enabled') ?></th>
<th><?= _t('admin.user.is_admin') ?></th>
<th><?= _t('admin.user.email') ?></th>
<th><?= _t('admin.user.language') ?></th>
@@ -82,8 +83,9 @@
</thead>
<tbody>
<?php foreach ($this->users as $username => $values) : ?>
- <tr>
+ <tr <?php if ($values['is_default']):?>class="default-user"<?php endif; ?>>
<td><a href="<?= _url('user', 'details', 'username', $username) ?>"><?= $username ?></a></td>
+ <td><?= $values['enabled'] ? '✔' : ' ' ?></td>
<td><?= $values['is_admin'] ? '✔' : ' ' ?></td>
<td><?= $values['mail_login'] ?></td>
<td><?= _t("gen.lang.{$values['language']}") ?></td>