xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision fceda430129b1f9eadbe3ee42fc1f28a5c37c72b)
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                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userName()) ?>">
23                </td>
24                <td>
25                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
26                        <?= e($user->userName()) ?>
2728                        <span dir="auto"><?= e($user->realName()) ?></span>
29                    </a>
30                </td>
31                <td>
32                    <?= I18N::translate('User’s account has been inactive too long: ') ?>
33                    <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference(User::PREF_TIMESTAMP_REGISTERED), (int) $user->getPreference(User::PREF_TIMESTAMP_ACTIVE)))]) ?>
34                </td>
35            </tr>
36        <?php endforeach ?>
37
38        <?php foreach ($unverified_users as $user) : ?>
39            <tr>
40                <td>
41                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userName()) ?>">
42                </td>
43                <td>
44                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
45                        <?= e($user->userName()) ?>
4647                        <span dir="auto"><?= e($user->realName()) ?></span>
48                    </a>
49                </td>
50                <td>
51                    <?= I18N::translate('User didn’t verify within 7 days.') ?>
52                    <?php if ($user->getPreference(User::PREF_IS_ACCOUNT_APPROVED) !== '1') : ?>
53                        <?= I18N::translate('User not verified by administrator.') ?>
54                    <?php endif ?>
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