• Welcome to WebsiteBaker Community Forum. Please log in or sign up.
Welcome, Guest
News
Support WebsiteBaker
Your donations will help to:
PayPal
  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!
You can donate by clicking on the button below.

need some code help

Started by crnogorac081, October 09, 2023, 07:48:06 PM  ( Read 15,204 times )

crnogorac081

I am writing some code, and I need to get data from loged in user, like

$this->oReg->getUserId();


but it is not working. The code is inside the class, so it possible to get loged in user data without using $admin or Session ?
    Web developer

    crnogorac081

    I found this in oApp - $this->oApp->->getUserId();


    Also would like to report to add timezone to Login class, in lines 419 AND 577 I believe

    from
    . 'SET `login_when`='.\time().', '

    to

    . 'SET `login_when`='.\time() + $this->oReg->DefaultTimezone.', '


    where origianal code is

    $sql = 'UPDATE `'.TABLE_PREFIX.'users` '
                               
    . 'SET `login_when`='.\time().', '
                               
    .     '`login_ip`=\''.$sRemoteAddress.'\' '
                               
    . 'WHERE `user_id`=\''.$user_id.'\'';



      Web developer

      Gast

      to the timezone (the old theme...)

      normalize, all times are stored in the database in UTC (that's London time). for account-specific datas, the system search everytime, when needed, for the timezone of the logged user and add this timezone to the utc-time. in other, no-user-timezone-specific, it use the DefaultTimezone from the WB-Settings, for example: the date of the last modification in the frontend.

      to understand all this, we need an example:

      i was for a long time the admin of a charter boot service homepage in the caribic, the page was hosted in germany, because, the owner was a german. so the server-time was utc. as admin, i use utc+1 in winter and utc+2 in summertime. DefaultTimezone in Wb-Settings was UTC +5 and the page-owner has also utc +5 in his profile, because, he live's there in the caribic. If the two of us, the owner and I, log in at the same time, with the "private timezone-settings" from the user-profile, his login time will be 4:30 p.m. (UTC +5) and mine will be 1:30 p.m. (UTC +2), but we are online at the same time. if we use the globale DefaultTimezone from the WB-Settings, the database say's: i'm online at 4.30 p.m., but here it is 0.30 p.m.
      If we only use time(), everyone has the same time in the database and WB then uses the profile data to calculate the correct time



        DarkViper

        It is definitely not a good idea to change the kind of table column value. Other modules and also the core trust on the fact that they find a time in UTC here and not values ​​that are distorted by any time zone information.
        Note: Never change other modules without really knowing all the side effects that can be triggered!
        Time zone information should only be used for input and display purposes. All internal time calculations are always carried out in UTC.
        This is the only way to ensure stable handling across all time zones.

        Example: Input : Local_time - Timezone = UTC
        Output
        : UTC + Timezone        = Local_time


        have a nice day
        Manuela
          Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen[br]
          [i][b][color=red]"We need education to cope with digitalization - and NOT the digitalization of education.!"[/color][/b][/i][br]
          [i]Tägliches Stoßgebet: [b]Oh Herr, wirf Hirn vom Himmel ![/i]

          crnogorac081

          Thank you both I understand now
            Web developer

            \n\n