xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision 2474349caa7b2aa11793e6008b000ebb1812e425)
1<?php
2
3use Fisharebest\Webtrees\Carbon;
4use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
5use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupAction;
6use Fisharebest\Webtrees\I18N;
7
8?>
9
10<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
11
12<h1><?= $title ?></h1>
13
14<form method="post" action="<?= e(route(UsersCleanupAction::class)) ?>">
15    <?= csrf_field() ?>
16
17    <table class="table table-bordered">
18        <?php foreach ($inactive_users as $user) : ?>
19            <tr>
20                <td>
21                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
22                        <?= e($user->userName()) ?>
2324                        <span dir="auto"><?= e($user->realName()) ?></span>
25                    </a>
26                </td>
27                <td>
28                    <?= I18N::translate('User’s account has been inactive too long: ') ?>
29                    <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference('reg_timestamp'), (int) $user->getPreference('sessiontime')))]) ?>
30                </td>
31                <td>
32                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>">
33                </td>
34            </tr>
35        <?php endforeach ?>
36
37        <?php foreach ($unverified_users as $user) : ?>
38            <tr>
39                <td>
40                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
41                        <?= e($user->userName()) ?>
4243                        <span dir="auto"><?= e($user->realName()) ?></span>
44                    </a>
45                </td>
46                <td>
47                    <?= I18N::translate('User didn’t verify within 7 days.') ?>
48                    <?php if ($user->getPreference('verified_by_admin') !== '1') : ?>
49                        <?= I18N::translate('User not verified by administrator.') ?>
50                    <?php endif ?>
51                </td>
52                <td>
53                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>">
54                </td>
55            </tr>
56        <?php endforeach ?>
57    </table>
58
59    <p>
60        <?php if ($inactive_users->isEmpty() && $unverified_users->isEmpty()) : ?>
61            <?= I18N::translate('Nothing found to cleanup') ?>
62        <?php else : ?>
63            <button type="submit" class="btn btn-primary">
64                <?= I18N::translate('delete') ?>
65            </button>
66        <?php endif ?>
67    </p>
68</form>
69