To reproduce the problem, go to the Joomla admin area and go to:
Global Settings> Server> Location Settings> Server Time Zone.
When saving a different time zone (In my case "Sao Paulo"), when I connect the administrative area, the time that shows the last time I connected is 2 hours more than the correct one.
After searching the core of Joomla, I noticed that in the directory C: \ path \ to \ site root \ libraries \ joomla \ table \ user.php
in line 460 of Joomla version 3.6.0 there is the function setLastVisit()
.
Within this function, it has a function that returns the preformatted date:
$Date = JFactory::getDate($timeStamp);
This same function is also responsible for receiving as a parameter, the time zone in question.
To solve my problem, I changed the setLastVisit()
function that was as follows:
public function setLastVisit($timeStamp = null, $userId = null) {
// Check for User ID
if (is_null($userId)) {
if (isset($this)) {
$userId = $this->id;
} else {
jexit('No userid in setLastVisit');
}
}
// If no timestamp value is passed to function, than current time is used.
$config = JFactory::getConfig();
$fusoHorario = $config->get('offset');
$date = JFactory::getDate($timeStamp, $fusoHorario);
// Update the database row for the user.
$db = $this->_db;
$query = $db->getQuery(true)
->update($db->quoteName($this->_tbl))
->set($db->quoteName('lastvisitDate') . '=' . $db->quote($date)) // In this line, there was a function that formatted the date to sql "$ date-> toSql ();" Which in my case was advancing at 2, the hours saved in my DB
->where($db->quoteName('id') . '=' . (int) $userId);
$db->setQuery($query);
$db->execute();
return true;
}
}
@lucasrotulo changing from timezone Vienna
> Sao Paulo
changes Last Visit Date
from "20:00" > "17:00" – or you mean another Point?
Status | New | ⇒ | Closed - No Reply |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-05 15:20:22 |
Closed_By | ⇒ | franz-wohlkoenig |
closed as "No Reply".
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/13491
I can not confirm the issue you are having. At least with 3.7.0-staging. And that specific method has not changed since 2013.
The only time I have managed to confirm it, is when that user has a different time zone than the global setting. Could that be the case in your findings?