xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision 0115bc1678cafd957052cd2d256563ad3e242cc1)
1<?php use Fisharebest\Webtrees\Bootstrap4; ?>
2<?php use Fisharebest\Webtrees\Functions\FunctionsDate; ?>
3<?php use Fisharebest\Webtrees\I18N; ?>
4
5<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
6
7<h1><?= $title ?></h1>
8
9<form>
10    <input type="hidden" name="route" value="admin-users-cleanup">
11    <div class="form-group row">
12        <label for="months" class="col-sm-8 col-form-label">
13            <?= I18N::translate('Number of months since the last sign-in for a user’s account to be considered inactive: ') ?>
14        </label>
15        <div class="col-sm-2">
16            <?= Bootstrap4::select($options, $months, ['id' => 'months', 'name' => 'months']) ?>
17        </div>
18        <div class="col-sm-2">
19            <button type="submit" class="btn btn-primary">
20                <?= I18N::translate('update') ?>
21            </button>
22        </div>
23    </div>
24</form>
25
26<form method="post">
27    <?= csrf_field() ?>
28
29    <table class="table table-bordered">
30        <?php foreach ($inactive_users as $user) : ?>
31            <tr>
32                <td>
33                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->getUserId()])) ?>">
34                        <?= e($user->getUserName()) ?>
3536                        <span dir="auto"><?= e($user->getRealName()) ?></span>
37                    </a>
38                </td>
39                <td>
40                    <?= I18N::translate('User’s account has been inactive too long: ') . FunctionsDate::timestampToGedcomDate(max((int) $user->getPreference('reg_timestamp'), (int) $user->getPreference('sessiontime')))->display() ?>
41                </td>
42                <td>
43                    <input type="checkbox" name="del_<?= $user->getUserId() ?>">
44                </td>
45            </tr>
46        <?php endforeach ?>
47
48        <?php foreach ($unverified_users as $user) : ?>
49            <tr>
50                <td>
51                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->getUserId()])) ?>">
52                        <?= e($user->getUserName()) ?>
5354                        <span dir="auto"><?= e($user->getRealName()) ?></span>
55                    </a>
56                </td>
57                <td>
58                    <?= I18N::translate('User didn’t verify within 7 days.') ?>
59                    <?php if ($user->getPreference('verified_by_admin') !== '1') : ?>
60                        <?= I18N::translate('User not verified by administrator.') ?>
61                    <?php endif ?>
62                </td>
63                <td>
64                    <input type="checkbox" name="del_<?= $user->getUserId() ?>">
65                </td>
66            </tr>
67        <?php endforeach ?>
68    </table>
69
70    <p>
71        <?php if (empty($inactive_users) && empty($unverified_users)) : ?>
72            <?= I18N::translate('Nothing found to cleanup') ?>
73        <?php else : ?>
74        <button type="submit" class="btn btn-primary">
75            <?= I18N::translate('delete') ?>
76        </button>
77        <?php endif ?>
78    </p>
79</form>
80