• Resolved markul

    (@markul)


    Hi,

    I think the problem might be caused by something outside of this (btw great) plugin, anyway – help will be highly appreciated.

    I have two WP sites on the same server, same WP version (4.3.1).
    I have installed WP SlimStats (4.2.2) on both, and on one there is everything fine, and on the second the Summary View gives a wrong date range for the Pageviews graph.

    I was searching the forum and I have found how to debug this issue, so I have added the following lines to admin/views/wp-slimstat-db.php, after line 519 ($filters_normalized[ ‘utime’ ][ ‘type’ ] = ‘m’;):

    echo “debug”;
    $test = mktime(0, 0, 0, 12, 1, 2015);
    echo ” month2 “; echo date_i18n( ‘n’ ); echo “, “;
    echo ” start “; echo $filters_normalized[ ‘utime’ ][ ‘start’ ]; echo “, “;
    echo ” end “; echo $filters_normalized[ ‘utime’ ][ ‘end’ ]; echo “, “;
    echo ” date_test “; echo date(“Y-M-d”, mktime(0, 0, 0, 12, 1, 2015)); echo “, “;
    echo ” date_test2 “; echo date(“Y-M-d”, $test); echo “, “;
    echo $test; echo “, “;

    What it produces on the report screen (tested on 8-12-2015) is making me crazy:

    “debug month2 12, start 1448924400, end 1451606399, date_test 2015-Dec-01, date_test2 2015-Dec-01, 1448924400”

    – The epoch date for start date is wrong (1448924400 instead of 1448928000), though somehow it is converted into a right date string (2015-Dec-01), but anyway, the time range for the summary report is set wrong: 30-11-15 – 08-12-15

    Kind regards.

    https://wordpress.org/plugins/wp-slimstat/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Jason Crouse

    (@coolmann)

    Hi,

    the symptoms you describe seem to point to a conflict with another plugin. The behavior of the function date_i18n, which Slimstat uses to calculate all the information, can be altered (is “pluggable”, in WP terminology) by third parties. A quick test would be to deactivate all your other plugins and see if things change.

    Camu

    Thread Starter markul

    (@markul)

    Camu,

    Thanks for swift response.
    After disabling all other plugins there is no change in described behavior.
    The only difference between my two WP sites is that one which is OK is fresh install, and the other had WP SlimStat before. I had to disable it at some point because I had WP 3.5 there, and therefore I couldn’t solve some problems by upgrading your plugin. When I re-installed WP SlimStat (4.2.1) after upgrading WP from 3.5 -> 4.3.1 there was an error (as far as I remember some column was missing in wp_slim_stats table.
    I disabled the plugin, dropped all wp_slim_* tables and re-enabled it. It started to show data except the problem for which I have started this thread. Perhaps the upgrade procedure has left some stuff from 3.5 which is affecting date_i18n? If in your opinion there is no better way, I can try to do a fresh install of 4.3.1 and migrate data from my site there, and see if it helps.

    Regards,
    Marek

    Plugin Author Jason Crouse

    (@coolmann)

    Hi,

    before we proceed with the migration, let’s try a few other things. Is the WordPress timezone (WordPress > Settings > General) the same on both sites?

    Camu

    Thread Starter markul

    (@markul)

    Yes, I tried to do all possible checks before bothering you 🙂
    Timezone on both WP is “Warszawa” (Warsaw = UTC+1).
    Date format: Y-m-d
    Time format: H:i

    System-wide:
    root@vz13295:~# cat /etc/timezone
    Europe/Warsaw

    Plugin Author Jason Crouse

    (@coolmann)

    That’s curious, indeed. Slimstat used to have its own setting for date and time, but that was a looooong time ago, probably like 3 years ago. Could you send us your encoded settings string (maintenance > import and export) so that we can see if that’s the case?

    http://support.wp-slimstat.com

    Thank you,
    Camu

    Thread Starter markul

    (@markul)

    Here you are:
    a:86:… [snip]

    Plugin Author Jason Crouse

    (@coolmann)

    You may want to remove this string from this forum as it contains a secret key that hackers might leverage to access your site, plus info about your users.

    Btw, I don’t see that old setting, so it can’t be it. I’m at a loss here. I guess migration is the only thing to do at this point.

    Camu

    Thread Starter markul

    (@markul)

    OK, so I will proceed with that.
    Please don’t close this thread yet, though I hope migration will do the job 🙂
    Will update you if it was successful.

    Plugin Author Jason Crouse

    (@coolmann)

    Sure, keep us posted.

    Thread Starter markul

    (@markul)

    Hi,

    I have found the culprit. In the theme I have activated on the problem site there was a line in functions.php:

    // Let’s set timezone here independently from the server
    date_default_timezone_set(‘Europe/Warsaw’);

    I have no idea why it was affecting the report, since the same was set in WP settings and in the system. Contemplate on this I will…

    And thank you for giving me a good direction for diagnosing the problem.

    Regards,
    Marek

    Plugin Author Jason Crouse

    (@coolmann)

    Ha! I would have never thought that the theme would be the troublemaker here 🙂 Good catch!

    And thank you for your review, much appreciated!

    Cheers,
    Camu

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Wrong date range in the Summary View’ is closed to new replies.