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.

Changing timezone in Sign Logger plugin

This is a really good plugin.

I would like to set the log time to London, UK. If I replace the relevant line in default.php with:

date_default_timezone_set('Europe/London');

is that all that is required?

Comments

  • peregrineperegrine MVP
    edited June 2014

    thanks for using my plugin, glad you like it.

    try it, and report back.

    and then add it to the list of plugins that work in 2.1 (assuming you are using vanilla 2.1).

    I already ruined my new year's resolution, of never responding to a post if the user fails to mention their version of vanilla they are using in the opening thread or somewhere in their comments, since my memory is often not good enough to recall other discussions the poster may have made. :) And I am not clairvoyant

    doggone. I am going to stick to this resolution at least for the rest of the day or week.

    for this reason.

    http://vanillaforums.org/discussion/26710/why-adding-your-version-is-more-important-than-ever

    yes, it may not matter in this question, but you never know.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Okay, done it. Disabled plugin first. Uploaded new default.php. The old logs were still in New York time so tried failed logins myself and it works perfectly, showing London time.

    Great!

  • thanks for the experimental proof.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Yes, working fine in 2.1. I omitted to mention version as you were helping me upgrade to 2.1 only hours ago! But yes, memory is a fickle thing.

  • peregrineperegrine MVP
    edited June 2014

    @sudden156 said: Yes, working fine in 2.1. I omitted to mention version as you were helping me upgrade to 2.1 only hours ago! But yes, memory is a fickle thing.

    ah yes, but others didn't know. and now they do know you are using the plugin in version 2.1

    the version number is not just for you and the responder, but for others reading the thread in the future!

    my own little way of improving the forum by forcing people to specify vanilla version,
    at least in my opinion. >:)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • You're quite right. But you have to bear in mind that us occasional forum users aren't always up to par on etiquette whereas you old hands are pulling your hair out over the lack of it. We get there in the end!

  • peregrineperegrine MVP
    edited June 2014

    Good point. as long as you get there in the end! which you seem to have done before the end.

    my thought is this,

    • if I stick to my guns about requiring vanilla version number be specified (and if some others follow suit), most of the comments or discussions will have a version number or instructions to do so and then

    • all new hands and casual posters that read even one discussion, will know to enter their version number of Vanilla , since it will help not only the questioner, the responder, but any future readers of discussions.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • sudden156sudden156 ✭✭
    edited June 2014

    Yes, I think the only way is to continually emphasise it. Like dog training.

    One amusing side-benefit of your Sign Logger plugin is that I'm discovering how many members of my forum are incapable of logging in first time.

  • sudden156sudden156 ✭✭
    edited June 2014

    Scrub what I said about my forum members not being able to log in first time. I've just realised what is described as a 'repeated attempt' by a member is a single successful attempt, as I have just tested that myself.

    It would probably be good to exclude members from the results, if that were possible,

  • peregrineperegrine MVP
    edited June 2014

    @sudden156 said:
    I've just realised what is described as a 'repeated attempt' by a member is a single successful attempt, as I have just tested that myself.

    True

    Yes the description of the plugin says it logs all attempts (successful or not)
    but yes "repeated attempt" is a misnomer. it just means attempt (successful or not) .
    I can change the wording to Attempt.

    It would probably be good to exclude members from the results, if that were possible,

    if you want to start a new discussion
    I might be able to give you some code to modify your plugin
    Be sure to include your vanilla version.

    My goal is to keep the title as closely related to the subject as possible.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited June 2014

    @sudden156 said:
    Scrub what I said about my forum members not being able to log in first time. I've just realised what is described as a 'repeated attempt' by a member is a single successful attempt, as I have just tested that myself.

    It would probably be good to exclude members from the results, if that were possible,

    since you sent me a donation in the past, I figured I'd make a change in the plugin since it was not too difficult.

    version 1.3 might meet your approval. :)

    in version 1.3, I changed it to track root, admin and any login attempt where the user login does not exist in the forum database of users.

    notice I attempted to login as

    root - this is logged - I want to track attempts at root username logins
    admin - this is logged - I want to track attempts at Admin username logins
    miscreant - this is logged - the user doesn't exist.
    peregrine - notice this is not logged ( disregard the primer top line - that is just a reference)

    I normally don't login as the user with userid 1 - which in my case is admin, I just set peregrine to the role admin and use that login and i don't want to track peregrine logins.

    but I could by changing this line in default.php

    $keeptrack = array('root', 'admin');

    e,g, (also enter all names in lower case in the keeptrack array).

    $keeptrack = array('root', 'admin', 'peregrine');

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • see version 1.4 optional settings via config.php read the readme.txt.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • sudden156sudden156 ✭✭
    edited June 2014

    Great, thanks!

    I've tested it out.

    I get 'X -General Signin Attempt' for both a successful and unsuccessful member signin.

    And, as you mention, '! -User Not Found' for a random failed attempt by an unknown.

    And 'A -Admin or Root Login' both for a successful legitimate admin signin (by me), and for spurious hacker attempts as 'admin' (and 'root'). I usually stay signed in so it's still going to be pretty obvious.

    I see the line

    date_default_timezone_set('America/New_York');

    is now blanked out by // in default.php your v 1.4 and default time is now UTC. That makes sense. I unblanked it and set it to Europe/London in mine and it works fine, as before.

    So, some great improvements. Thanks a lot.

  • peregrineperegrine MVP
    edited June 2014

    from some further info supplied by @sudden156

    Apparently changing date_default_timezone_set in the default.php for the plugin may have an impact on the date time of recent users in the dashboard.

    so it is probably best NOT to change the date_default_timezone_set in the default.php in the signlogger plugin and Leave it commented out as it currently is, and you will not have any issues with time in the dashboard as a result of the plugin.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited June 2014

    @sudden156‌

    here is a way that doesn't change the date_default_timezone_set in the default.php

    but will give you the time for London in the signlog

    in default.php

    change

    //  date_default_timezone_set('America/Los_Angeles');
        //  date_default_timezone_set('Europe/Paris');
        //$today = date("F j, Y, g:i a", $timestamp = time() );
        // changing today options. 
    
      //  date_default_timezone_set('America/New_York');
        $today = date("Ymd, g:i a e", $timestamp = time());
    

    to this

     // find your UTC difference with http://www.timeanddate.com/worldclock
    
            // adjust the hourdiff line to the number of hours  you are ahead or behind  UTC  or whatever hourdiff  number works best for your viewing.
    
            //  e.g. London would be + 1    Boston USA would be -4
    
            $hourdiff = +1;
             // notice the e is removed in the formatting to get rid of timezone 
             $today = date("Ymd, g:i a", $timestamp = (time() + ($hourdiff * 3600)));
    
           // $today = date("Ymd, g:i a e", $timestamp = time());
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Ah, that's a nice solution. Thanks.

  • @sudden156‌

    and since you were also interested in recent users in the dashboard.

    if you are not aware of this.

    you could use http://vanillaforums.org/addon/memberslistenh-plugin

    and click on last visit column. it will give you more of a complete overview of when your users are active.

    you could just restrict the view to role admin.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.