From 0bc7f44e260556a67a0ae7910bbaa372397b77ec Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 10 Apr 2024 15:04:07 +0100 Subject: [PATCH] fixes issues with card enabling when creating new user --- application/controllers/User.php | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/application/controllers/User.php b/application/controllers/User.php index 2c63e423..94998733 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -59,6 +59,61 @@ class User extends CI_Controller { $data['timezones'] = $this->user_model->timezones(); $data['language'] = 'english'; + // Set defaults + $data['dashboard_upcoming_dx_card'] = false; + $data['dashboard_qslcard_card'] = false; + $data['dashboard_eqslcard_card'] = false; + $data['dashboard_lotw_card'] = false; + $data['dashboard_vuccgrids_card'] = false; + + $dashboard_options = $this->user_options_model->get_options('dashboard')->result(); + + foreach ($dashboard_options as $item) { + $option_name = $item->option_name; + $option_key = $item->option_key; + $option_value = $item->option_value; + + if ($option_name == 'dashboard_upcoming_dx_card' && $option_key == 'enabled') { + if($item->option_value == 'true') { + $data['dashboard_upcoming_dx_card'] = true; + } else { + $data['dashboard_upcoming_dx_card'] = false; + } + } + + if ($option_name == 'dashboard_qslcards_card' && $option_key == 'enabled') { + if($item->option_value == 'true') { + $data['dashboard_qslcard_card'] = true; + } else { + $data['dashboard_qslcard_card'] = false; + } + } + + if ($option_name == 'dashboard_eqslcards_card' && $option_key == 'enabled') { + if($item->option_value == 'true') { + $data['dashboard_eqslcard_card'] = true; + } else { + $data['dashboard_eqslcard_card'] = false; + } + } + + if ($option_name == 'dashboard_lotw_card' && $option_key == 'enabled') { + if($item->option_value == 'true') { + $data['dashboard_lotw_card'] = true; + } else { + $data['dashboard_lotw_card'] = false; + } + } + + if ($option_name == 'dashboard_vuccgrids_card' && $option_key == 'enabled') { + if($item->option_value == 'true') { + $data['dashboard_vuccgrids_card'] = true; + } else { + $data['dashboard_vuccgrids_card'] = false; + } + } + } + if ($this->form_validation->run() == FALSE) { $data['page_title'] = "Add User"; $data['measurement_base'] = $this->config->item('measurement_base');