From c3cec81ccb2d7c829793fe971f99e03b584be287 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Mon, 8 Jan 2024 12:08:53 +0100 Subject: [PATCH 1/2] added refresh button --- application/views/user/main.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/views/user/main.php b/application/views/user/main.php index 9eb67ec4b..4f58d1e6a 100644 --- a/application/views/user/main.php +++ b/application/views/user/main.php @@ -44,7 +44,7 @@ - + "; ?> @@ -65,7 +65,13 @@ echo $l[$row->user_type]; ?> last_seen != null) { // if the user never logged in before the value is null. We can show "never" then. - echo $row->last_seen; + $lastSeenTimestamp = strtotime($row->last_seen); + $currentTimestamp = time(); + if (($currentTimestamp - $lastSeenTimestamp) < 120) { + echo " " . $row->last_seen . ""; + } else { + echo " " . $row->last_seen . ""; + } } else { echo lang('general_word_never'); }?> From be205604c08661d03f8bcc5e92c7351d9d211754 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Mon, 8 Jan 2024 12:11:22 +0100 Subject: [PATCH 2/2] replaced set last_seen --- application/models/User_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/User_model.php b/application/models/User_model.php index ca4b5372e..6d3ededf4 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -437,7 +437,6 @@ class User_Model extends CI_Model { // Checks a user's level of access against the given $level function authorize($level) { $u = $this->get_by_id($this->session->userdata('user_id')); - $this->set_last_seen($u->row()->user_id); $l = $this->config->item('auth_mode'); // Check to see if the minimum level of access is higher than // the user's own level. If it is, use that. @@ -445,6 +444,7 @@ class User_Model extends CI_Model { $level = $this->config->item('auth_mode'); } if(($this->validate_session()) && ($u->row()->user_type >= $level) || $this->config->item('use_auth') == FALSE || $level == 0) { + $this->set_last_seen($u->row()->user_id); return 1; } else { return 0;