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