Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

GDN_User.HourOffset being overwritten

edited June 2014 in Vanilla 2.0 - 2.8

I have a weird thing going on.

I have my HourOffset in mysql set to -7.

I will go into mysql and change GDN_User.HourOffset to 0. Then I'll refresh the Vanilla page, and the '0' is in effect.

Howerver as soon as the page is refreshed, the mysql database gets overwritten back to -7.

Is there something being saved somewhere that forces this automatic overwrite? It will happen every single time.

You can see my mysql session prior to refreshing the vanilla page, it remains at 0 until I do something with vanilla

mysql> UPDATE vanilla2.GDN_User SET HourOffset = 0 WHERE GDN_User.UserID =2; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0

mysql> select HourOffset from GDN_User where UserID=2; +------------+ | HourOffset | +------------+ | 0 | +------------+ 1 row in set (0.01 sec)

select again after a few seconds, still set to 0

mysql> select HourOffset from GDN_User where UserID=2; +------------+ | HourOffset | +------------+ | 0 | +------------+ 1 row in set (0.00 sec)

Now as soon as I refresh the vanilla page:

mysql> select HourOffset from GDN_User where UserID=2; +------------+ | HourOffset | +------------+ | -7 | +------------+ 1 row in set (0.00 sec)

Answers

  • Options

    BTW this is vanilla 2.1

  • Options
    hgtonighthgtonight ∞ · New Moderator

    Your current hour offset is automatically calculated locally in JS every page visit. If the local calculation doesn't match the server stored offset (which you can see in the #Definitions element), it triggers an update to the currently logged in user.

    You should solve this problem by setting the server timezone according to your preference.

    You can disable the automatic hour offset functionality by commenting out the relevant code in your /js/global.js file (lines 1147-1154).

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    great, I'll take a look and try it out. The forum's timezone is meant to be different than the server, so that's why I'd like it not to automatically reset

    thank you

  • Options

    Thanks.

    I commented this out in js/global.js and it seems to work:

    // Ajax/Save the ClientHour if it is different from the value in the db.
    // $('input:hidden[id$=SetHourOffset]').livequery(function() {
    // if (hourOffset != $(this).val()) {
    // $.post(
    // gdn.url('/utility/sethouroffset.json'),
    // { HourOffset: hourOffset, TransientKey: gdn.definition('TransientKey') }
    // );
    // }
    // });

    However, I found it starting at line 32 in the file, not around 1147.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @rmkleemann said:

    ...I found it starting at line 32 in the file, not around 1147.

    Glad you found it!

    I don't know how I made that mistake. :S

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.