diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index cba2d9c1c..db871700e 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -444,8 +444,16 @@ class Logbook_model extends CI_Model { } $this->add_qso($data, $skipexport = false); + $this->load->model('stations'); $this->load->library('Mh'); - $this->mh->wl_event('qso/logged/'.$this->session->userdata('user_id'), json_encode($data)); + $h_user=$this->stations->get_user_from_station($station_id); + $event_data=$data; + $event_data['user_name']=$h_user->user_name; + $event_data['user_id']=$h_user->user_id; + $this->mh->wl_event('qso/logged/'.($h_user->user_id ?? ''), json_encode($event_data)); + unset($event_data); + unset($h_user); + unset($data); } public function check_last_lotw($call) { // Fetch difference in days when $call has last updated LotW @@ -4596,8 +4604,15 @@ class Logbook_model extends CI_Model { } if ($apicall) { + $this->load->model('stations'); $this->load->library('Mh'); - $this->mh->wl_event('qso/logged/api/'.($this->session->userdata('user_id') ?? 'API'), json_encode($data)); + $h_user=$this->stations->get_user_from_station($station_id); + $event_data=$data; + $event_data['user_name']=($h_user->user_name ?? ''); + $event_data['user_id']=($h_user->user_id ?? ''); + $this->mh->wl_event('qso/logged/api/'.($h_user->user_id ?? ''), json_encode($event_data)); + unset($event_data); + unset($h_user); } // Save QSO if ($batchmode) { diff --git a/application/models/Stations.php b/application/models/Stations.php index f39546edb..66d2d6ac6 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -570,6 +570,16 @@ class Stations extends CI_Model { } } + public function get_user_from_station($stationid) { + if (($stationid ?? '') != '') { + $sql="select u.* from users u inner join station_profile sp on (u.user_id=sp.user_id) where sp.station_id = ?"; + $query = $this->db->query($sql, $stationid); + return $query->row(); + } else { + return false; + } + } + public function check_station_against_user($stationid, $userid) { $this->db->select('station_id'); $this->db->where('user_id', $userid);