From a2f70a98f45907dc6ec32f62687609a64a63db0e Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:37:56 +0100 Subject: [PATCH] Added user_id to del_option --- application/controllers/User.php | 4 ++-- application/models/User_options_model.php | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index 7e50e0615..fdd0bf990 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -929,8 +929,8 @@ class User extends CI_Controller { } $this->user_options_model->set_option('map_custom','gridsquare',array('show'=>xss_clean($this->input->post('user_map_gridsquare_show', true))), $user_id); } else { - $this->user_options_model->del_option('map_custom','icon', $user_id); - $this->user_options_model->del_option('map_custom','gridsquare', $user_id); + $this->user_options_model->del_option('map_custom','icon', null, $user_id); + $this->user_options_model->del_option('map_custom','gridsquare', null, $user_id); } $this->user_options_model->set_option('header_menu', 'locations_quickswitch', array('boolean'=>xss_clean($this->input->post('user_locations_quickswitch', true))), $user_id); $this->user_options_model->set_option('header_menu', 'utc_headermenu', array('boolean'=>xss_clean($this->input->post('user_utc_headermenu', true))), $user_id); diff --git a/application/models/User_options_model.php b/application/models/User_options_model.php index a8d3e174c..ba047a661 100644 --- a/application/models/User_options_model.php +++ b/application/models/User_options_model.php @@ -52,8 +52,11 @@ class User_options_model extends CI_Model { return $this->db->query($sql, $array_sql_value); } - public function del_option($option_type, $option_name, $option_array=null) { - $uid=$this->session->userdata('user_id'); + public function del_option($option_type, $option_name, $option_array = null, $uid = null) { + if (($uid ?? '') == '') { + $uid = $this->session->userdata('user_id'); + } + $sql_more = ""; $array_sql_value = array($uid, $option_type, $option_name); if (is_array($option_array)) { @@ -62,7 +65,7 @@ class User_options_model extends CI_Model { $array_sql_value[] = $value; } } - $sql='delete from user_options where user_id=? and option_type=? and option_name=?'.$sql_more; + $sql='delete from user_options where user_id = ? and option_type = ? and option_name = ?'.$sql_more; return $this->db->query($sql, $array_sql_value); }