Added user_id to del_option

This commit is contained in:
Andreas Kristiansen
2025-10-27 15:37:56 +01:00
parent 8245fa29e9
commit a2f70a98f4
2 changed files with 8 additions and 5 deletions

View File

@@ -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);

View File

@@ -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);
}