Elgg  Version master
inactive.php
Go to the documentation of this file.
1 <?php
6 use Elgg\Values;
7 
8 elgg_unregister_event_handler('register', 'menu:filter:admin/users', 'Elgg\Menus\FilterSortItems::registerTimeCreatedSorting');
9 elgg_register_event_handler('register', 'menu:filter:admin/users', 'Elgg\Menus\FilterSortItems::registerLastLoginSorting', 499);
10 
11 $last_login_before = (int) get_input('last_login_before', Values::normalizeTimestamp('-120 days'));
12 
13 echo elgg_view('admin/users/header', [
14  'filter' => 'inactive',
15  'show_search_form' => true,
16  'additional_search_fields' => [[
17  '#type' => 'date',
18  '#label' => elgg_echo('admin:users:inactive:last_login_before'),
19  '#help' => elgg_echo('admin:users:inactive:last_login_before:help'),
20  'name' => 'last_login_before',
21  'value' => $last_login_before,
22  'timestamp' => true,
23  'required' => true,
24  'datepicker_options' => [
25  'maxDate' => -1,
26  ],
27  ]],
28 ]);
29 
30 echo elgg_view_form('admin/users/bulk_actions', [
31  'prevent_double_submit' => false,
32 ], [
33  'filter' => 'inactive',
34  'options' => [
35  'metadata_name_value_pairs' => [
36  'name' => 'last_login',
37  'value' => $last_login_before,
38  'operand' => '<',
39  'type' => ELGG_VALUE_INTEGER,
40  ],
41  'created_before' => $last_login_before,
42  'sort_by' => get_input('sort_by', [
43  'property' => 'last_login',
44  'direction' => 'asc',
45  ]),
46  'columns' => [
47  elgg()->table_columns->checkbox(elgg_view('input/checkbox', [
48  'name' => 'user_guids',
49  'title' => elgg_echo('table_columns:fromView:checkbox'),
50  ]), [
51  'name' => 'user_guids[]',
52  ]),
53  elgg()->table_columns->icon(null, [
54  'use_hover' => false,
55  ]),
56  elgg()->table_columns->user(null, [
57  'item_view' => 'user/default/admin_column',
58  ]),
59  elgg()->table_columns->email(),
60  elgg()->table_columns->last_login(null, [
61  'format' => 'friendly',
62  ]),
63  elgg()->table_columns->entity_menu(null, [
64  'add_user_hover_admin_section' => true,
65  'admin_listing' => elgg_extract('filter', $vars, 'all'),
66  ]),
67  ],
68  ],
69 ]);
elgg_register_event_handler(string $event, string $type, callable|string $callback, int $priority=500)
Helper functions for event handling.
Definition: events.php:48
elgg
Definition: install.js:27
elgg_unregister_event_handler(string $event, string $type, callable|string $callback)
Unregisters a callback for an event.
Definition: events.php:62
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
Definition: views.php:1054
$last_login_before
Definition: inactive.php:11
Saves user notification settings.
const ELGG_VALUE_INTEGER
Value types.
Definition: constants.php:111
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177
$vars
Definition: theme.php:5