xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision 9ed80f829cfb208ae92f7928345696619569bf4e)
1<?php use Fisharebest\Webtrees\Carbon; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3
4<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
5
6<h1><?= $title ?></h1>
7
8<form>
9    <input type="hidden" name="route" value="admin-users-cleanup">
10    <div class="form-group row">
11        <label for="months" class="col-sm-8 col-form-label">
12            <?= I18N::translate('Number of months since the last sign-in for a user’s account to be considered inactive: ') ?>
13        </label>
14        <div class="col-sm-2">
15            <?= view('components/select', ['name' => 'months', 'selected' => $months, 'options' => $options]) ?>
16        </div>
17        <div class="col-sm-2">
18            <button type="submit" class="btn btn-primary">
19                <?= I18N::translate('update') ?>
20            </button>
21        </div>
22    </div>
23</form>
24
25<form method="post">
26    <?= csrf_field() ?>
27
28    <table class="table table-bordered">
29        <?php foreach ($inactive_users as $user) : ?>
30            <tr>
31                <td>
32                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
33                        <?= e($user->userName()) ?>
3435                        <span dir="auto"><?= e($user->realName()) ?></span>
36                    </a>
37                </td>
38                <td>
39                    <?= I18N::translate('User’s account has been inactive too long: ') ?>
40                    <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference('reg_timestamp'), (int) $user->getPreference('sessiontime')))]) ?>
41                </td>
42                <td>
43                    <input type="checkbox" name="del_<?= $user->id() ?>">
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->id()])) ?>">
52                        <?= e($user->userName()) ?>
5354                        <span dir="auto"><?= e($user->realName()) ?></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->id() ?>">
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