From bf339a59c2f6d80d61607a1e4307bcd971ea359c Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:54:53 +0200 Subject: [PATCH] Easier fix, thanks @HB9HIL --- application/controllers/User.php | 2 +- application/models/User_model.php | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index b0dd94e4e..08275c33d 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -866,7 +866,7 @@ class User extends CI_Controller { } else { if($this->user_model->login() == 1) { $this->session->set_flashdata('notice', __("User logged in")); - $this->user_model->update_session($data['user']->user_id, null, true); + $this->user_model->update_session($data['user']->user_id); $cookie= array( 'name' => $this->config->item('gettext_cookie', 'gettext'), diff --git a/application/models/User_model.php b/application/models/User_model.php index c92fa27ac..e68d9f0be 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -407,7 +407,7 @@ class User_Model extends CI_Model { // FUNCTION: void update_session() // Updates a user's login session after they've logged in // TODO: This should return bool TRUE/FALSE or 0/1 - function update_session($id, $u = null, $login = false) { + function update_session($id, $u = null) { if ($u == null) { $u = $this->get_by_id($id); @@ -456,13 +456,11 @@ class User_Model extends CI_Model { ); foreach (array_keys($this->frequency->defaultFrequencies) as $band) { - if ($login) { - $qrg_unit = $this->user_options_model->get_options('frequency', array('option_name' => 'unit', 'option_key' => $band), $u->row()->user_id)->row()->option_value ?? ''; - } else { - $qrg_unit = $this->session->userdata("qrgunit_$band") ?? ''; - } + $qrg_unit = $this->session->userdata("qrgunit_$band") ?? ($this->user_options_model->get_options('frequency', array('option_name' => 'unit', 'option_key' => $band))->row()->option_value ?? ''); if ($qrg_unit !== '') { $userdata['qrgunit_'.$band] = $qrg_unit; + } else { + $userdata['qrgunit_'.$band] = $this->frequency->defaultFrequencies[$band]['UNIT']; } }