The Widgets are showing the wrong time.
-
I’ve postet a answer at following time: 11. September 2019, 20:05
But the widget tells me it was posted 2 hours ago also the forum tells me the latest post was 2 hours back. How can i fix that? My local Time Settings are working fine.
The page I need help with: [log in to see the link]
-
Hello @orionexodus
Asgaros Forum uses the time-information which is provided by the WordPress core-functions. Those are based on the server-configuration. However, it seems there are a couple of bugs in the WordPress-implementation based on this ticket, so unfortunately its impossible to fix this from my side:
Why a couple of bugs? thats the only thing thats not working right. I really want to get this corrected an ive seen all these peoples with the same problem and the same not useful answer to it. Is there not a way to remove 2 hours per code when it gets displayed?
The main-problem is, that the time is returned from a WordPress-function. If I change the logic, it would work fine for you, but the time will be wrong for all other users for which the current implementation is working fine.
The only solution in your case is to directly modify a couple of function-calls to add/remove those two hours manually. You can find some details about the related code here (in German):
https://www.asgaros.de/support/topic/wrong-time/?part=2#postid-8502
Sorry wusste nicht das man hier Deutsch schreiben kann, habe jetzt was ganz merkwürdiges festgestellt. Nach einer Stunde wird mir angezeigt das vor 3 Stunden gepostet wurde statt 4. Der muss ja irgendwo +4 rechnen und dann runterzählen völlig verkehrt.
auch komisch ist das nichts passiert wenn ich die 4 Stunden dazu rechne…
Hab da gerade was interessantes gefunden dazu: https://wp-hackers.automattic.narkive.com/IPej0nQK/possible-bug-in-the-function-human-time-diffIch nutze Cloudflare um meine Seiten zu schützen kann es sein das die Zeitzonen von denen das beinflussen hier?
-
This reply was modified 5 years, 6 months ago by
Dave Exodus.
Hallo @orionexodus
Die Zeitzonen müssen von meiner Seite aus nicht neu gesetzt werden, da sich WordPress darum kümmert. Dafür gibt es ja unter anderem auch die Zeitzonen-Einstelunngen.
An welcher Stelle hast du den Code denn angepasst? Für die Widgets müsstest du das entsprechend in den folgenden Dateien machen:
– widgets/widget-recent-posts.php
– widgets/widget-recent-topics.phpJa habe die beiden genau so angepasst. Die Zeile sieht so aus:
'<span class="post-date">'.sprintf(__('%s ago', 'asgaros-forum'), human_time_diff(strtotime($element->date." +4 hours"), current_time('timestamp'))).'</span>';
Funktioniert aber immer noch nicht.
@orionexodus Hat sich denn nach der Änderungen irgendetwas an der Zeitausgabe geändert oder ist der Wert exakt der selbe?
Für mich ist es relativ schwierig – bzw eher nahezu unmöglich – daran etwas zu ändern da die Zeitangaben komplett intern von WordPress generiert werden. Im verlinkten Bugreport wurde ja schon erwähnt, dass es noch etliche Probleme mit den verschiedensten Zeitzonen-Konfigurationen gibt. Spezielle Server-/Datenbankeinstellungen haben darauf auch noch Einfluss. Eine Möglichkeit wäre auch, den Hoster zu kontaktieren, möglicherweiße kann dieser von seiner Seite aus die Ursache einschränken.
Soweit ich weiss ist der Wert exakt derselbe. Bin gerade auf dem Weg in die Ferien kann dir in 3 Wochen nochmal genau Bescheid geben.
-
This reply was modified 5 years, 6 months ago by
- The topic ‘The Widgets are showing the wrong time.’ is closed to new replies.