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; 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'); }?>