From b1b08afd2360a728d720c3ac414db282b60cdc97 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Fri, 23 Dec 2022 04:46:32 +0100 Subject: [PATCH] Make user view columns dynamic by config --- config/config.default.php | 3 +++ includes/view/User_view.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/config/config.default.php b/config/config.default.php index f438f507..ce261089 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -285,6 +285,9 @@ return [ // Number of shifts to freeload until angel is locked for shift signup. 'max_freeloadable_shifts' => env('MAX_FREELOADABLE_SHIFTS', 2), + // Hide columns in backend user view. Possible values are any sortable parameters of the table. + 'disabled_user_view_columns' => [], + // Local timezone 'timezone' => env('TIMEZONE', 'Europe/Berlin'), diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 0fcf7371..b1c48683 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -158,6 +158,10 @@ function Users_view( $user_table_headers['last_login_at'] = Users_table_header_link('last_login_at', __('Last login'), $order_by); $user_table_headers['actions'] = ''; + foreach (config('disabled_user_view_columns') ?? [] as $key) { + unset($user_table_headers[$key]); + } + return page_with_title(__('All users'), [ msg(), buttons([