From 8bbc0ba9bc2f142d6ebaa86d6e8fd00fc4149b5d Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 11 Oct 2022 14:54:34 +0100 Subject: [PATCH] Fixing my rubbish code --- application/controllers/Welcome.php | 5 +++-- application/models/Note.php | 6 +++--- application/views/welcome/index.php | 5 ++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php index adefaf27..7435c897 100644 --- a/application/controllers/Welcome.php +++ b/application/controllers/Welcome.php @@ -12,7 +12,7 @@ class Welcome extends CI_Controller { public function index() { - if($this->config->item('option_version2_trigger') == "false") { + if($this->optionslib->get_option('version2_trigger') == "false") { $data['page_title'] = "Welcome to Cloudlog Version 2.0"; // load stations model @@ -31,7 +31,8 @@ class Welcome extends CI_Controller { $this->load->model('note'); $data['NumberOfNotes'] = $this->note->CountAllNotes(); - if(!$data['CountAllStationLocations'] && !$data['NumberOfStationLogbooks'] && !$data['NumberOfAPIKeys'] && !$data['NumberOfNotes']) { + + if($data['CountAllStationLocations'] == 0 || $data['NumberOfStationLogbooks'] == 0 || $data['NumberOfAPIKeys'] == 0 || $data['NumberOfNotes'] > 0) { // load views $this->load->view('interface_assets/mini_header', $data); $this->load->view('welcome/index'); diff --git a/application/models/Note.php b/application/models/Note.php index 816d904c..0ace033a 100644 --- a/application/models/Note.php +++ b/application/models/Note.php @@ -57,9 +57,9 @@ class Note extends CI_Model { function CountAllNotes() { // count all notes - // where user_id is not NULL - $this->db->where('user_id !=', NULL); - return $this->db->count_all('notes'); + $this->db->where('user_id', NULL); + $query = $this->db->get('notes'); + return $query->num_rows(); } } diff --git a/application/views/welcome/index.php b/application/views/welcome/index.php index 3ec40c0f..b9740f69 100644 --- a/application/views/welcome/index.php +++ b/application/views/welcome/index.php @@ -116,10 +116,9 @@
- - + 0) { ?>
-
Claim Notes
+
Claim Notes

Looks like you have some notes saved, we need to assign them to your username.