• Resolved jeremyers1

    (@jeremyers1)


    I am sure this is simple, but I cannot figure it out…

    My “daily” post stats seem to start over at about 10:00 am or so. So at 9:30 am, it shows the popular posts for the previous 24 hours, but at 10:30, it only shows the popular posts for the last 30 minutes.

    How can I have the stats begin counting at midnight?

Viewing 15 replies - 16 through 30 (of 33 total)
  • Thinking a bit more, where is your server? If it’s not local then you probably won’t be able to get them to change the time.

    Thread Starter jeremyers1

    (@jeremyers1)

    You were right again. It did not permanently change the timezone. Oh well.

    How does WordPress put the right time in for the posts and comments? These also are saved in the Database. Couldn’t the plugin call that time (in the settings) rather than the one in the Database?

    If the times are right for WordPress then it is probably using php times to create strings/data to save in the database and not SQL. This plugin is using both php time functions and sql time functions, CURDATE() is an sql one, to mange time strings.

    To get it fixed, you either need to get it changed on the server, which may not be possible, or add it to the plugin as above with a php call to the DB that fixes it every time a page loads.

    Oh, to answer your last question, yes the plugin could just use php time, but that’s not the way it was written. It looks like the author used the SQL functions to try to take advantage of those functions instead of doing the work in php. In this case one might consider this a design flaw, as not everyone has a server in the timezone that they want their website to be.

    Hmm, been looking at this a bit more, not sure messing with the SQL time_zone is the right answer, it’s probably safe, but depending on how/where you make the change, you are potentially affecting other calls to the DB in WordPress. Have a prototype with no SQL time calls. Still needs a bit of testing. Do you have test install, or just your live sites?

    Thread Starter jeremyers1

    (@jeremyers1)

    Just live sites. I’m probably just going to ignore it for now.

    Just curious, why are you using the daily option? Would a rolling 24hours be better instead of having the reset?

    Thread Starter jeremyers1

    (@jeremyers1)

    Sure. I wouldn’t mind using a rolling 24 hours. The plugin doesn’t seem to have this option. Is there a plugin that does?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi guys,

    Just took a quick read to the conversation and I probably need to re-think this. It’s been a long time since I last took a look into my code so it might take a while to re-learn it and make some improvements.

    This issue has already been noted down on my TODO list. If any of you have any further suggestions about this please let me know.

    @héctor, a timely re-appearance! I was contemplating forking the plugin as it had not been supported for over a year and needed some updating. I’ve patched this time issue using WordPress config based time, and I have another bug patch for a qTranslate issue where the content for the widget display is not language filtered.

    I can send you the patches if you’d like.

    @jeremyers1, no there are not many alternatives to this plugin, which is why I’m using it despite no support for a year, and why I was considering forking it. I was thinking of changing it to have the last 24 hours instead of “today”.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Sure r3, all contributions to make WPP a better plugin are welcome!

    Please send your patches to hcabrerab at gmail. If you add comments to the changes you’ve made to my plugin I’d be more than grateful.

    There is, however, some more fixing to do so I won’t be pushing an update soon. Maybe you want to share the patches here so others can use it until WPP gets updated (probably no more than two weeks, hopefully sooner than that).

    Thank you in advance for your help! I’m sure everyone using this plugin will appreciate it as much as I do now.

    Thread Starter jeremyers1

    (@jeremyers1)

    r3df,
    I would love those patches, if you want to make them available. I think the rolling 24 hour option would be great.

    @jeremyers1, I didn’t do the 24hrs, was just planning it. It’s a bit of a change for the plugin, more data needs to be saved in the DB and managed and tidied. I just fixed the time issue.

    @héctor

    Posted the code. https://pastebin.com/embed_js.php?i=xdtQ3wau
    The change I most need is the one fixing multilingual content for the excerpt at line 805.

Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘How to change when "day" starts for post stats?’ is closed to new replies.