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