statify icon indicating copy to clipboard operation
statify copied to clipboard

Better dashboard widget

Open Zodiac1978 opened this issue 6 months ago • 4 comments

Inspired through this forum post, I looked at the dashboard widget again and found some improvement possibilities: https://wordpress.org/support/topic/zeitraum-fur-gesamtzahlen-im-dashboard/#post-18521293

  1. Totals from what timeframe - Part 1 The part at the end shows two numbers. Views from today and overall. But as we have now two ways (days of data and days showing in dashboard widget it is unclear what is meant here.

Possible solution: Add a new line with the numbers for x days (which is the config of the dashboard widget).

  1. Totals from what timeframe - Part 2 Is the totals number the sum of all views in the DB or a different value added in the whole time of the plugin installation (save somewhere else)!?

  2. Date is coming from where? The date is showing "seit 25. November 2021" for me, but the config is set to 365 days, so it should show something like "x June 2024", but not 2021. Or is this the date of the installation of the plugin?

  3. Number could be better formatted Total number is showing "798713" for me. But should use number_format_i18n.

  4. Top list from today or overall? In the settings, we can choose between top list only for today or not, but there is no visual indication what is used on the front of the widget. (The days are visible as data points in the graph. The amount of entries in the top list is also self-explanatory, but the "today" or not setting is not easily spotted.)

Zodiac1978 avatar Jun 20 '25 14:06 Zodiac1978

I've looked in my database and the wp_statify table is still showing data from 2021 until 2025. Looks like the limit from 365 days does not work correctly (or I have some custom code overriding this anywhere...)

As the number is displayed by JS it needs to be adjusted by JS or the API should already return a formatted string.

Zodiac1978 avatar Jun 20 '25 15:06 Zodiac1978

Just checked on a site with 14 days display / 365 storage configured. Both Widget and database agree on 2024-06-21 for the oldest entry, which is totally plausible (the site is up for way longer than that)

Cleanup is triggered via cron task statify_cleanup.


The other points in the list are totally valid, we should at least make the toggle a tri-state select like (alltime/display-period/today) and probably rework the widget to make clear what we see.

stklcode avatar Jun 20 '25 15:06 stklcode

I checked with WP Crontrol. The statify_cleanup is not shown. Deactivate and re-activate Statify to re-create it, or what could be a solution for this? And how could a cron go missing?

Zodiac1978 avatar Jun 21 '25 10:06 Zodiac1978

Deactivate and re-activate Statify to re-create it, or what could be a solution for this?

Yes, should be scheduled as daily task during during plugin activation in Statify_Install::init() at least since v1.4.0.

https://github.com/pluginkollektiv/statify/blob/19fed410073261631215409be5cf80b5e79262ae/inc/class-statify-install.php#L76-L83

I just removed the task in WP Control, de- and re-activate Statify (1.8.5 on WP 6.8.1) and it's there again with next run in 23:59h.

And how could a cron go missing?

Hard to tell, never observed such behavior on a live site (testing bad versions that crash during activation or similar can of course have all kinds of interesting effects)...

stklcode avatar Jun 21 '25 12:06 stklcode