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